INNER CODE UNIT · TypeScript
attempt
odigos-io/odigos · frontend/webapp/cypress/functions/index.ts:77
const attempt = (remaining: number): Cypress.Chainable<string[]> => {
return cy.exec(`kubectl get ${crdName} -n ${namespace} | awk 'NR>1 {print $1}'`, { failOnNonZeroExit: false }).then(({ stdout }) => {
const crdIds = stdout.split('\n').filter((s) => !!s);
if (crdIds.length >= minCount) {
return cy.wrap(crdIds);
}
if (remaining <= 0) {
expect(crdIds.length).to.be.gte(minCount);
return cy.wrap(crdIds);
}
return cy.wait(intervalMs).then(() => attempt(remaining - 1));
});
};
return attempt(maxAttempts);
};
interface FindCrdOptions {
namespace: string;