Skip to content

Commit

Permalink
Fixes for CircleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
tpmcgowan committed Sep 22, 2023
1 parent 12aeab0 commit 8d1f153
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
10 changes: 8 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,18 @@ jobs:
- restore_cache:
key: dependency-cache-{{ checksum "package-lock.json" }}
- run:
name: Get wiremock # match version in docker-compose-test.yml
command: curl -o wiremock.jar https://repo1.maven.org/maven2/com/github/tomakehurst/wiremock-jre8-standalone/2.35.0/wiremock-jre8-standalone-2.35.0.jar
name: Get wiremock (latest version)
command: |
LATEST_WIREMOCK_VERSION=$(curl --silent https://repo1.maven.org/maven2/org/wiremock/wiremock-standalone/maven-metadata.xml | sed -n 's/[[:space:]]*<latest>\(.*\)<\/latest>/\1/p')
echo "Wiremock latest version is: $LATEST_WIREMOCK_VERSION"
curl -o wiremock.jar "https://repo1.maven.org/maven2/org/wiremock/wiremock-standalone/$LATEST_WIREMOCK_VERSION/wiremock-standalone-$LATEST_WIREMOCK_VERSION.jar"
- run:
name: Run wiremock
command: java -jar wiremock.jar --port 9091
background: true
- run:
name: Wait for wiremock to start
command: sleep 5
- run:
name: Run the node app.
command: npm run start-feature
Expand Down
10 changes: 5 additions & 5 deletions integration_tests/mockApis/govukOneLogin.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import fs from 'fs'
import path from 'path'
import jwt from 'jsonwebtoken'
import { Response } from 'superagent'
import { createPublicKey } from 'crypto'
import { getMatchingRequests, stubFor } from './wiremock'

const oidcConfigPath = path.join(__dirname, 'mappings/openid-configuration.json')
const oidcConfig = JSON.parse(fs.readFileSync(oidcConfigPath).toString())
const oidcConfig = JSON.parse(
fs.readFileSync('integration_tests/mockApis/mappings/openid-configuration.json').toString(),
)

const stubOidcDiscovery = () => stubFor(oidcConfig)

const stubJwks = () => {
const publicKey = fs.readFileSync(path.join(__dirname, '../testKeys/server_public_key.pem'))
const publicKey = fs.readFileSync('integration_tests/testKeys/server_public_key.pem')
const publicKeyJwk = createPublicKey({ key: publicKey }).export({ format: 'jwk' })

return stubFor({
Expand Down Expand Up @@ -80,7 +80,7 @@ const createIdToken = (nonce: string) => {
sid: 'SESSION_IDENTIFIER',
}

const privateKey = fs.readFileSync(path.join(__dirname, '../testKeys/server_private_key.pem'))
const privateKey = fs.readFileSync('integration_tests/testKeys/server_private_key.pem')
const idToken = jwt.sign(payload, privateKey, { algorithm: 'ES256' })
return idToken
}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"start": "node $NODE_OPTIONS dist/server.js | bunyan -o short",
"start:dev": "concurrently -k -p \"[{name}]\" -n \"Views,TypeScript,Node,Sass\" -c \"yellow.bold,cyan.bold,green.bold,blue.bold\" \"npm run watch-views\" \"npm run watch-ts\" \"npm run watch-node\" \"npm run watch-sass\"",
"oidc-wiremock": "curl --silent --output /dev/null -X POST --data \"@./integration_tests/mockApis/mappings/openid-configuration.json\" http://localhost:9091/__admin/mappings",
"start-feature": "npm run oidc-wiremock && export GOVUK_ONE_LOGIN_PRIVATE_KEY=\"$(<./integration_tests/testKeys/client_private_key.pem)\" && export $(cat feature.env) && node $NODE_DEBUG_OPTION dist/server.js | bunyan -o short",
"watch-node-feature": "npm run oidc-wiremock && export GOVUK_ONE_LOGIN_PRIVATE_KEY=\"$(<./integration_tests/testKeys/client_private_key.pem)\" && export $(cat feature.env) && nodemon --watch dist/ $NODE_DEBUG_OPTION dist/server.js | bunyan -o short",
"start-feature": "npm run oidc-wiremock && export GOVUK_ONE_LOGIN_PRIVATE_KEY=$(cat integration_tests/testKeys/client_private_key.pem) && export $(cat feature.env) && node $NODE_DEBUG_OPTION dist/server.js | bunyan -o short",
"watch-node-feature": "npm run oidc-wiremock && export GOVUK_ONE_LOGIN_PRIVATE_KEY=$(cat integration_tests/testKeys/client_private_key.pem) && export $(cat feature.env) && nodemon --watch dist/ $NODE_DEBUG_OPTION dist/server.js | bunyan -o short",
"start-feature:dev": "concurrently -k -p \"[{name}]\" -n \"Views,TypeScript,Node,Sass\" -c \"yellow.bold,cyan.bold,green.bold,blue.bold\" \"npm run watch-views\" \"npm run watch-ts\" \"npm run watch-node-feature\" \"npm run watch-sass\"",
"lint": "eslint . --cache --max-warnings 0",
"typecheck": "tsc && tsc -p integration_tests",
Expand Down

0 comments on commit 8d1f153

Please sign in to comment.