|
6 | 6 | "testing" |
7 | 7 |
|
8 | 8 | "k8s.io/apimachinery/pkg/util/sets" |
| 9 | + |
| 10 | + "github.com/openshift/api/tools/codegen/pkg/sippy" |
9 | 11 | ) |
10 | 12 |
|
11 | 13 | func Test_listTestResultFor(t *testing.T) { |
@@ -475,3 +477,42 @@ func Test_checkIfTestingIsSufficient_OptionalVariants(t *testing.T) { |
475 | 477 | }) |
476 | 478 | } |
477 | 479 | } |
| 480 | + |
| 481 | +func Test_defaultQueriesIncludeCandidateTier(t *testing.T) { |
| 482 | + // When JobTiers is empty, QueriesFor should generate queries for all tiers |
| 483 | + // including candidate. This test is added to prevent regressions for candidate-tier |
| 484 | + // jobs being excluded, which is used by some TP jobs. |
| 485 | + queries := sippy.QueriesFor("vsphere", "amd64", "ha", "", "", "", "FeatureGate:TestGate]") |
| 486 | + |
| 487 | + tierNames := sets.New[string]() |
| 488 | + for _, q := range queries { |
| 489 | + tierNames.Insert(q.TierName) |
| 490 | + } |
| 491 | + |
| 492 | + expectedTiers := []string{"standard", "informing", "blocking", "candidate"} |
| 493 | + for _, tier := range expectedTiers { |
| 494 | + if !tierNames.Has(tier) { |
| 495 | + t.Errorf("default queries missing tier %q - got tiers: %v", tier, sets.List(tierNames)) |
| 496 | + } |
| 497 | + } |
| 498 | +} |
| 499 | + |
| 500 | +func Test_allRequiredVariantsQueryCandidateTier(t *testing.T) { |
| 501 | + // Verify that all required variant definitions will query for the candidate |
| 502 | + // tier, either explicitly via JobTiers or via the default. |
| 503 | + allVariants := append(append([]JobVariant{}, requiredSelfManagedJobVariants...), requiredHypershiftJobVariants...) |
| 504 | + |
| 505 | + for _, variant := range allVariants { |
| 506 | + queries := sippy.QueriesFor(variant.Cloud, variant.Architecture, variant.Topology, variant.NetworkStack, variant.OS, variant.JobTiers, "FeatureGate:Test]") |
| 507 | + hasCandidateQuery := false |
| 508 | + for _, q := range queries { |
| 509 | + if q.TierName == "candidate" { |
| 510 | + hasCandidateQuery = true |
| 511 | + break |
| 512 | + } |
| 513 | + } |
| 514 | + if !hasCandidateQuery { |
| 515 | + t.Errorf("variant %+v does not query candidate tier - some platforms only run TechPreview tests in candidate-tier jobs", variant) |
| 516 | + } |
| 517 | + } |
| 518 | +} |
0 commit comments