Skip to content

Commit

Permalink
Tidy up mocks and switch to multiplatform builds
Browse files Browse the repository at this point in the history
  • Loading branch information
tpmcgowan committed May 17, 2022
1 parent b3e9385 commit 0b8ec63
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 25 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ feature_branch: &feature_branch
version: 2.1

orbs:
hmpps: ministryofjustice/hmpps@3.14
hmpps: ministryofjustice/hmpps@5.1
slack: circleci/[email protected]

parameters:
Expand Down Expand Up @@ -105,7 +105,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:
Expand Down Expand Up @@ -157,7 +157,7 @@ workflows:
- build
- hmpps/helm_lint:
name: helm_lint
- hmpps/build_docker:
- hmpps/build_multiplatform_docker:
name: build_docker
- request_dev_approval:
<<: *feature_branch
Expand Down
6 changes: 2 additions & 4 deletions docker-compose-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions integration_tests/mockApis/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,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()]),
}
14 changes: 6 additions & 8 deletions integration_tests/mockApis/tokenVerification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand All @@ -26,6 +25,5 @@ export default {
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
jsonBody: { active: 'true' },
},
})
},
}),
}
10 changes: 2 additions & 8 deletions integration_tests/plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,8 @@ import { Visit } from '../../server/data/visitSchedulerApiTypes'
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,

stubGetPrisonerSocialContacts: (offenderNo: string) =>
prisonerContactRegistry.getPrisonerSocialContacts(offenderNo),
Expand Down

0 comments on commit 0b8ec63

Please sign in to comment.