-
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.
Merge branch 'main' into rob/68-determine-how-to-store-category-infor…
…mation-for-conditions
- Loading branch information
Showing
12 changed files
with
191 additions
and
30 deletions.
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
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,50 @@ | ||
services: | ||
# PostgreSQL DB for custom query and value set storage | ||
db: | ||
image: "postgres:alpine" | ||
ports: | ||
- "5432:5432" | ||
environment: | ||
- POSTGRES_USER=postgres | ||
- POSTGRES_PASSWORD=pw | ||
- POSTGRES_DB=tefca_db | ||
healthcheck: | ||
test: ["CMD-SHELL", "pg_isready -U postgres"] | ||
interval: 2s | ||
timeout: 5s | ||
retries: 20 | ||
|
||
# Next.js app with Flyway | ||
tefca-viewer: | ||
platform: linux/amd64 | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
tty: true | ||
ports: | ||
- "3000:3000" | ||
environment: | ||
- NODE_ENV=production | ||
- DATABASE_URL=postgres://postgres:pw@db:5432/tefca_db | ||
- NEXT_PUBLIC_HAPI_FHIR_URL=http://hapi-fhir-server:8080 | ||
# Note: you must have a local .env file with the ERSD_API_KEY set to a key | ||
# obtained from the ERSD API at https://ersd.aimsplatform.org/#/api-keys | ||
depends_on: | ||
db: | ||
condition: service_healthy | ||
# HAPI FHIR Server for running e2e tests | ||
hapi-fhir-server: | ||
image: "hapiproject/hapi:latest" | ||
ports: | ||
- "8080:8080" | ||
# Loads synthetic data into hapi-fhir-server for e2e tests | ||
data-loader: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile.dev | ||
volumes: | ||
- "./src/app/tests/assets/GoldenSickPatient.json:/etc/GoldenSickPatient.json" | ||
- "./post_e2e_data_hapi.sh:/post_e2e_data_hapi.sh" | ||
command: ["sh", "post_e2e_data_hapi.sh"] | ||
depends_on: | ||
- hapi-fhir-server |
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
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
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 |
---|---|---|
@@ -1,45 +1,32 @@ | ||
/** | ||
* | ||
*/ | ||
|
||
export const TEST_URL = | ||
process.env.TEST_ENV ?? "http://localhost:3000/tefca-viewer"; | ||
|
||
/** | ||
* | ||
*/ | ||
async function globalSetup() { | ||
const maxRetries = 300; // Maximum number of retries | ||
const delay = 1000; // Delay between retries in milliseconds | ||
const delay = 5000; // Delay between retries in milliseconds | ||
|
||
// Check TEST_URL | ||
for (let attempts = 0; attempts < maxRetries; attempts++) { | ||
try { | ||
const response = await fetch(TEST_URL); // Fetch the TEST_URL | ||
const response = await fetch(TEST_URL); | ||
if (response.status === 200) { | ||
console.log(`Connected to ${TEST_URL} successfully.`); | ||
return; // Exit the function if the webpage loads successfully | ||
break; // Proceed to the FHIR server check | ||
} else { | ||
console.log( | ||
`Failed to connect to ${TEST_URL}, status: ${response.status}. Retrying...`, | ||
`Failed to connect to ${TEST_URL}, status: ${response.status}. Error: ${response.text} Retrying...`, | ||
); | ||
// Wait before the next attempt | ||
await new Promise((resolve) => setTimeout(resolve, delay)); | ||
} | ||
} catch (error) { | ||
console.log( | ||
`Fetch failed for ${TEST_URL}: ${ | ||
(error as Error).message | ||
}. Retrying...`, | ||
`Fetch failed for ${TEST_URL}: ${(error as Error).message}. Retrying...`, | ||
); | ||
await new Promise((resolve) => setTimeout(resolve, delay)); | ||
} | ||
// Wait before the next attempt | ||
await new Promise((resolve) => setTimeout(resolve, delay)); | ||
} | ||
|
||
throw new Error( | ||
`Unable to connect to ${TEST_URL} after ${maxRetries} attempts.`, | ||
); | ||
} | ||
|
||
export default globalSetup; |
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
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