INNER CODE UNIT · TypeScript
getCrdIds
odigos-io/odigos · frontend/webapp/cypress/functions/index.ts:127
export const getCrdIds = ({ namespace, crdName, expectedError, expectedLength }: GetCrdIdsOptions, callback?: (crdIds: string[]) => void) => {
cy.exec(`kubectl get ${crdName} -n ${namespace} | awk 'NR>1 {print $1}'`).then(({ stderr, stdout }) => {
expect(stderr).to.eq(expectedError);
if (!!expectedError) {
expect(stdout).to.eq('');
} else {
expect(stdout).to.not.be.empty;
}
const crdIds = stdout.split('\n').filter((str) => !!str);
expect(crdIds.length).to.eq(expectedLength);
if (!!callback) callback(crdIds);
});
};
interface GetCrdByIdOptions {