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

Commit

Permalink
feat: introduce tests again
Browse files Browse the repository at this point in the history
  • Loading branch information
kjuulh committed Feb 25, 2023
1 parent ecca036 commit f9e7af9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
17 changes: 15 additions & 2 deletions ci/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,21 @@ async fn select_base_image(client: Arc<Query>) -> eyre::Result<Container> {
src_dir
}

async fn validate_pr(_client: Arc<Query>, container: Container) -> eyre::Result<()> {
//let container = container.with_exec(vec!["cargo", "test", "--all"], None);
async fn validate_pr(client: Arc<Query>, container: Container) -> eyre::Result<()> {
let exit = container.exit_code().await?;
if exit != 0 {
eyre::bail!("container failed with non-zero exit code");
}
let docker_cli = client
.container()
.from("docker:cli")
.file("/usr/local/bin/docker");
let socket = client.host().unix_socket("/var/run/docker.sock");

let container = container
.with_mounted_file("/usr/bin/docker", docker_cli.id().await?)
.with_unix_socket("/var/run/docker.sock", socket.id().await?)
.with_exec(vec!["cargo", "test", "--all"]);

let exit = container.exit_code().await?;
if exit != 0 {
Expand Down
9 changes: 5 additions & 4 deletions crates/dagger-core/src/downloader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ impl Platform {
let normalize_arch = match arch.as_str() {
"x86_64" => "amd64",
"aarch" => "arm64",
"aarch64" => "arm64",
arch => arch,
};

Expand Down Expand Up @@ -138,6 +139,10 @@ impl Downloader {
if let Ok(entry) = file {
let path = entry.path();
if path != cli_bin_path {
println!(
"deleting client: path: {:?} vs cli_bin_path: {:?}",
path, cli_bin_path
);
std::fs::remove_file(path)?;
}
}
Expand Down Expand Up @@ -200,8 +205,6 @@ impl Downloader {
hasher.update(&bytes);
let res = hasher.finalize();

println!("{}", hex::encode(&res));

if archive_url.ends_with(".zip") {
// TODO: Nothing for now
todo!()
Expand All @@ -220,8 +223,6 @@ impl Downloader {
let mut entry = entry?;
let path = entry.path()?;

println!("path: {:?}", path);

if path.ends_with("dagger") {
copy(&mut entry, output)?;

Expand Down

0 comments on commit f9e7af9

Please sign in to comment.