diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 34881393..d05856c4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 diff --git a/packages/e2e/package.json b/packages/e2e/package.json index d1c6d239..a2555b3f 100644 --- a/packages/e2e/package.json +++ b/packages/e2e/package.json @@ -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 ." }, diff --git a/packages/pusher/README.md b/packages/pusher/README.md index ae2bbc97..6305d1e0 100644 --- a/packages/pusher/README.md +++ b/packages/pusher/README.md @@ -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: diff --git a/packages/pusher/package.json b/packages/pusher/package.json index 57dabcba..83436585 100644 --- a/packages/pusher/package.json +++ b/packages/pusher/package.json @@ -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}\"", diff --git a/packages/pusher/src/api-requests/signed-api.test.ts b/packages/pusher/src/api-requests/signed-api.test.ts index 9668c5f0..492d1e01 100644 --- a/packages/pusher/src/api-requests/signed-api.test.ts +++ b/packages/pusher/src/api-requests/signed-api.test.ts @@ -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, });