-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added e2e tests * Moved E2E/Integration tests into src/tests subfolders * CI attempt e2e
- Loading branch information
Showing
29 changed files
with
310 additions
and
51 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,4 @@ dist/ | |
|
||
deployment/dev | ||
.vscode/ | ||
src/tests/e2e |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module.exports = { | ||
projects: [ | ||
{ | ||
displayName: 'End-to-End Tests', | ||
roots: ['<rootDir>/src/tests/e2e'], | ||
testTimeout: 30000, | ||
testEnvironment: '<rootDir>/src/tests/e2e/jest-e2e-environment.js', | ||
runner: '<rootDir>/src/tests/e2e/jest-e2e-runner.js', | ||
testMatch: ['**/__tests__/**/*.+(ts|tsx|js)', '**/?(*.)+(spec|test).+(ts|tsx|js)'], | ||
transform: { | ||
'^.+\\.(ts|tsx)$': 'ts-jest', | ||
}, | ||
}, | ||
], | ||
}; |
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,3 @@ | ||
module.exports = { | ||
projects: [...require('./jest.config').projects, ...require('./jest.config.e2e').projects], | ||
}; |
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
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
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,10 @@ | ||
AWS_ACCESS_KEY_ID=e2e_key_id | ||
AWS_SECRET_ACCESS_KEY=e2e_secret_key | ||
|
||
RESOURCE_UPDATE_INTERVAL=500 | ||
S3_RESOURCE_BUCKET_NAME=stitch-resources | ||
S3_RESOURCE_OBJECT_KEY=resources.json | ||
S3_ENDPOINT=http://minio:9000 | ||
|
||
USE_S3_RESOURCE_REPOSITORY=true | ||
USE_FS_RESOURCE_REPOSITORY=false |
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,48 @@ | ||
version: '3.7' | ||
|
||
services: | ||
gateway: | ||
build: | ||
context: ../../.. | ||
dockerfile: deployment/docker/Dockerfile | ||
args: | ||
RUN_TESTS: 'false' | ||
depends_on: | ||
- minio | ||
ports: | ||
- '8080:80' | ||
command: gateway | ||
env_file: .env | ||
environment: | ||
PORT: 80 | ||
|
||
registry: | ||
build: | ||
context: ../../.. | ||
dockerfile: deployment/docker/Dockerfile | ||
args: | ||
RUN_TESTS: 'false' | ||
depends_on: | ||
- minio | ||
ports: | ||
- '8090:80' | ||
command: registry | ||
env_file: .env | ||
environment: | ||
PORT: 80 | ||
|
||
minio: | ||
image: minio/minio | ||
ports: | ||
- 9000:9000 | ||
entrypoint: sh | ||
environment: | ||
MINIO_ACCESS_KEY: ${AWS_ACCESS_KEY_ID} | ||
MINIO_SECRET_KEY: ${AWS_SECRET_ACCESS_KEY} | ||
command: > | ||
-c " | ||
mkdir -p /var/minio/${S3_RESOURCE_BUCKET_NAME} && | ||
echo '{\"schemas\":[],\"upstreams\": [],\"upstreamClientCredentials\": []}' > /var/minio/${S3_RESOURCE_BUCKET_NAME}/${S3_RESOURCE_OBJECT_KEY} && | ||
minio server /var/minio | ||
" | ||
env_file: .env |
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,16 @@ | ||
const NodeEnvironment = require('jest-environment-node'); | ||
const dockerCompose = require('docker-compose'); | ||
const waitFor = require('./waitFor'); | ||
|
||
const sleep = timeout => new Promise(r => setTimeout(r, timeout)); | ||
|
||
class DockerComposeEnvironment extends NodeEnvironment { | ||
async setup() { | ||
await super.setup(); | ||
await dockerCompose.restartAll({cwd: __dirname, log: true}); | ||
await sleep(1000); // letting it go down before polling | ||
await Promise.all([waitFor.gatewayStart(10000), waitFor.registryStart(10000)]); | ||
} | ||
} | ||
|
||
module.exports = DockerComposeEnvironment; |
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 @@ | ||
const DefaultJestRunner = require('jest-runner'); | ||
const dockerCompose = require('docker-compose'); | ||
const waitFor = require('./waitFor'); | ||
|
||
class SerialJestRunner extends DefaultJestRunner { | ||
constructor(config, context) { | ||
super(config, context); | ||
this.isSerial = true; | ||
} | ||
|
||
async setup() { | ||
await dockerCompose.buildAll({cwd: __dirname, log: true}); | ||
await dockerCompose.upAll({cwd: __dirname, log: true}); | ||
await Promise.all([waitFor.gatewayStart(20000), waitFor.registryStart(20000)]); | ||
} | ||
|
||
async teardown() { | ||
await dockerCompose.down({cwd: __dirname, log: true}); | ||
await Promise.all([waitFor.gatewayStop(10000), waitFor.registryStop(10000)]); | ||
} | ||
|
||
async runTests(tests, watcher, onStart, onResult, onFailure, options) { | ||
try { | ||
await this.setup(); | ||
await super.runTests(tests, watcher, onStart, onResult, onFailure, options); | ||
} finally { | ||
await this.teardown(); | ||
} | ||
} | ||
} | ||
|
||
module.exports = SerialJestRunner; |
Oops, something went wrong.