From 3d489601f4bea71b1fbe9e5bb94a397d88c33564 Mon Sep 17 00:00:00 2001 From: Guy Harwood Date: Mon, 5 Dec 2022 10:45:49 +0000 Subject: [PATCH] bump runtime to node 16 LTS (#2324) * bump runtime to node 16 LTS * update circle CI base image * update node runtime and required engine * update spa node image * update docs * update docs for release pipeline vars * update documentation for running test suite * Upgrade functions to v4 in host.json * Revert "Upgrade functions to v4 in host.json" This reverts commit b60ac4d4ace9d8bdcf67e973fbe52809f4c2ce3f. * Update assets version * Downgrade functions to v14 * Update circleci dockerfile with additional v14 node version minor bump to v14.21.1 * move functions to node 16 with the v2 bindings extension preserved for table storage compatability. add a util to sync or create the local.settings.json file Co-authored-by: Jon Shipley Co-authored-by: Jon Shipley --- .disabled.travis.yml | 2 +- .nvmrc | 2 +- README.md | 2 +- admin/.nvmrc | 2 +- admin/Dockerfile | 2 +- admin/dev.Dockerfile | 2 +- admin/package.json | 2 +- db/.nvmrc | 2 +- db/dev.Dockerfile | 2 +- db/package.json | 2 +- deploy/build-agent/Dockerfile | 4 +- deploy/build-agent/readme.md | 2 +- deploy/docker/circleci-node-multi/Dockerfile | 9 ++- deploy/docker/circleci-node-multi/README.md | 3 + deploy/docker/functions-base/Dockerfile | 2 +- deploy/service-bus/.nvmrc | 2 +- deploy/service-bus/package.json | 2 +- deploy/sql/.nvmrc | 2 +- deploy/sql/package.json | 2 +- .../spikes-poc/spike-durable-functions/.nvmrc | 1 - docs/node-runtime-upgrade.md | 32 ++++++++++ func-consumption/.nvmrc | 2 +- func-consumption/package.json | 9 ++- func-consumption/readme.md | 2 + func-consumption/sync-local-settings.js | 12 ++++ func-ps-report/.nvmrc | 2 +- func-ps-report/package.json | 8 ++- func-ps-report/readme.md | 2 + func-ps-report/sync-local-settings.js | 12 ++++ func-throttled/.nvmrc | 2 +- func-throttled/package.json | 8 ++- func-throttled/readme.md | 2 + func-throttled/sync-local-settings.js | 12 ++++ load-test/.nvmrc | 2 +- load-test/package.json | 2 +- pupil-api/.nvmrc | 2 +- pupil-api/Dockerfile | 2 +- pupil-api/dev.Dockerfile | 2 +- pupil-api/package.json | 2 +- pupil-spa/.nvmrc | 2 +- pupil-spa/Dockerfile | 2 +- pupil-spa/dev.Dockerfile | 2 +- pupil-spa/package.json | 2 +- test/admin-hpa/README.md | 60 +++++++++++-------- tslib/.nvmrc | 2 +- 45 files changed, 169 insertions(+), 67 deletions(-) delete mode 100644 design/spikes-poc/spike-durable-functions/.nvmrc create mode 100644 docs/node-runtime-upgrade.md create mode 100644 func-consumption/sync-local-settings.js create mode 100644 func-ps-report/sync-local-settings.js create mode 100644 func-throttled/sync-local-settings.js diff --git a/.disabled.travis.yml b/.disabled.travis.yml index d058a05465..edce482a5b 100644 --- a/.disabled.travis.yml +++ b/.disabled.travis.yml @@ -4,7 +4,7 @@ language: node_js services: - docker node_js: -- 14.18.1 +- 16.17.1 env: jobs: - IMAGE=admin diff --git a/.nvmrc b/.nvmrc index e24183e587..e0325e5adb 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -v14.18.1 +v16.17.1 diff --git a/README.md b/README.md index c9b9248719..1263183af0 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ ## Project tooling requirements - Docker (current LTS) -- Node JS (best installed via nvm) +- Node JS (best installed via [nvm](https://github.com/nvm-sh/nvm)) - Text Editor - bash - Azure storage explorer diff --git a/admin/.nvmrc b/admin/.nvmrc index e24183e587..e0325e5adb 100644 --- a/admin/.nvmrc +++ b/admin/.nvmrc @@ -1 +1 @@ -v14.18.1 +v16.17.1 diff --git a/admin/Dockerfile b/admin/Dockerfile index 0cc2e47867..ca1877823b 100644 --- a/admin/Dockerfile +++ b/admin/Dockerfile @@ -1,4 +1,4 @@ -FROM node:14.18.1 +FROM node:16.17.1 RUN mkdir -p /usr/src/app WORKDIR /usr/src/app diff --git a/admin/dev.Dockerfile b/admin/dev.Dockerfile index bd1d34de80..d68c559492 100644 --- a/admin/dev.Dockerfile +++ b/admin/dev.Dockerfile @@ -1,4 +1,4 @@ -FROM node:14.18.1 +FROM node:16.17.1 EXPOSE 3001 2222 RUN mkdir -p /mtc/admin WORKDIR /mtc/admin diff --git a/admin/package.json b/admin/package.json index efc950e40d..a599b056d3 100644 --- a/admin/package.json +++ b/admin/package.json @@ -33,7 +33,7 @@ "assets-version": "e3cf7309a51a6a6af117a4d5f04dedec" }, "engines": { - "node": ">= 14" + "node": ">= 16" }, "resolutions": { "**/**/lodash": "^4.17.21", diff --git a/db/.nvmrc b/db/.nvmrc index e24183e587..e0325e5adb 100644 --- a/db/.nvmrc +++ b/db/.nvmrc @@ -1 +1 @@ -v14.18.1 +v16.17.1 diff --git a/db/dev.Dockerfile b/db/dev.Dockerfile index 4c6548b207..0754e737cc 100644 --- a/db/dev.Dockerfile +++ b/db/dev.Dockerfile @@ -1,4 +1,4 @@ -FROM node:14.18.1 +FROM node:16.17.1 RUN mkdir -p /usr/src/app WORKDIR /user/src/app diff --git a/db/package.json b/db/package.json index 9ed528f1f0..90153a76b1 100644 --- a/db/package.json +++ b/db/package.json @@ -8,7 +8,7 @@ "license": "GPL-3.0", "private": false, "engines": { - "node": ">= 14" + "node": ">= 16" }, "scripts": { "new": "node ./engine/create-migration.js", diff --git a/deploy/build-agent/Dockerfile b/deploy/build-agent/Dockerfile index 9358454b97..b92f394b49 100644 --- a/deploy/build-agent/Dockerfile +++ b/deploy/build-agent/Dockerfile @@ -91,8 +91,8 @@ RUN echo "export GEM_PATH=$GEM_HOME:/usr/local/lib/ruby/gems/2.6.0" >> ~/.profil # install nvm and current node runtimes ENV NVM_DIR=/home/$BUILD_USER/.nvm -ENV CURRENT_NODE_VERSION=14.18.1 -ENV PREVIOUS_NODE_VERSION=12.18.2 +ENV CURRENT_NODE_VERSION=16.17.1 +ENV PREVIOUS_NODE_VERSION=14.18.1 RUN curl -sL https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash \ && . $NVM_DIR/nvm.sh \ diff --git a/deploy/build-agent/readme.md b/deploy/build-agent/readme.md index eb3962cc4c..f452552e86 100644 --- a/deploy/build-agent/readme.md +++ b/deploy/build-agent/readme.md @@ -13,7 +13,7 @@ 4. delete existing build server container instances in azure 5. run `./create-instance.sh` to create new build servers 6. once new agents are up and running, assign a 'user defined capability' to each one via the build agent management screen in VSO. -7. Add name as mtc-instance and number them consecutively, starting at 1. This allows us to source and whitelist the IP address of each. +7. Add name as `mtc-instance` and number them consecutively, starting at 1. This allows us to source and whitelist the IP address of each. example execution of `create-instance.sh`... diff --git a/deploy/docker/circleci-node-multi/Dockerfile b/deploy/docker/circleci-node-multi/Dockerfile index 2af8928533..6184957656 100644 --- a/deploy/docker/circleci-node-multi/Dockerfile +++ b/deploy/docker/circleci-node-multi/Dockerfile @@ -1,8 +1,7 @@ # This is a custom dockerfile to allow us to run multiple versions of node # +nvm -FROM circleci/node:10-browsers -RUN curl -s -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash -RUN /bin/bash -c "export NVM_DIR=\${HOME}/.nvm && source \${NVM_DIR}/nvm.sh && nvm install v10.14.1" -RUN /bin/bash -c "export NVM_DIR=\${HOME}/.nvm && source \${NVM_DIR}/nvm.sh && nvm install v10.17.0" -RUN /bin/bash -c "export NVM_DIR=\${HOME}/.nvm && source \${NVM_DIR}/nvm.sh && nvm install v12.18.2" +FROM circleci/node:14-browsers +RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash RUN /bin/bash -c "export NVM_DIR=\${HOME}/.nvm && source \${NVM_DIR}/nvm.sh && nvm install v14.18.1" +RUN /bin/bash -c "export NVM_DIR=\${HOME}/.nvm && source \${NVM_DIR}/nvm.sh && nvm install v14.21.1" +RUN /bin/bash -c "export NVM_DIR=\${HOME}/.nvm && source \${NVM_DIR}/nvm.sh && nvm install v16.17.1" diff --git a/deploy/docker/circleci-node-multi/README.md b/deploy/docker/circleci-node-multi/README.md index 3a704e45df..6e1b7c8764 100644 --- a/deploy/docker/circleci-node-multi/README.md +++ b/deploy/docker/circleci-node-multi/README.md @@ -9,6 +9,9 @@ for multiple node versions. This docker image needs to be made publicly available so we can pull it in when launching our circleci jobs.Availability +## Modifying +Change the base image reference to the lowest version of node the solution needs to support. Change the nvm install list to cover all versions of node in use. + ### Publishing 1. Build it diff --git a/deploy/docker/functions-base/Dockerfile b/deploy/docker/functions-base/Dockerfile index e97215c148..df1a8cad21 100644 --- a/deploy/docker/functions-base/Dockerfile +++ b/deploy/docker/functions-base/Dockerfile @@ -1,4 +1,4 @@ -FROM node:14.18.1 +FROM node:16.17.1 # SHELL ["/bin/bash", "-c"] diff --git a/deploy/service-bus/.nvmrc b/deploy/service-bus/.nvmrc index e24183e587..e0325e5adb 100644 --- a/deploy/service-bus/.nvmrc +++ b/deploy/service-bus/.nvmrc @@ -1 +1 @@ -v14.18.1 +v16.17.1 diff --git a/deploy/service-bus/package.json b/deploy/service-bus/package.json index 00c7fbb6be..d8001db5a4 100644 --- a/deploy/service-bus/package.json +++ b/deploy/service-bus/package.json @@ -9,7 +9,7 @@ "deleteqs": "node ./delete.js" }, "engines": { - "node": ">= 14" + "node": ">= 16" }, "repository": "git@github.com:DFEAGILEDEVOPS/MTC.git", "author": "Guy Harwood", diff --git a/deploy/sql/.nvmrc b/deploy/sql/.nvmrc index e24183e587..e0325e5adb 100644 --- a/deploy/sql/.nvmrc +++ b/deploy/sql/.nvmrc @@ -1 +1 @@ -v14.18.1 +v16.17.1 diff --git a/deploy/sql/package.json b/deploy/sql/package.json index 333ca2b38d..29cb2c7fe0 100644 --- a/deploy/sql/package.json +++ b/deploy/sql/package.json @@ -10,7 +10,7 @@ "dummy:all": "node ./dummy-data/all.js" }, "engines": { - "node": ">= 14" + "node": ">= 16" }, "dependencies": { "axios": "^0.21.2", diff --git a/design/spikes-poc/spike-durable-functions/.nvmrc b/design/spikes-poc/spike-durable-functions/.nvmrc deleted file mode 100644 index e24183e587..0000000000 --- a/design/spikes-poc/spike-durable-functions/.nvmrc +++ /dev/null @@ -1 +0,0 @@ -v14.18.1 diff --git a/docs/node-runtime-upgrade.md b/docs/node-runtime-upgrade.md new file mode 100644 index 0000000000..990938b50b --- /dev/null +++ b/docs/node-runtime-upgrade.md @@ -0,0 +1,32 @@ +# Upgrading the Node Runtime + +This solution is heavily dependent on the Node JS runtime. +We typically upgrade to the most sensible LTS once or twice a year to stay aligned with security patching and general maintenance. + +## Files to update + +In order to upgrade the node runtime across the solution, you must update multiple files. +The easiest way to do this is use your editor to search for the current version string across all files in the solution. + +## Update the build-agent Dockerfile + +We install the current and last node versions on the build agent to ensure it can handle transitions to new versions across builds without interruption. There are 2 variables to update in this file... +- `PREVIOUS_NODE_VERSION` +- `CURRENT_NODE_VERSION` + +## Update the circle-CI Dockerfile + +The Circle CI base image for pull request testing must be updated to include the least supported version of node, plus current. Details and instructions [here](!./../../deploy/docker/circleci-node-multi/README.md) + +## Upgrade the Azure functions + +### Ensure function apps runtime is compatible with Node JS runtime + +https://learn.microsoft.com/en-us/azure/azure-functions/functions-versions?tabs=azure-cli%2Cwindows%2Cin-process%2Cv4&pivots=programming-language-javascript#changing-version-of-apps-in-azure + +### Update the release pipeline variables to the new Node JS version and function runtime + +within the VSO release library for each environment there are variables that cover the function runtime and node version respectively... + +`Functions.Runtime.Version` +`Functions.Node.Version` diff --git a/func-consumption/.nvmrc b/func-consumption/.nvmrc index e24183e587..e0325e5adb 100644 --- a/func-consumption/.nvmrc +++ b/func-consumption/.nvmrc @@ -1 +1 @@ -v14.18.1 +v16.17.1 diff --git a/func-consumption/package.json b/func-consumption/package.json index f41c36b9d9..ce07d35173 100644 --- a/func-consumption/package.json +++ b/func-consumption/package.json @@ -11,6 +11,7 @@ "prod:clean": "rm -rf ./node_modules && yarn install --frozen-lockfile --production", "rebuild": "yarn clean && yarn build", "sync": "node ./sync-tslib-deps.js && yarn install", + "sync:settings": "node ./sync-local-settings.js", "delete-specs": "find . -name \"*.spec.js\" -type f -delete", "clean": "rm -rf ./dist", "start:host": "func start", @@ -64,5 +65,11 @@ "random-number-csprng": "^1.0.2", "ua-parser-js": "^0.8.1", "uuid": "^8.3.1" + }, + "function-settings": { + "FUNCTIONS_WORKER_RUNTIME": "node", + "FUNCTIONS_EXTENSION_VERSION": "~4", + "WEBSITE_NODE_DEFAULT_VERSION": "~16", + "AzureWebJobs.check-notifier.Disabled": "true" } -} \ No newline at end of file +} diff --git a/func-consumption/readme.md b/func-consumption/readme.md index 3b22fc3090..ee996f4ff5 100644 --- a/func-consumption/readme.md +++ b/func-consumption/readme.md @@ -24,6 +24,8 @@ a local.settings.json file is required in the root of the project, with a minimu "IsEncrypted": false, "Values": { "FUNCTIONS_WORKER_RUNTIME": "node", + "FUNCTIONS_EXTENSION_VERSION": "~4", + "WEBSITE_NODE_DEFAULT_VERSION": "~16", "AzureWebJobsStorage": "{AzureWebJobsStorage}", "AZURE_STORAGE_CONNECTION_STRING": "#your storage account connection#", "AZURE_SERVICE_BUS_CONNECTION_STRING": "#your service bus connection#", diff --git a/func-consumption/sync-local-settings.js b/func-consumption/sync-local-settings.js new file mode 100644 index 0000000000..6e4e96ab91 --- /dev/null +++ b/func-consumption/sync-local-settings.js @@ -0,0 +1,12 @@ +'use strict' + +const jedit = require('edit-json-file') + +// if the destination file does not exist it will be created +const dest = jedit('./local.settings.json') +const src = jedit('./package.json') +const defaultValues = src.get('function-settings') +dest.set('Values', defaultValues, { + merge: true +}) +dest.save() diff --git a/func-ps-report/.nvmrc b/func-ps-report/.nvmrc index e24183e587..e0325e5adb 100644 --- a/func-ps-report/.nvmrc +++ b/func-ps-report/.nvmrc @@ -1 +1 @@ -v14.18.1 +v16.17.1 diff --git a/func-ps-report/package.json b/func-ps-report/package.json index e5f112c5c8..0cf3581b8d 100644 --- a/func-ps-report/package.json +++ b/func-ps-report/package.json @@ -11,6 +11,7 @@ "prod:clean": "rm -rf ./node_modules && yarn install --frozen-lockfile --production", "rebuild": "yarn clean && yarn build", "sync": "node ./sync-tslib-deps.js && yarn install", + "sync:settings": "node ./sync-local-settings.js", "delete-specs": "find . -name \"*.spec.js\" -type f -delete", "clean": "rm -rf ./dist", "start:host": "func host start --port 7074", @@ -54,5 +55,10 @@ "random-number-csprng": "^1.0.2", "ua-parser-js": "^0.8.1", "uuid": "^8.3.1" + }, + "function-settings": { + "FUNCTIONS_WORKER_RUNTIME": "node", + "FUNCTIONS_EXTENSION_VERSION": "~4", + "WEBSITE_NODE_DEFAULT_VERSION": "~16" } -} \ No newline at end of file +} diff --git a/func-ps-report/readme.md b/func-ps-report/readme.md index 59b50a16e1..0eea2dc395 100644 --- a/func-ps-report/readme.md +++ b/func-ps-report/readme.md @@ -25,6 +25,8 @@ a local.settings.json file is required in the root of the project, with a minimu "IsEncrypted": false, "Values": { "FUNCTIONS_WORKER_RUNTIME": "node", + "FUNCTIONS_EXTENSION_VERSION": "~4", + "WEBSITE_NODE_DEFAULT_VERSION": "~16", "AzureWebJobsStorage": "{AzureWebJobsStorage}", "AZURE_STORAGE_CONNECTION_STRING": "#your storage account connection#", "AZURE_SERVICE_BUS_CONNECTION_STRING": "#your service bus connection#" diff --git a/func-ps-report/sync-local-settings.js b/func-ps-report/sync-local-settings.js new file mode 100644 index 0000000000..6e4e96ab91 --- /dev/null +++ b/func-ps-report/sync-local-settings.js @@ -0,0 +1,12 @@ +'use strict' + +const jedit = require('edit-json-file') + +// if the destination file does not exist it will be created +const dest = jedit('./local.settings.json') +const src = jedit('./package.json') +const defaultValues = src.get('function-settings') +dest.set('Values', defaultValues, { + merge: true +}) +dest.save() diff --git a/func-throttled/.nvmrc b/func-throttled/.nvmrc index e24183e587..e0325e5adb 100644 --- a/func-throttled/.nvmrc +++ b/func-throttled/.nvmrc @@ -1 +1 @@ -v14.18.1 +v16.17.1 diff --git a/func-throttled/package.json b/func-throttled/package.json index 3bb242bdf1..261e68c175 100644 --- a/func-throttled/package.json +++ b/func-throttled/package.json @@ -11,6 +11,7 @@ "prod:clean": "rm -rf ./node_modules && yarn install --frozen-lockfile --production", "rebuild": "yarn clean && yarn build", "sync": "node ./sync-tslib-deps.js && yarn install", + "sync:settings": "node ./sync-local-settings.js", "delete-specs": "find . -name \"*.spec.js\" -type f -delete", "clean": "rm -rf ./dist", "start:host": "func host start --port 7073", @@ -54,5 +55,10 @@ "random-number-csprng": "^1.0.2", "ua-parser-js": "^0.8.1", "uuid": "^8.3.1" + }, + "function-settings": { + "FUNCTIONS_WORKER_RUNTIME": "node", + "FUNCTIONS_EXTENSION_VERSION": "~4", + "WEBSITE_NODE_DEFAULT_VERSION": "~16" } -} \ No newline at end of file +} diff --git a/func-throttled/readme.md b/func-throttled/readme.md index ef0cd11382..cd1d24824b 100644 --- a/func-throttled/readme.md +++ b/func-throttled/readme.md @@ -25,6 +25,8 @@ a local.settings.json file is required in the root of the project, with a minimu "IsEncrypted": false, "Values": { "FUNCTIONS_WORKER_RUNTIME": "node", + "FUNCTIONS_EXTENSION_VERSION": "~4", + "WEBSITE_NODE_DEFAULT_VERSION": "~16", "AzureWebJobsStorage": "{AzureWebJobsStorage}", "AZURE_STORAGE_CONNECTION_STRING": "#your storage account connection#", "AZURE_SERVICE_BUS_CONNECTION_STRING": "#your service bus connection#" diff --git a/func-throttled/sync-local-settings.js b/func-throttled/sync-local-settings.js new file mode 100644 index 0000000000..6e4e96ab91 --- /dev/null +++ b/func-throttled/sync-local-settings.js @@ -0,0 +1,12 @@ +'use strict' + +const jedit = require('edit-json-file') + +// if the destination file does not exist it will be created +const dest = jedit('./local.settings.json') +const src = jedit('./package.json') +const defaultValues = src.get('function-settings') +dest.set('Values', defaultValues, { + merge: true +}) +dest.save() diff --git a/load-test/.nvmrc b/load-test/.nvmrc index e24183e587..e0325e5adb 100644 --- a/load-test/.nvmrc +++ b/load-test/.nvmrc @@ -1 +1 @@ -v14.18.1 +v16.17.1 diff --git a/load-test/package.json b/load-test/package.json index 0f3f21c51f..c220df1b87 100644 --- a/load-test/package.json +++ b/load-test/package.json @@ -10,7 +10,7 @@ "purgestorage": "bin/init-dev-storage.js" }, "engines": { - "node": ">= 14" + "node": ">= 16" }, "resolutions": { "**/**/lodash": "^4.17.21" diff --git a/pupil-api/.nvmrc b/pupil-api/.nvmrc index e24183e587..e0325e5adb 100644 --- a/pupil-api/.nvmrc +++ b/pupil-api/.nvmrc @@ -1 +1 @@ -v14.18.1 +v16.17.1 diff --git a/pupil-api/Dockerfile b/pupil-api/Dockerfile index 9b0b2ef137..f5c2e237eb 100644 --- a/pupil-api/Dockerfile +++ b/pupil-api/Dockerfile @@ -1,4 +1,4 @@ -FROM node:14.18.1 +FROM node:16.17.1 RUN mkdir -p /usr/src/app WORKDIR /usr/src/app diff --git a/pupil-api/dev.Dockerfile b/pupil-api/dev.Dockerfile index e427678847..5bc8fbfb39 100644 --- a/pupil-api/dev.Dockerfile +++ b/pupil-api/dev.Dockerfile @@ -1,4 +1,4 @@ -FROM node:14.18.1 +FROM node:16.17.1 RUN mkdir -p /mtc/pupil-api WORKDIR /mtc/pupil-api EXPOSE 3003 diff --git a/pupil-api/package.json b/pupil-api/package.json index 6e6b997dd5..7f701880c8 100644 --- a/pupil-api/package.json +++ b/pupil-api/package.json @@ -14,7 +14,7 @@ "clean": "rm -rf ./dist" }, "engines": { - "node": ">= 14" + "node": ">= 16" }, "resolutions": { "**/**/lodash": "^4.17.21" diff --git a/pupil-spa/.nvmrc b/pupil-spa/.nvmrc index e24183e587..e0325e5adb 100644 --- a/pupil-spa/.nvmrc +++ b/pupil-spa/.nvmrc @@ -1 +1 @@ -v14.18.1 +v16.17.1 diff --git a/pupil-spa/Dockerfile b/pupil-spa/Dockerfile index 955ef814e9..940b9ac97e 100644 --- a/pupil-spa/Dockerfile +++ b/pupil-spa/Dockerfile @@ -1,7 +1,7 @@ ### STAGE 1: Build ### # We label our stage as 'builder' -FROM node:14-alpine as builder +FROM node:16-alpine as builder # `yarn install` needs to be able to find `git` for lz-string which uses a github.com URL for the version. RUN apk update && \ diff --git a/pupil-spa/dev.Dockerfile b/pupil-spa/dev.Dockerfile index b1da3c8f49..38177e1140 100644 --- a/pupil-spa/dev.Dockerfile +++ b/pupil-spa/dev.Dockerfile @@ -1,4 +1,4 @@ -FROM node:14.18.1 +FROM node:16.17.1 RUN mkdir -p /mtc/pupil-spa WORKDIR /mtc/pupil-spa diff --git a/pupil-spa/package.json b/pupil-spa/package.json index 6b96e3cd81..d4e0ddb7d0 100644 --- a/pupil-spa/package.json +++ b/pupil-spa/package.json @@ -17,7 +17,7 @@ "runUnsupportedBrowserTests": "./unsupported-browser-tests/run-unsupported-browser-tests.sh" }, "engines": { - "node": ">= 14" + "node": ">= 16" }, "resolutions": { "**/**/lodash": ">=4.17.21", diff --git a/test/admin-hpa/README.md b/test/admin-hpa/README.md index 58ddc2808a..6d2a010a91 100644 --- a/test/admin-hpa/README.md +++ b/test/admin-hpa/README.md @@ -1,7 +1,7 @@ Installing and Running MTC tests ================================ -This is a short guide to installing and running the MTC tests. +This is a short guide to installing and running the MTC tests. ##Clone the tests @@ -14,14 +14,22 @@ git clone git@github.com:DFEAGILEDEVOPS/MTC.git Follow installation instructions for installing RVM here: https://rvm.io/rvm/install - + Once rvm is installed, we need ruby version 2.6.0, to install use the following: `rvm install 2.6.0` - + Use ruby version 2.6.0 and set it as your default: `rvm use 2.6.0 --default` -##Installing required gems +## Install FreeTDS dependency + +run `brew install FreeTDS` + +## Install prerequisites + +Set up the solution as per the [root readme](../../README.md) + +## Install required gems Go to the folder /test/admin-hpa and run the following commands: @@ -29,21 +37,21 @@ Go to the folder /test/admin-hpa and run the following commands: These two commands will install all the gems that the tests need. -## Running the tests +## Start the apps -To run in BrowserStack mode, please enter you username and password to the root .env file in the following format: +run `./setup.sh` to build all the apps +run `./restart.sh` to create and start the docker instances for SQL and Redis +start each web app (admin, spa & pupil SPA) +start each function app (func-consumption, func-throttled & func-ps-report) -``` -BROWSERSTACK_ACCESS_KEY=XYZ -BROWSERSTACK_USERNAME=xyz -``` +## Running the tests -#####Basic +##### Basic To run the tests with the default options ( headless and app running on localhost:3001 ) give the command below: `cucumber` - + The above command runs the tests headless & sequentially in one process on url 'http://localhost:3001' If you want to run the tests in chrome: @@ -58,24 +66,24 @@ If you want to run the tests on a different url: `cucumber ADMIN_BASE_URL='https://check-development.herokuapp.com'` -#####Parallel +##### Parallel If you want to run the tests in parallel to save time: - + `parallel_cucumber features/ -n 4 -o "-p parallel" ` - + The above command will run the tests headless in 4 processes ( -n option) and uses the 'parallel' profile defined in config/cucumber.yml file. Html reports are generated in report folder with names as report.html, report1.html, report2.html, report3.html ( one html report per process) - + If you want to change the url while executing parallel tests ( use the -o option in parallel gem to give cucumber command line options): - + `parallel_cucumber features/ -n 4 -o "-p parallel ADMIN_BASE_URL=‘https://check-development.herokuapp.com’"` - + If you want to run a set of tests in parallel tagged with a tag for example @smoke: - + `parallel_cucumber features/ -n 2 -o "-p parallel_chrome -t @smoke"` - -#####Rerun failing scenarios + +##### Rerun failing scenarios To run the tests with re run turned on use the following: @@ -88,13 +96,13 @@ Options available: Note: if no `DRIVER` is passed in, the default driver will be used -##Test helpers -###These helpers require ohmyzsh (https://github.com/ohmyzsh/ohmyzsh) -####Generate a new UPN +## Test helpers +### These helpers require ohmyzsh (https://github.com/ohmyzsh/ohmyzsh) +#### Generate a new UPN In your `.zshrc` add the following alias with your own path to the admin-hpa folder: -`alias upn='ruby -r "/Users/X/Documents/Projects/MTC/test/admin-hpa/./features/support/upn_generator.rb" -e "UpnGenerator.generate"'` +`alias upn='ruby -r "/Users/X/Documents/Projects/MTC/test/admin-hpa/./features/support/upn_generator.rb" -e "UpnGenerator.generate"'` Close your terminal and re-open @@ -105,7 +113,7 @@ You should be able to run the command `upn` and generate a new UPN In your `.zshrc` add the following alias with your own path to the admin-hpa folder: -`alias decompress='ruby -r "/Users/X/Documents/Projects/MTC/test/admin-hpa/./features/support/received_check_decompressor.rb" -e "ReceivedCheckDecompressor.decompress_archive_message"'` +`alias decompress='ruby -r "/Users/X/Documents/Projects/MTC/test/admin-hpa/./features/support/received_check_decompressor.rb" -e "ReceivedCheckDecompressor.decompress_archive_message"'` Close your terminal and re-open diff --git a/tslib/.nvmrc b/tslib/.nvmrc index e24183e587..e0325e5adb 100644 --- a/tslib/.nvmrc +++ b/tslib/.nvmrc @@ -1 +1 @@ -v14.18.1 +v16.17.1