From 73c1b627f6c41aff1721554cc52f2428f2a5b077 Mon Sep 17 00:00:00 2001 From: petergphillips Date: Fri, 13 May 2022 16:13:19 +0100 Subject: [PATCH] =?UTF-8?q?SDI-88:=20=E2=99=BB=EF=B8=8F=20=20Tidy=20up=20m?= =?UTF-8?q?ocks=20and=20switch=20to=20multiplatform=20builds=20(#89)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .circleci/config.yml | 6 +++--- docker-compose-test.yml | 6 ++---- integration_tests/mockApis/auth.ts | 4 ++-- integration_tests/mockApis/tokenVerification.ts | 14 ++++++-------- integration_tests/plugins/index.ts | 10 ++-------- 5 files changed, 15 insertions(+), 25 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2f2168e9..ebf75b17 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ version: 2.1 orbs: - hmpps: ministryofjustice/hmpps@3.14 + hmpps: ministryofjustice/hmpps@5.1 slack: circleci/slack@4.4.2 parameters: @@ -99,7 +99,7 @@ jobs: integration_test: executor: - name: hmpps/node_redis_cimg + name: hmpps/node_redis node_tag: << pipeline.parameters.node-version >> redis_tag: "6.2" steps: @@ -151,7 +151,7 @@ workflows: - build - hmpps/helm_lint: name: helm_lint - - hmpps/build_docker: + - hmpps/build_multiplatform_docker: name: build_docker filters: branches: diff --git a/docker-compose-test.yml b/docker-compose-test.yml index 16192a00..7a9c5dad 100644 --- a/docker-compose-test.yml +++ b/docker-compose-test.yml @@ -2,16 +2,14 @@ version: '3.1' services: redis: - image: 'bitnami/redis:5.0' + image: 'redis:6.2' networks: - hmpps_int - environment: - - ALLOW_EMPTY_PASSWORD=yes ports: - '6379:6379' wiremock: - image: rodolpheche/wiremock + image: wiremock/wiremock networks: - hmpps_int container_name: wiremock diff --git a/integration_tests/mockApis/auth.ts b/integration_tests/mockApis/auth.ts index dd8378db..169134df 100644 --- a/integration_tests/mockApis/auth.ts +++ b/integration_tests/mockApis/auth.ts @@ -153,8 +153,8 @@ const stubUserRoles = () => export default { getSignInUrl, - stubPing: (): Promise<[Response, Response]> => Promise.all([ping(), tokenVerification.stubPing()]), + stubAuthPing: ping, stubSignIn: (): Promise<[Response, Response, Response, Response, Response, Response]> => Promise.all([favicon(), redirect(), signOut(), manageDetails(), token(), tokenVerification.stubVerifyToken()]), - stubUser: (): Promise<[Response, Response]> => Promise.all([stubUser(), stubUserRoles()]), + stubAuthUser: (): Promise<[Response, Response]> => Promise.all([stubUser(), stubUserRoles()]), } diff --git a/integration_tests/mockApis/tokenVerification.ts b/integration_tests/mockApis/tokenVerification.ts index 192a17c1..1b23fcaa 100644 --- a/integration_tests/mockApis/tokenVerification.ts +++ b/integration_tests/mockApis/tokenVerification.ts @@ -2,8 +2,8 @@ import { SuperAgentRequest } from 'superagent' import { stubFor } from './wiremock' export default { - stubPing: (): SuperAgentRequest => { - return stubFor({ + stubTokenVerificationPing: (): SuperAgentRequest => + stubFor({ request: { method: 'GET', urlPattern: '/verification/health/ping', @@ -13,10 +13,9 @@ export default { headers: { 'Content-Type': 'application/json;charset=UTF-8' }, jsonBody: { status: 'UP' }, }, - }) - }, - stubVerifyToken: (): SuperAgentRequest => { - return stubFor({ + }), + stubVerifyToken: (): SuperAgentRequest => + stubFor({ request: { method: 'POST', urlPattern: '/verification/token/verify', @@ -26,6 +25,5 @@ export default { headers: { 'Content-Type': 'application/json;charset=UTF-8' }, jsonBody: { active: 'true' }, }, - }) - }, + }), } diff --git a/integration_tests/plugins/index.ts b/integration_tests/plugins/index.ts index 5145a1f1..f2035605 100644 --- a/integration_tests/plugins/index.ts +++ b/integration_tests/plugins/index.ts @@ -6,13 +6,7 @@ import tokenVerification from '../mockApis/tokenVerification' export default (on: (string, Record) => void): void => { on('task', { reset: resetStubs, - - getSignInUrl: auth.getSignInUrl, - stubSignIn: auth.stubSignIn, - - stubAuthUser: auth.stubUser, - stubAuthPing: auth.stubPing, - - stubTokenVerificationPing: tokenVerification.stubPing, + ...auth, + ...tokenVerification, }) }