Skip to content
This repository has been archived by the owner on Jun 29, 2023. It is now read-only.

Commit

Permalink
refactor: move issues to actual tests and refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
kjuulh committed Mar 13, 2023
1 parent c025d17 commit 9ba0139
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 86 deletions.
42 changes: 0 additions & 42 deletions crates/dagger-sdk/examples/iss-30-alt/main.rs

This file was deleted.

44 changes: 0 additions & 44 deletions crates/dagger-sdk/examples/iss-30/main.rs

This file was deleted.

Binary file added crates/dagger-sdk/test
Binary file not shown.
63 changes: 63 additions & 0 deletions crates/dagger-sdk/tests/issues/iss_30.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
use dagger_sdk::{
ContainerBuildOptsBuilder, HostDirectoryOpts, QueryContainerOpts, QueryContainerOptsBuilder,
};

static PLATFORMS: [&str; 2] = ["linux/arm64", "linux/x86_64"];

#[tokio::test]
async fn test_issue_30_alt() -> eyre::Result<()> {
let client = dagger_sdk::connect().await?;

let context = client.host().directory_opts(
".",
HostDirectoryOpts {
exclude: Some(vec!["target", "client/node_modules", "client/build"]),
include: None,
},
);

for platform in PLATFORMS {
let ref_ = client
.container_opts(QueryContainerOpts {
id: None,
platform: Some(platform.to_string().into()),
})
.from("alpine")
.export("./test")
.await?;

println!("published image to: {:#?}", ref_);
}

Ok(())
}

#[tokio::test]
async fn test_issue_30() -> eyre::Result<()> {
let client = dagger_sdk::connect().await?;

let context = client.host().directory_opts(
".",
HostDirectoryOpts {
exclude: Some(vec!["target", "client/node_modules", "client/build"]),
include: None,
},
);

for platform in PLATFORMS {
let ref_ = client
.container_opts(
QueryContainerOptsBuilder::default()
.platform(platform)
.build()
.unwrap(),
)
.from("alpine")
.export("./test")
.await?;

println!("published image to: {:#?}", ref_);
}

Ok(())
}
1 change: 1 addition & 0 deletions crates/dagger-sdk/tests/issues/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mod iss_30;
2 changes: 2 additions & 0 deletions crates/dagger-sdk/tests/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
mod issues;

use dagger_sdk::{connect, ContainerExecOptsBuilder};
use pretty_assertions::assert_eq;

Expand Down

0 comments on commit 9ba0139

Please sign in to comment.