mirror of
https://github.com/NixOS/nix.git
synced 2025-11-08 19:46:02 +01:00
feat(tests/nixos/s3-binary-cache-store): add public parameter to setup_s3
Add optional 'public' parameter to setup_s3 decorator. When set to True, the bucket will be made publicly accessible using mc anonymous set.
This commit is contained in:
parent
5b4bd5bcb8
commit
7d0c06f921
1 changed files with 4 additions and 1 deletions
|
|
@ -131,7 +131,7 @@ in
|
||||||
print(output)
|
print(output)
|
||||||
raise Exception(f"{error_msg}: expected {expected}, got {actual}")
|
raise Exception(f"{error_msg}: expected {expected}, got {actual}")
|
||||||
|
|
||||||
def setup_s3(populate_bucket=[]):
|
def setup_s3(populate_bucket=[], public=False):
|
||||||
"""
|
"""
|
||||||
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.
|
||||||
|
|
@ -139,11 +139,14 @@ in
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
populate_bucket: List of packages to upload before test runs
|
populate_bucket: List of packages to upload before test runs
|
||||||
|
public: If True, make the bucket publicly accessible
|
||||||
"""
|
"""
|
||||||
def decorator(test_func):
|
def decorator(test_func):
|
||||||
def wrapper():
|
def wrapper():
|
||||||
bucket = str(uuid.uuid4())
|
bucket = str(uuid.uuid4())
|
||||||
server.succeed(f"mc mb minio/{bucket}")
|
server.succeed(f"mc mb minio/{bucket}")
|
||||||
|
if public:
|
||||||
|
server.succeed(f"mc anonymous set download minio/{bucket}")
|
||||||
try:
|
try:
|
||||||
if populate_bucket:
|
if populate_bucket:
|
||||||
store_url = make_s3_url(bucket)
|
store_url = make_s3_url(bucket)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue