Skip to content

Commit

Permalink
integration-tests/basic: Add --stdin test
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaofengli committed Oct 6, 2024
1 parent c54c26d commit 96383cc
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions integration-tests/basic/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,12 @@ in {
with subtest("Check that we can push a path"):
client.succeed("${makeTestDerivation} test.nix")
test_file = client.succeed("nix-build --no-out-link test.nix")
test_file = client.succeed("nix-build --no-out-link test.nix").strip()
test_file_hash = test_file.removeprefix("/nix/store/")[:32]
client.succeed(f"attic push test {test_file}")
client.succeed(f"nix-store --delete {test_file}")
client.fail(f"grep hello {test_file}")
client.fail(f"ls {test_file}")
with subtest("Check that we can pull a path"):
client.succeed("attic use readonly:test")
Expand All @@ -219,6 +219,25 @@ in {
client.fail(f"attic push readonly:test {test_file}")
client.fail(f"attic push anon:test {test_file} 2>&1")
with subtest("Check that we can push a list of paths from stdin"):
paths = []
for i in range(10):
client.succeed(f"${makeTestDerivation} seq{i}.nix")
path = client.succeed(f"nix-build --no-out-link seq{i}.nix").strip()
client.succeed(f"echo {path} >>paths.txt")
paths.append(path)
client.succeed("attic push test --stdin <paths.txt 2>&1")
for path in paths:
client.succeed(f"nix-store --delete {path}")
with subtest("Check that we can pull the paths back"):
for path in paths:
client.fail(f"ls {path}")
client.succeed(f"nix-store -r {path}")
client.succeed(f"grep hello {path}")
with subtest("Check that we can make the cache public"):
client.fail("curl -sL --fail-with-body http://server:8080/test/nix-cache-info")
client.fail(f"curl -sL --fail-with-body http://server:8080/test/{test_file_hash}.narinfo")
Expand Down

0 comments on commit 96383cc

Please sign in to comment.