Skip to content

Commit 80e3327

Browse files
committed
test(libstore): more s3 url tests
1 parent 9f12bd7 commit 80e3327

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

tests/nixos/s3-binary-cache-store.nix

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,29 @@ in
8282
8383
# Test that the format string in the error message is properly setup and won't display `%s` instead of the failed URI
8484
msg = client.fail("${env} nix eval --impure --expr 'builtins.fetchurl { name = \"foo\"; url = \"${objectThatDoesNotExist}\"; }' 2>&1")
85-
if "S3 object '${objectThatDoesNotExist}' does not exist" not in msg:
85+
if "unable to download '${objectThatDoesNotExist}': HTTP error 404" not in msg:
8686
print(msg) # So that you can see the message that was improperly formatted
8787
raise Exception("Error message formatting didn't work")
8888
8989
# Copy a package from the binary cache.
9090
client.fail("nix path-info ${pkgA}")
9191
92+
# Test nix store info with various S3 URL formats
9293
client.succeed("${env} nix store info --store '${storeUrl}' >&2")
9394
95+
# Test with different region parameter (should work without warnings)
96+
client.succeed("${env} nix store info --store 's3://my-cache?endpoint=http://server:9000&region=us-east-2' >&2")
97+
98+
# Test with just bucket name and region
99+
client.succeed("${env} nix store info --store 's3://my-cache?region=eu-west-1&endpoint=http://server:9000' >&2")
100+
101+
# Test that store info shows the store is available
102+
info = client.succeed("${env} nix store info --json --store '${storeUrl}'")
103+
import json
104+
store_info = json.loads(info)
105+
assert store_info.get("url"), "Store should have a URL"
106+
print(f"Store URL: {store_info.get('url')}")
107+
94108
client.succeed("${env} nix copy --no-check-sigs --from '${storeUrl}' ${pkgA}")
95109
96110
client.succeed("nix path-info ${pkgA}")

0 commit comments

Comments
 (0)