Skip to content

Commit

Permalink
docs(quickstart): make the first example runnable (#751)
Browse files Browse the repository at this point in the history
This solves #749.
  • Loading branch information
baghai authored Oct 20, 2024
1 parent 4049724 commit d9e7914
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions docs/quickstart/testcontainers.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,20 @@ cargo add testcontainers --features blocking
## 3. Spin up Redis

```rust
use testcontainers::{core::{IntoContainerPort, WaitFor}, runners::AsyncRunner, GenericImage};
use testcontainers::{
core::{IntoContainerPort, WaitFor},
runners::AsyncRunner,
GenericImage,
};

#[tokio::test]
async fn test_redis() -> Result<(), Box<dyn std::error::Error + 'static>> {
let container = GenericImage::new("redis", "7.2.4")
async fn test_redis() {
let _container = GenericImage::new("redis", "7.2.4")
.with_exposed_port(6379.tcp())
.with_wait_for(WaitFor::message_on_stdout("Ready to accept connections"))
.start()?
.await;
.start()
.await
.unwrap();
}
```

Expand Down

0 comments on commit d9e7914

Please sign in to comment.