Skip to content

Commit 5734574

Browse files
authored
Merge pull request #17331 from yonasberhe23/allow_skip_214
[backport 2.14.2] Automation: Add env flag to allow skip
2 parents 23a07e8 + 0b7be01 commit 5734574

4 files changed

Lines changed: 31 additions & 24 deletions

File tree

cypress/base-config.ts

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -110,23 +110,25 @@ const baseConfig = defineConfig({
110110
'pkg/rancher-components/src/components/**/*.{vue,ts,js}',
111111
]
112112
},
113-
api: apiUrl,
113+
api: apiUrl,
114114
username,
115-
password: process.env.CATTLE_BOOTSTRAP_PASSWORD || process.env.TEST_PASSWORD,
116-
bootstrapPassword: process.env.CATTLE_BOOTSTRAP_PASSWORD,
117-
grepTags: process.env.GREP_TAGS,
118-
VAI_ENABLED: process.env.VAI_ENABLED,
115+
password: process.env.CATTLE_BOOTSTRAP_PASSWORD || process.env.TEST_PASSWORD,
116+
bootstrapPassword: process.env.CATTLE_BOOTSTRAP_PASSWORD,
117+
grepTags: process.env.GREP_TAGS,
118+
VAI_ENABLED: process.env.VAI_ENABLED,
119119
// the below env vars are only available to tests that run in Jenkins
120-
awsAccessKey: process.env.AWS_ACCESS_KEY_ID,
121-
awsSecretKey: process.env.AWS_SECRET_ACCESS_KEY,
122-
azureSubscriptionId: process.env.AZURE_AKS_SUBSCRIPTION_ID,
123-
azureClientId: process.env.AZURE_CLIENT_ID,
124-
azureClientSecret: process.env.AZURE_CLIENT_SECRET,
125-
customNodeIp: process.env.CUSTOM_NODE_IP,
126-
customNodeKey: process.env.CUSTOM_NODE_KEY,
127-
accessibility: !!process.env.TEST_A11Y, // Are we running accessibility tests?
128-
a11yFolder: path.join('.', 'cypress', 'accessibility'),
129-
gkeServiceAccount: process.env.GKE_SERVICE_ACCOUNT,
120+
awsAccessKey: process.env.AWS_ACCESS_KEY_ID,
121+
awsSecretKey: process.env.AWS_SECRET_ACCESS_KEY,
122+
azureSubscriptionId: process.env.AZURE_AKS_SUBSCRIPTION_ID,
123+
azureClientId: process.env.AZURE_CLIENT_ID,
124+
azureClientSecret: process.env.AZURE_CLIENT_SECRET,
125+
customNodeIp: process.env.CUSTOM_NODE_IP,
126+
customNodeKey: process.env.CUSTOM_NODE_KEY,
127+
accessibility: !!process.env.TEST_A11Y, // Are we running accessibility tests?
128+
a11yFolder: path.join('.', 'cypress', 'accessibility'),
129+
gkeServiceAccount: process.env.GKE_SERVICE_ACCOUNT,
130+
// Set to 'true' to allow skipping when a chart is filtered from the UI catalog.
131+
allowFilteredCatalogSkip: process.env.CYPRESS_ALLOW_FILTERED_CATALOG_SKIP,
130132
},
131133
reporter: 'cypress-mochawesome-reporter',
132134
reporterOptions: {

cypress/e2e/tests/pages/charts/chart-install-wizard.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ describe('Charts Wizard', { testIsolation: 'off', tags: ['@charts', '@adminUser'
125125
const chartApp = 'rancher-backup';
126126
const chartCrd = 'rancher-backup-crd';
127127

128-
cy.createRancherResource('v1', `catalog.cattle.io.apps/${ chartNamespace }/${ chartApp }?action=uninstall`, '{}');
129-
cy.createRancherResource('v1', `catalog.cattle.io.apps/${ chartNamespace }/${ chartCrd }?action=uninstall`, '{}');
128+
cy.createRancherResource('v1', `catalog.cattle.io.apps/${ chartNamespace }/${ chartApp }?action=uninstall`, '{}', false);
129+
cy.createRancherResource('v1', `catalog.cattle.io.apps/${ chartNamespace }/${ chartCrd }?action=uninstall`, '{}', false);
130130
cy.updateNamespaceFilter('local', 'none', '{"local":["all://user"]}');
131131
});
132132
});

cypress/e2e/tests/pages/charts/compliance.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ describe('Charts', { testIsolation: 'off', tags: ['@charts', '@adminUser'] }, ()
100100
const chartApp = 'rancher-compliance';
101101
const chartCrd = 'rancher-compliance-crd';
102102

103-
cy.createRancherResource('v1', `catalog.cattle.io.apps/${ chartNamespace }/${ chartApp }?action=uninstall`, '{}');
104-
cy.createRancherResource('v1', `catalog.cattle.io.apps/${ chartNamespace }/${ chartCrd }?action=uninstall`, '{}');
103+
cy.createRancherResource('v1', `catalog.cattle.io.apps/${ chartNamespace }/${ chartApp }?action=uninstall`, '{}', false);
104+
cy.createRancherResource('v1', `catalog.cattle.io.apps/${ chartNamespace }/${ chartCrd }?action=uninstall`, '{}', false);
105105
cy.updateNamespaceFilter('local', 'none', '{"local":["all://user"]}');
106106
});
107107
});

cypress/support/commands/rancher-api-commands.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1591,9 +1591,10 @@ Cypress.Commands.add('checkChartPresence', (repoName: string, chartKey: string)
15911591
});
15921592

15931593
/**
1594-
* Runs the given callback only when the chart is available in the filtered catalog index.
1595-
* Skips the test when the chart exists in the catalog but is filtered out intentionally (e.g. based on k8s or Rancher annotations).
1596-
* Throws when the chart is missing from the unfiltered index (publishing/sync issue).
1594+
* Runs `callback` when `chartKey` is present in the filtered catalog index (the list the Charts UI uses).
1595+
* Throws error if the chart is missing from the unfiltered index — that points to catalog publish or sync, not compatibility filtering.
1596+
* If the chart is in the unfiltered index but not the filtered index, skips when Cypress env `allowFilteredCatalogSkip`
1597+
* is enabled; otherwise throws error.
15971598
*/
15981599
export function runTestWhenChartAvailable(
15991600
repo: string,
@@ -1607,9 +1608,13 @@ export function runTestWhenChartAvailable(
16071608
}
16081609

16091610
if (!inFiltered) {
1610-
cy.log(`Skipping: chart '${ chartKey }' is intentionally hidden from the filtered catalog index`);
1611+
if (String(Cypress.env('allowFilteredCatalogSkip')).toLowerCase() === 'true') {
1612+
cy.log(`Skipping: chart '${ chartKey }' is intentionally hidden from the filtered catalog index`);
16111613

1612-
return mochaContext.skip();
1614+
return mochaContext.skip();
1615+
}
1616+
1617+
throw new Error(`Failing: chart '${ chartKey }' is not in the filtered catalog index, so it does not appear in the Charts/Tools UI for this environment.`);
16131618
}
16141619

16151620
callback();

0 commit comments

Comments
 (0)