|
135 | 135 | print(output) |
136 | 136 | raise Exception(f"{error_msg}: expected {expected}, got {actual}") |
137 | 137 |
|
138 | | - def with_test_bucket(populate_with=[]): |
| 138 | + def setup_s3(populate_with=[]): |
139 | 139 | """ |
140 | 140 | Decorator that creates/destroys a unique bucket for each test. |
141 | 141 | Optionally pre-populates bucket with specified packages. |
|
162 | 162 | # Test Functions |
163 | 163 | # ============================================================================ |
164 | 164 |
|
165 | | - @with_test_bucket() |
| 165 | + @setup_s3() |
166 | 166 | def test_credential_caching(bucket): |
167 | 167 | """Verify credential providers are cached and reused""" |
168 | 168 | print("\n=== Testing Credential Caching ===") |
|
182 | 182 |
|
183 | 183 | print("✓ Credential provider created once and cached") |
184 | 184 |
|
185 | | - @with_test_bucket(populate_with=[PKGS['A']]) |
| 185 | + @setup_s3(populate_with=[PKGS['A']]) |
186 | 186 | def test_fetchurl_basic(bucket): |
187 | 187 | """Test builtins.fetchurl works with s3:// URLs""" |
188 | 188 | print("\n=== Testing builtins.fetchurl ===") |
|
198 | 198 |
|
199 | 199 | print("✓ builtins.fetchurl works with s3:// URLs") |
200 | 200 |
|
201 | | - @with_test_bucket() |
| 201 | + @setup_s3() |
202 | 202 | def test_error_message_formatting(bucket): |
203 | 203 | """Verify error messages display URLs correctly""" |
204 | 204 | print("\n=== Testing Error Message Formatting ===") |
|
218 | 218 |
|
219 | 219 | print("✓ Error messages format URLs correctly") |
220 | 220 |
|
221 | | - @with_test_bucket(populate_with=[PKGS['A']]) |
| 221 | + @setup_s3(populate_with=[PKGS['A']]) |
222 | 222 | def test_fork_credential_preresolution(bucket): |
223 | 223 | """Test credential pre-resolution in forked processes""" |
224 | 224 | print("\n=== Testing Fork Credential Pre-resolution ===") |
|
298 | 298 |
|
299 | 299 | print(" ✓ Child uses pre-resolved credentials (no new providers)") |
300 | 300 |
|
301 | | - @with_test_bucket(populate_with=[PKGS['A'], PKGS['B'], PKGS['C']]) |
| 301 | + @setup_s3(populate_with=[PKGS['A'], PKGS['B'], PKGS['C']]) |
302 | 302 | def test_store_operations(bucket): |
303 | 303 | """Test nix store info and copy operations""" |
304 | 304 | print("\n=== Testing Store Operations ===") |
|
337 | 337 | print(" ✓ nix copy works") |
338 | 338 | print(" ✓ Credentials cached on client") |
339 | 339 |
|
340 | | - @with_test_bucket(populate_with=[PKGS['A']]) |
| 340 | + @setup_s3(populate_with=[PKGS['A']]) |
341 | 341 | def test_url_format_variations(bucket): |
342 | 342 | """Test different S3 URL parameter combinations""" |
343 | 343 | print("\n=== Testing URL Format Variations ===") |
|
352 | 352 | client.succeed(f"{ENV_WITH_CREDS} nix store info --store '{url2}' >&2") |
353 | 353 | print(" ✓ Parameter order: endpoint before region works") |
354 | 354 |
|
355 | | - @with_test_bucket(populate_with=[PKGS['A']]) |
| 355 | + @setup_s3(populate_with=[PKGS['A']]) |
356 | 356 | def test_concurrent_fetches(bucket): |
357 | 357 | """Validate thread safety with concurrent S3 operations""" |
358 | 358 | print("\n=== Testing Concurrent Fetches ===") |
|
414 | 414 | f"Expected 5 FileTransfer instances for 5 concurrent fetches, got {transfers_created}" |
415 | 415 | ) |
416 | 416 |
|
417 | | - @with_test_bucket() |
| 417 | + @setup_s3() |
418 | 418 | def test_compression_narinfo_gzip(bucket): |
419 | 419 | """Test narinfo compression with gzip""" |
420 | 420 | print("\n=== Testing Compression: narinfo (gzip) ===") |
|
433 | 433 |
|
434 | 434 | print(" ✓ Client decompressed .narinfo successfully") |
435 | 435 |
|
436 | | - @with_test_bucket() |
| 436 | + @setup_s3() |
437 | 437 | def test_compression_mixed(bucket): |
438 | 438 | """Test mixed compression (narinfo=xz, ls=gzip)""" |
439 | 439 | print("\n=== Testing Compression: mixed (narinfo=xz, ls=gzip) ===") |
|
461 | 461 |
|
462 | 462 | print(" ✓ Client downloaded package with mixed compression") |
463 | 463 |
|
464 | | - @with_test_bucket() |
| 464 | + @setup_s3() |
465 | 465 | def test_compression_disabled(bucket): |
466 | 466 | """Verify no compression by default""" |
467 | 467 | print("\n=== Testing Compression: disabled (default) ===") |
|
0 commit comments