Skip to content

Commit

Permalink
WIP: postbuildstepper tests
Browse files Browse the repository at this point in the history
  • Loading branch information
steveej committed Oct 30, 2024
1 parent d5fc666 commit 1ecfebd
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
10 changes: 9 additions & 1 deletion applications/postbuildstepper/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,15 @@ fn main() -> anyhow::Result<()> {

// copy the store path
util::nix_cmd_helper(
["copy", "--verbose", "--to", &copy_destination, &store_path],
[
"copy",
"--verbose",
"--verbose",
"--verbose",
"--to",
&copy_destination,
&store_path,
],
copy_envs.iter().map(|(k, v)| (k, v.path().as_os_str())),
)?;
info!("successfully pushed store path {store_path}");
Expand Down
25 changes: 19 additions & 6 deletions modules/flake-parts/packages.postbuildstepper/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# System independent arguments.
self,
inputs,
lib,
...
}:
{
Expand All @@ -11,6 +10,7 @@
# Arguments specific to the `perSystem` context.
pkgs,
self',
lib,
...
}:
{
Expand Down Expand Up @@ -69,7 +69,7 @@
SECRET_cacheHoloHost2secret="testing-2:CoS7sAPcH1M+LD+D/fg9sc1V3uKk88VMHZ/MvAJHsuMSasehxxlUKNa0LUedGgFfA1wlRYF74BNcAldRxX2g8A==" \
SECRET_awsSharedCredentialsFile="~/.aws/credentials" \
PROP_out_path="${pkgs.hello}" \
nix run .\#postbuildstepper
${pkgs.lib.getExe' self.packages.${system}.postbuildstepper "postbuildstepper"}
'';
};

Expand Down Expand Up @@ -98,8 +98,8 @@
{
networking.hosts = {
"127.0.0.1" = [
"cache.holo.host"
"s3.wasabisys.com"
s3.bucket
s3.endpoint
];
};

Expand All @@ -111,23 +111,36 @@
services.minio = {
enable = true;
browser = false;
listenAddress = "127.0.0.1:80";
listenAddress = "127.0.0.1:9000";
rootCredentialsFile = pkgs.writeText "creds" ''
MINIO_ROOT_USER=${s3.key}
MINIO_ROOT_PASSWORD=${s3.secret}
'';
};

services.caddy.enable = true;
services.caddy.globalConfig = ''
auto_https off
'';
services.caddy.virtualHosts.":80" = {
hostName = s3.endpoint;
extraConfig = ''
reverse_proxy http://${config.services.minio.listenAddress}
'';
};

environment.systemPackages = [ pkgs.hello ];
};
};

testScript = ''
machine.start()
machine.wait_for_unit("minio.service")
machine.wait_for_unit("caddy.service")
# TODO: insert credentials and pass them to the test as well
machine.succeed("${lib.getExe self'.packages.postbuildstepper-test}", timeout = 10)
'';

};
};
};
Expand Down

0 comments on commit 1ecfebd

Please sign in to comment.