Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Siegrift committed Oct 2, 2023
1 parent 517c63d commit f10b5ca
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 12 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,22 @@ jobs:
with:
node-version: '18.x'
cache: 'pnpm'
- name: Install Dependencies
- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build
run: pnpm run build
- name: Build Docker Images
- name: Build Docker images
run: pnpm run docker:build
- name: Start Services
- name: Start services
# Start the e2e services in the background and wait a small amount of time for them to start.
run: |
pnpm run start:data-provider-api &
pnpm run start:signed-api &
pnpm run start:pusher &
pnpm run --recursive --filter e2e start:data-provider-api &
pnpm run --recursive --filter e2e start:ci:signed-api &
pnpm run --recursive --filter e2e start:ci:pusher &
sleep 5
- name: Run E2E Tests
run: pnpm run test:e2e
- name: Run e2e tests
run: pnpm run --recursive --filter e2e test:e2e

required-checks-passed:
name: All required checks passed
Expand Down
5 changes: 3 additions & 2 deletions packages/e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
"prettier:check": "prettier --check \"./**/*.{js,ts,md,yml,json}\"",
"prettier:fix": "prettier --write \"./**/*.{js,ts,md,yml,json}\"",
"start:data-provider-api": "ts-node src/data-provider-api.ts",
"start:pusher": "docker run -it --init --volume $(pwd)/src/pusher:/app/config --env-file ./src/pusher/.env --rm --memory=256m pusher:latest",
"start:pusher": "docker run -it --init --volume $(pwd)/src/pusher:/app/config --network host --env-file ./src/pusher/.env --rm --memory=256m pusher:latest",
"start:signed-api": "docker run --publish 8090:8090 -it --init --volume $(pwd)/src/signed-api:/app/config --env-file ./src/signed-api/.env --rm --memory=256m api:latest",
"start:ci:pusher": "docker run --init --volume $(pwd)/src/pusher:/app/config --network host --env-file ./src/pusher/.env --rm --memory=256m pusher:latest",
"start:ci:signed-api": "docker run --publish 8090:8090 --init --volume $(pwd)/src/signed-api:/app/config --env-file ./src/signed-api/.env --rm --memory=256m api:latest",
"start:user": "ts-node src/user.ts",
"test": "jest --passWithNoTests",
"test:e2e": "jest",
"tsc": "tsc --project ."
},
Expand Down
4 changes: 4 additions & 0 deletions packages/pusher/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,10 @@ Pusher is also dockerized. To run the dockerized pusher you need to:
[this](https://github.com/nodejs/docker-node/blob/main/docs/BestPractices.md#handling-kernel-signals) for details.
3. Specify the `--env-file` with the path to the `.env` file containing the [ENV configuration](#environment-variables).
4. Optionally, pass the `--rm` flag to remove the container after it is stopped.
5. If running on Linux, you need to use the `--network host` to access the host network. This has no effect for Docker
Desktop.
6. Lastly, if you are using Docker Desktop and you want to access the host machine, you need to change the host URL from
`localhost` to `host.docker.internal` in the configuration files.

For example:

Expand Down
2 changes: 1 addition & 1 deletion packages/pusher/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"clean": "rm -rf coverage dist",
"dev": "nodemon --ext ts,js,json,env --exec \"pnpm ts-node src/index.ts\"",
"docker:build": "docker build --target pusher --tag pusher:latest ../../",
"docker:start": "docker run -it --init --volume $(pwd)/config:/app/config --env-file .env --rm pusher:latest",
"docker:start": "docker run -it --init --volume $(pwd)/config:/app/config --network host --env-file .env --rm pusher:latest",
"eslint:check": "eslint . --ext .js,.ts --max-warnings 0",
"eslint:fix": "eslint . --ext .js,.ts --fix",
"prettier:check": "prettier --check \"./**/*.{js,ts,md,yml,json}\"",
Expand Down
3 changes: 2 additions & 1 deletion packages/pusher/src/api-requests/signed-api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ describe(postSignedApiData.name, () => {

expect(response).toEqual({ success: false });
expect(logger.warn).toHaveBeenCalledWith('Failed to make update signed API request.', {
error: new Error('simulated-network-error'),
errorMessage: 'simulated-network-error',
axiosResponse: {},
signedApiName: 'localhost',
updateDelay: 5,
});
Expand Down

0 comments on commit f10b5ca

Please sign in to comment.