Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: added system status check to anvil-cmg tests (#4108) #4115

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/run-playwright-tests-anvil-cmg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ jobs:
run: |
cd explorer
npm ci
- name: Check Backend System Status - TEST RESULTS ARE NOT VALID IF THIS FAILS
run: |
cd explorer
npm run check-system-status:anvil-cmg
- name: Install Playwright Browsers
run: |
cd explorer
Expand All @@ -25,6 +29,10 @@ jobs:
run: |
cd explorer
npm run test:anvil-cmg
- name: Check backend status again - TEST RESULTS ARE NOT VALID IF THIS FAILS
run: |
cd explorer
npm run check-system-status:anvil-cmg
- uses: actions/upload-artifact@v3
if: always()
with:
Expand Down
12 changes: 12 additions & 0 deletions explorer/e2e/anvil/anvil-check-system-status.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { checkIsIndexing } from "../checkIsIndexing";
const ANVIL_CMG_SYSTEM_STATUS_URL =
"https://service.anvil.gi.ucsc.edu/health/progress";

/**
* Check system status for Anvil-CMG
*/
async function anvilCheckIsIndexing(): Promise<void> {
await checkIsIndexing(ANVIL_CMG_SYSTEM_STATUS_URL);
}

anvilCheckIsIndexing();
32 changes: 32 additions & 0 deletions explorer/e2e/checkIsIndexing.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* Check the system status, including whether the backend is currently indexing
* @param systemStatusUrl - a url to the system status api
*/
export async function checkIsIndexing(systemStatusUrl: string): Promise<void> {
const systemStatusResponse = await fetch(systemStatusUrl);
if (systemStatusResponse.status != 200) {
console.log(
"ERROR: The System Status API is currently unavailable, or an incorrect url was passed. Please rerun tests when this is resolved."
);
process.exit(1);
}
const systemStatusJson = await systemStatusResponse.json();
const isUp = systemStatusJson.up && systemStatusJson.progress.up;
const isIndexing =
systemStatusJson.progress.unindexed_bundles > 0 ||
systemStatusJson.progress.unindexed_documents > 0;
if (!isUp) {
console.log(
"There is an issue with the backend server. Please rerun tests once this issue has been resolved. If tests have already been run, please ignore the results and try again later."
);
process.exit(1);
} else if (isIndexing) {
console.log(
"ERROR: The database is currently indexing, which means that tests cannot run reliably. Please rerun tests later once indexing has stopped. If tests have already been run, please ignore the results and try again after indexing has stopped."
);
process.exit(1);
} else {
console.log("The System Status is currently good!");
process.exit(0);
}
}
3 changes: 2 additions & 1 deletion explorer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
"test:e2e": "playwright test",
"get-cellxgene-projects-hca": "esrun ./site-config/hca-dcp/dev/scripts/get-cellxgene-projects.ts ",
"test:anvil-cmg": "playwright test -c playwright_anvil.config.ts --trace retain-on-failure",
"test:anvil-catalog": "playwright test -c playwright_anvil-catalog.config.ts --trace retain-on-failure"
"test:anvil-catalog": "playwright test -c playwright_anvil-catalog.config.ts --trace retain-on-failure",
"check-system-status:anvil-cmg": "esrun e2e/anvil/anvil-check-system-status.ts"
},
"dependencies": {
"@databiosphere/findable-ui": "9.1.0",
Expand Down
Loading