1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-08 19:46:02 +01:00

refactor(tests/nixos/s3-binary-cache-store): clean client store in setup_s3

Add cleanup of client store in the finally block of setup_s3 decorator.
Uses `nix store delete --ignore-liveness` to properly handle GC roots
and only attempts deletion if the path exists.
This commit is contained in:
Bernardo Meurer Costa 2025-10-18 23:36:42 +00:00
parent 9058d90ab2
commit f88c3055f8
No known key found for this signature in database

View file

@ -139,6 +139,7 @@ in
""" """
Decorator that creates/destroys a unique bucket for each test. Decorator that creates/destroys a unique bucket for each test.
Optionally pre-populates bucket with specified packages. Optionally pre-populates bucket with specified packages.
Cleans up client store after test completion.
Args: Args:
populate_bucket: List of packages to upload before test runs populate_bucket: List of packages to upload before test runs
@ -155,6 +156,9 @@ in
test_func(bucket) test_func(bucket)
finally: finally:
server.succeed(f"mc rb --force minio/{bucket}") server.succeed(f"mc rb --force minio/{bucket}")
# Clean up client store - only delete if path exists
for pkg in PKGS.values():
client.succeed(f"[ ! -e {pkg} ] || nix store delete --ignore-liveness {pkg}")
return wrapper return wrapper
return decorator return decorator