From 91019afd9027d93d732606c9aa406f06674172ab Mon Sep 17 00:00:00 2001 From: Lin Yinfeng Date: Fri, 1 Dec 2023 16:37:11 +0800 Subject: [PATCH] Fix integration-test --- .github/workflows/check.yml | 11 ++++++----- integration-test/default.nix | 7 +++++++ integration-test/test.sh | 10 +++++----- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 722f3fa..96c7aec 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -123,7 +123,8 @@ jobs: - name: Get test packages from cache.nixos.org run: | nix path-info --derivation --recursive "$PACKAGE_FOR_TEST" > /tmp/derivers - cat /tmp/derivers | xargs nix build --no-link --print-out-paths > /tmp/derived + + nix build "$PACKAGE_FOR_TEST" --no-link --print-out-paths > /tmp/derived cat /tmp/derived | xargs nix path-info --recursive > /tmp/derived_closure cat /tmp/derivers /tmp/derived_closure | sort | uniq > /tmp/store_paths @@ -137,7 +138,7 @@ jobs: # sign first,then push with --already-signed # oranc will check generated signature matches already exists signature - cat /tmp/store_paths | \ + cat /tmp/derived_closure | \ xargs nix store sign --key-file /tmp/nix-key-pair/secret # push everything @@ -151,7 +152,7 @@ jobs: --already-signed - name: Verify remote store run: | - cat /tmp/store_paths | \ + cat /tmp/derived_closure | \ xargs nix store verify \ --store "$STORE_URL" \ --trusted-public-keys "$(cat /tmp/nix-key-pair/public)" @@ -162,7 +163,7 @@ jobs: run: | # instantiate derivations again nix path-info --derivation --recursive "$PACKAGE_FOR_TEST" > /dev/null - cat /tmp/derived_closure | \ + cat /tmp/derived | \ xargs nix build \ --no-link \ --max-jobs 0 \ @@ -170,6 +171,6 @@ jobs: --trusted-public-keys "$(cat /tmp/nix-key-pair/public)" - name: Verify local store run: | - cat /tmp/store_paths | \ + cat /tmp/derived_closure | \ xargs nix store verify \ --trusted-public-keys "$(cat /tmp/nix-key-pair/public)" diff --git a/integration-test/default.nix b/integration-test/default.nix index d185add..ea7a0af 100644 --- a/integration-test/default.nix +++ b/integration-test/default.nix @@ -12,6 +12,8 @@ curl, findutils, shadow, + gnused, + tcping-go, }: let packageForTest = "github:nixos/nixpkgs/nixos-unstable#coreutils"; composeFile = (formats.yaml {}).generate "container-compose-yml" { @@ -24,6 +26,9 @@ environment = [ "EXTRA_ARGS=--no-ssl" ]; + depends_on = { + registry = {condition = "service_started";}; + }; }; oranc-test-script = { image = "oranc-test-script:${dockerImage.imageTag}"; @@ -54,6 +59,8 @@ curl findutils shadow + tcping-go + gnused dockerTools.caCertificates ]; }; diff --git a/integration-test/test.sh b/integration-test/test.sh index 2fcf0c9..ccc84d9 100644 --- a/integration-test/test.sh +++ b/integration-test/test.sh @@ -52,7 +52,7 @@ stage "setting up variables..." registry="registry:5000" repository="test-user/oranc-cache" -substituter="http://oranc/registry:5000/$repository" +substituter="http://oranc/$registry/$repository" public_key="$(cat public)" export ORANC_SIGNING_KEY="$(cat secret)" @@ -64,7 +64,7 @@ curl "$substituter/nix-cache-info" -v stage "get test packages" nix path-info --derivation --recursive "$PACKAGE_FOR_TEST" >derivers -cat derivers | xargs nix build --no-link --print-out-paths >derived +nix build "$PACKAGE_FOR_TEST" --no-link --print-out-paths >derived cat derived | xargs nix path-info --recursive >derived_closure cat derivers derived_closure >store_paths @@ -80,7 +80,7 @@ cat store_paths # sign first, then push with --already-signed # oranc will check its signature matches already exists signature -cat store_paths | xargs nix store sign --key-file secret --verbose +cat derived_closure | xargs nix store sign --key-file secret --verbose cat store_paths | oranc push \ --no-ssl \ @@ -104,7 +104,7 @@ stage "get test package from registry" # instantiate derivations again nix path-info --derivation --recursive "$PACKAGE_FOR_TEST" >/dev/null -cat derived_closure | +cat derived | xargs nix build \ --no-link \ --max-jobs 0 \ @@ -114,6 +114,6 @@ cat derived_closure | stage "verify local store" -cat store_paths | xargs nix store verify \ +cat derived_closure | xargs nix store verify \ --trusted-public-keys "$public_key" \ --verbose