Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDI-88: ♻️ Tidy up mocks and switch to multiplatform builds #89

Merged
merged 2 commits into from
May 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -99,7 +99,7 @@ jobs:

integration_test:
executor:
name: hmpps/node_redis_cimg
name: hmpps/node_redis
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from 4.0 the base executor was changed instead

node_tag: << pipeline.parameters.node-version >>
redis_tag: "6.2"
steps:
Expand Down Expand Up @@ -151,7 +151,7 @@ workflows:
- build
- hmpps/helm_lint:
name: helm_lint
- hmpps/build_docker:
- hmpps/build_multiplatform_docker:
name: build_docker
filters:
branches:
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'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

switch to images that are suitable for arm64

networks:
- hmpps_int
environment:
- ALLOW_EMPTY_PASSWORD=yes
ports:
- '6379:6379'

wiremock:
image: rodolpheche/wiremock
image: wiremock/wiremock
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the new home for wiremock and provides an arm64 image too

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 @@ -153,8 +153,8 @@ const stubUserRoles = () =>

export default {
getSignInUrl,
stubPing: (): Promise<[Response, Response]> => Promise.all([ping(), tokenVerification.stubPing()]),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was a bit odd since the health check was calling both auth and token verification anyway

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 @@ -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,
})
}