generated from Ed-Fi-Exchange-OSS/Template-for-GitHub
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RND-511] Refactor configuration or containers for testing to have a …
…better handling and control (#228) * Fix error logged when there's an error creating resources * Update test containers * Adding method to build docker image * Moving API Configuration to coded setup * Creating code for mongo connection * Change port for default mongo connection * Removing action step related with mongo permissions * Adding open search configuration * Changing jest config to use default ts-jest setup * [RND-511] Refactor container usage to improve management * Using code based configuration for opensearch tests * Filename casing issue * Restoring ts-jest import * Fixing compilation issue on Mongo backend integration tests * Improving error message handling on setup for e2e * Adding debug option for e2e tests * Refactor to workaround issue with building Dockerfile * Updating documentation * Removing flag no longer used * Update script names --------- Co-authored-by: Stephen Fuqua <[email protected]>
- Loading branch information
1 parent
970145b
commit 92cd0fe
Showing
24 changed files
with
334 additions
and
300 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
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
37 changes: 37 additions & 0 deletions
37
Meadowlark-js/backends/meadowlark-opensearch-backend/test/setup/OpenSearchContainer.ts
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,37 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Licensed to the Ed-Fi Alliance under one or more agreements. | ||
// The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0. | ||
// See the LICENSE and NOTICES files in the project root for more information. | ||
|
||
import { GenericContainer, StartedTestContainer } from 'testcontainers'; | ||
|
||
let startedContainer: StartedTestContainer; | ||
|
||
export async function setup() { | ||
const openSearchPort = parseInt(process.env.OPENSEARCH_PORT ?? '8201', 10); | ||
startedContainer = await new GenericContainer( | ||
'opensearchproject/opensearch:2.5.0@sha256:f077efb452be64d3df56d74fe99fd63244704896edf6ead73a0f5decb95a40bf', | ||
) | ||
.withName('opensearch-test') | ||
.withExposedPorts({ | ||
container: openSearchPort, | ||
host: openSearchPort, | ||
}) | ||
.withEnvironment({ | ||
'discovery.type': 'single-node', | ||
DISABLE_INSTALL_DEMO_CONFIG: 'true', | ||
DISABLE_SECURITY_PLUGIN: 'true', | ||
'http.port': `${openSearchPort}`, | ||
}) | ||
.withStartupTimeout(120_000) | ||
.start(); | ||
|
||
process.env.OPENSEARCH_ENDPOINT = `http://localhost:${openSearchPort}`; | ||
process.env.OPENSEARCH_USERNAME = 'admin'; | ||
process.env.OPENSEARCH_PASSWORD = 'admin'; | ||
process.env.OPENSEARCH_REQUEST_TIMEOUT = '10000'; | ||
} | ||
|
||
export async function stop(): Promise<void> { | ||
await startedContainer.stop(); | ||
} |
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
13 changes: 0 additions & 13 deletions
13
Meadowlark-js/backends/meadowlark-opensearch-backend/test/setup/docker-compose.yml
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -34,7 +34,7 @@ | |
}, | ||
"workspaces": [ | ||
"packages/meadowlark-utilities", | ||
"packages/meadowlark-core", | ||
"packages/meadowlark-core", | ||
"packages/meadowlark-authz-server", | ||
"backends/*", | ||
"services/*", | ||
|
@@ -55,7 +55,10 @@ | |
"test:unit:coverage": "rimraf coverage.unit/ && npm run test:unit", | ||
"test:unit:coverage:ci": "rimraf coverage.unit/ && npm run test:unit -- --maxWorkers=2 --ci", | ||
"test:integration:coverage": "rimraf coverage.integration/ && npm run test:integration -- --collectCoverage", | ||
"test:e2e": "cross-env NODE_OPTIONS=--max-old-space-size=6144 LOG_LEVEL=warn jest --projects tests/config/e2e --runInBand", | ||
"test:e2e:jest": "cross-env NODE_OPTIONS=--max-old-space-size=6144 LOG_LEVEL=warn jest --projects tests/config/e2e --runInBand", | ||
"test:e2e:debug": "cross-env DEBUG=testcontainers* npm run test:e2e:jest", | ||
"test:e2e:build": "npm run docker:build && npm run test:e2e:jest", | ||
"test:e2e:build:wsl1": "npm run docker:build:wsl1 && npm run test:e2e:jest", | ||
"start:local": "lerna run start:local", | ||
"docker:lint": "cat ./Dockerfile | docker run --rm -i hadolint/hadolint", | ||
"docker:install": "npm i lerna@^6.0.2 rimraf@^3.0.2 copyfiles@^2.4.1 [email protected] -g && npm ci --only=production", | ||
|
Oops, something went wrong.