-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* chore: added system status check to anvil-cmg tests (#4108) * chore: added second system status check after tests run to ensure reliability (#4108) * chore: check that indexing checks fail appropriately (#4108) * chore: undo test failure check (#4108)
- Loading branch information
Showing
4 changed files
with
54 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters