Skip to content

Commit

Permalink
adjust tests, port, use docker image in test
Browse files Browse the repository at this point in the history
  • Loading branch information
Lms24 committed Nov 4, 2024
1 parent 149eefc commit 4b8f95f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/node-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ jobs:
run: yarn python-api:build
- name: Build Node API
working-directory: ./api-node
run: yarn build:ci
run: yarn docker:build
- name: Run E2E tests
working-directory: ./api-node
run: yarn test:e2e:ci
4 changes: 2 additions & 2 deletions api-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
"python-api:build": "docker build -t registry-api-server ../",
"python-api:start": "docker start $(docker ps -aq --filter ancestor=registry-api-server) && echo 'Flask API started successfully' || (docker run -d -p 5031:5030 registry-api-server && echo 'Flask API started successfully')",
"python-api:stop": "docker stop $(docker ps -q --filter ancestor=registry-api-server)",
"docker:build": "docker build -t registry-api-nestjs-server -f Dockerfile.nestjs .",
"docker:build": "docker build -t registry-api-nestjs-server -f ../Dockerfile.nestjs ../",
"docker:start": "docker run -p 5032:5030 registry-api-nestjs-server",
"docker:stop": "docker stop $(docker ps -q --filter ancestor=registry-api-nestjs-server)",
"docker:run": "docker run -p 5032:5030 registry-api-nestjs-server",
"start:all": "yarn build && yarn start:dev & yarn python-api:start",
"sentry:sourcemaps": "sentry-cli sourcemaps inject --org sentry --project release-registry-nestjs ./dist && sentry-cli sourcemaps upload --org sentry --project release-registry-nestjs ./dist"
},
Expand Down
3 changes: 2 additions & 1 deletion api-node/scripts/run-e2e-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import * as childProcess from 'child_process';

const nodeApi = childProcess.spawn('yarn', ['start:prod']);
const nodeApi = childProcess.spawn('yarn', ['docker:start']);

let nodeApiStarted = false;
let pythonApiStarted = false;
Expand Down Expand Up @@ -76,6 +76,7 @@ function cleanup(code: number): void {
nodeApi.kill();
pythonApi.kill();
childProcess.execSync('yarn python-api:stop');
childProcess.execSync('yarn docker:stop');
process.exit(code);
}

Expand Down
8 changes: 4 additions & 4 deletions api-node/test/utils/makeRequest.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const PYTHON_API_PORT = 5031;
const API_NODE_PORT = 3000;
const PYTHON_API_TEST_PORT = 5031;
const NODE_API_TEST_PORT = 5032;

export const PYTHON_API_URL = `http://localhost:${PYTHON_API_PORT}`;
export const API_NODE_URL = `http://localhost:${API_NODE_PORT}`;
export const PYTHON_API_URL = `http://localhost:${PYTHON_API_TEST_PORT}`;
export const API_NODE_URL = `http://localhost:${NODE_API_TEST_PORT}`;

interface ResponseParts {
status: number;
Expand Down

0 comments on commit 4b8f95f

Please sign in to comment.