Skip to content

Commit

Permalink
Bug 1918068: Fix flaky OLM Cypress tests
Browse files Browse the repository at this point in the history
Remove conditional logic in OLM Operator install workflow integration tests and just use an
extended timeout instead.
  • Loading branch information
TheRealJon committed Jan 20, 2021
1 parent 16ef2d5 commit 898472c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -1,29 +1,6 @@
import { modal } from '../../../integration-tests-cypress/views/modal';
import { listPage } from '../../../integration-tests-cypress/views/list-page';

const verifyPackageManifest = (opName: string, csName: string, depth: number = 0) => {
// prevent infinite recursion of verifyPackageManifest
expect(depth).toBeLessThan(20);
cy.log('verify the PackageManifest has been created');

return cy
.visit(
`/k8s/ns/openshift-marketplace/operators.coreos.com~v1alpha1~CatalogSource/${csName}/operators?packagemanifest-name=${opName}`,
)
.byTestID('filter-toolbar')
.should('exist')
.then(() => {
const row = Cypress.$(`[data-test-rows="resource-row"]:contains("${opName}")`);
if (row && row.length) {
cy.get(`[data-test-rows="resource-row"]`).contains(opName);
} else {
cy.log(`Did not find ${opName} in ${csName}, waiting to try again`);
cy.wait(5000);
verifyPackageManifest(opName, csName, depth + 1);
}
});
};

export const createCatalogSource = (operatorName: string, catalogSourceName: string) => {
cy.log('navigate to OperatorHub > Sources');
cy.visit('/k8s/cluster/config.openshift.io~v1~OperatorHub/cluster/sources');
Expand All @@ -38,8 +15,14 @@ export const createCatalogSource = (operatorName: string, catalogSourceName: str
cy.log('verify the CatalogSource is READY');
cy.visit('/k8s/cluster/config.openshift.io~v1~OperatorHub/cluster/sources');
cy.byLegacyTestID(catalogSourceName).should('exist');
cy.byTestID(`${catalogSourceName}-status`, { timeout: 90000 }).should('contain', 'READY');
verifyPackageManifest(operatorName, catalogSourceName);
cy.byTestID(`${catalogSourceName}-status`, { timeout: 90000 }).should('have.text', 'READY');
cy.visit(
`/k8s/ns/openshift-marketplace/operators.coreos.com~v1alpha1~CatalogSource/${catalogSourceName}/operators?packagemanifest-name=${operatorName}`,
);
cy.get('.co-clusterserviceversion-logo__name__clusterserviceversion', { timeout: 90000 }).should(
'have.text',
operatorName,
);
};

export const deleteCatalogSource = (catalogSourceName: string) => {
Expand Down
7 changes: 6 additions & 1 deletion frontend/public/actions/k8s.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,12 @@ export const watchK8sList = (

if (!_.get(k8skind, 'verbs', ['watch']).includes('watch')) {
// eslint-disable-next-line no-console
console.warn(`${referenceForModel(k8skind)} does not support watching`);
console.warn(
`${referenceForModel(k8skind)} does not support watching, falling back to polling.`,
);
if (!POLLs[id]) {
POLLs[id] = setTimeout(pollAndWatch, 15 * 1000);
}
return;
}

Expand Down

0 comments on commit 898472c

Please sign in to comment.