TestValidateSnapshotVSAs_Comprehensive tests the full snapshot processing functionality
(t *testing.T)
| 1404 | |
| 1405 | // TestValidateSnapshotVSAs_Comprehensive tests the full snapshot processing functionality |
| 1406 | func TestValidateSnapshotVSAs_Comprehensive(t *testing.T) { |
| 1407 | ctx := context.Background() |
| 1408 | |
| 1409 | // Create test data with various scenarios |
| 1410 | data := &validateVSAData{ |
| 1411 | images: "test-snapshot.json", |
| 1412 | policyConfig: "test-policy.yaml", |
| 1413 | vsaExpirationStr: "24h", |
| 1414 | workers: 2, |
| 1415 | } |
| 1416 | |
| 1417 | tests := []struct { |
| 1418 | name string |
| 1419 | data *validateVSAData |
| 1420 | expectError bool |
| 1421 | errorContains string |
| 1422 | }{ |
| 1423 | { |
| 1424 | name: "valid snapshot processing", |
| 1425 | data: data, |
| 1426 | expectError: false, |
| 1427 | }, |
| 1428 | { |
| 1429 | name: "missing snapshot file", |
| 1430 | data: &validateVSAData{ |
| 1431 | images: "nonexistent.json", |
| 1432 | policyConfig: "test-policy.yaml", |
| 1433 | vsaExpirationStr: "24h", |
| 1434 | workers: 2, |
| 1435 | }, |
| 1436 | expectError: true, |
| 1437 | errorContains: "failed to parse", |
| 1438 | }, |
| 1439 | { |
| 1440 | name: "invalid workers count", |
| 1441 | data: &validateVSAData{ |
| 1442 | images: "test-snapshot.json", |
| 1443 | policyConfig: "test-policy.yaml", |
| 1444 | vsaExpirationStr: "24h", |
| 1445 | workers: -1, |
| 1446 | }, |
| 1447 | expectError: true, |
| 1448 | errorContains: "failed to parse", |
| 1449 | }, |
| 1450 | { |
| 1451 | name: "zero workers count", |
| 1452 | data: &validateVSAData{ |
| 1453 | images: "test-snapshot.json", |
| 1454 | policyConfig: "test-policy.yaml", |
| 1455 | vsaExpirationStr: "24h", |
| 1456 | workers: 0, |
| 1457 | }, |
| 1458 | expectError: true, |
| 1459 | errorContains: "failed to parse", |
| 1460 | }, |
| 1461 | } |
| 1462 | |
| 1463 | for _, tt := range tests { |
nothing calls this directly
no test coverage detected