dagger-rs/crates/dagger-sdk/tests/mod.rs
kjuulh 9be6f435d9 feat(sdk,core): Use async runtime instead of blocking.
Default to using async runtime instead of blocking. I.e.

```rust
fn main() -> eyre::Result<()> {
  // ...

  client.container().from("rust").publish("somewhere")?;

  // ...
}

// to

async fn main() -> eyre::Result<()> {
  // ...

  client.container().from("rust").publish("somewhere").await?;

  // ...
}
```
2023-02-19 21:47:40 +01:00

22 lines
511 B
Rust

use dagger_sdk::{connect, ContainerExecOptsBuilder};
#[tokio::test]
async fn test_example_container() {
let client = connect().unwrap();
let alpine = client.container().from("alpine:3.16.2");
let out = alpine
.exec_opts(
ContainerExecOptsBuilder::default()
.args(vec!["cat", "/etc/alpine-release"])
.build()
.unwrap(),
)
.stdout()
.await
.unwrap();
assert_eq!(out, "3.16.2\n".to_string())
}