Skip to content

Commit 5811eba

Browse files
authored
test(NODE-5268): use node 20 in ci (#650)
1 parent 9faecc3 commit 5811eba

File tree

4 files changed

+33
-42
lines changed

4 files changed

+33
-42
lines changed

.evergreen/install-dependencies.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22
set -o errexit # Exit the script with error if any of the commands fail
33

4-
NODE_LTS_NAME=${NODE_LTS_NAME:-fermium}
4+
NODE_LTS_VERSION=${NODE_LTS_VERSION:-16}
55
NODE_ARTIFACTS_PATH="${PROJECT_DIRECTORY:-$(pwd)}/node-artifacts"
66
if [[ "$OS" = "Windows_NT" ]]; then NODE_ARTIFACTS_PATH=$(cygpath --unix "$NODE_ARTIFACTS_PATH"); fi
77

@@ -28,11 +28,12 @@ curl "${CURL_FLAGS[@]}" "https://nodejs.org/dist/index.tab" --output node_index.
2828

2929
while IFS=$'\t' read -r -a row; do
3030
node_index_version="${row[0]}"
31+
node_index_major_version=$(echo $node_index_version | sed -E 's/^v([0-9]+).*$/\1/')
3132
node_index_date="${row[1]}"
3233
node_index_lts="${row[9]}"
3334
[[ "$node_index_version" = "version" ]] && continue # skip tsv header
34-
[[ "$NODE_LTS_NAME" = "latest" ]] && break # first line is latest
35-
[[ "$NODE_LTS_NAME" = "$node_index_lts" ]] && break # case insensitive compare
35+
[[ "$NODE_LTS_VERSION" = "latest" ]] && break # first line is latest
36+
[[ "$NODE_LTS_VERSION" = "$node_index_major_version" ]] && break # case insensitive compare
3637
done < node_index.tab
3738

3839
if [[ "$OS" = "Windows_NT" ]]; then

.evergreen/prebuild.sh

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,25 @@ if [ -z ${DISTRO_ID+omitted} ]; then echo "DISTRO_ID is unset" && exit 1; fi
55
set -o errexit
66
set +o xtrace
77

8-
# FLE platform matrix (as of Feb 8th 2022)
8+
echo "Setting up environment"
9+
10+
export PATH="/opt/mongodbtoolchain/v2/bin:$PATH"
11+
hash -r
12+
13+
NODE_LTS_VERSION=${NODE_LTS_VERSION:-16}
14+
export NODE_LTS_VERSION=${NODE_LTS_VERSION}
15+
source ./.evergreen/install-dependencies.sh
16+
17+
# install node dependencies
18+
echo "Installing package dependencies (includes a static build)"
19+
bash ./etc/build-static.sh
20+
21+
# FLE platform matrix (as of 22 May 2023)
922
# macos arm64 (compiled on 11.00)
1023
# macos x86_64 (compiled on 10.14)
11-
# windows x86_64 (compiled on vs2017)
12-
# linux x86_64 (releases on RHEL7)
13-
# linux s390x
14-
# linux arm64
24+
# windows x86_64 (compiled on vs2019)
25+
# linux x86_64 (compiled on Ubuntu 16.04)
26+
# linux arm64 (compiled on Ubuntu 16.04)
1527

1628
# Determines the OS name through uname results
1729
# Returns 'windows' 'linux' 'macos' or 'unknown'
@@ -68,27 +80,6 @@ if [[ -n $NODE_FORCE_PUBLISH ]]; then
6880
elif [[ "$VERSION_AT_HEAD" != "$VERSION_AT_HEAD_1" ]]; then
6981
echo "Difference is package version ($VERSION_AT_HEAD_1 -> $VERSION_AT_HEAD)"
7082
echo "Beginning prebuild"
71-
72-
if [[ "$OS" == "linux" ]]; then
73-
# Handle limiting which linux gets to publish prebuild
74-
ARCH=$(uname -m)
75-
76-
if [[ $DISTRO_ID == "rhel70-small" ]]; then
77-
# only publish x86_64 linux prebuilds from RHEL 7
78-
run_prebuild
79-
elif [[ "$ARCH" != "x86_64" ]]; then
80-
# Non-x86 linux variants should just publish
81-
run_prebuild
82-
else
83-
# Non RHEL 7 linux variants should just test the prebuild task
84-
echo "Will prebuild without submit ($OS - $ARCH - $DISTRO_ID)"
85-
npm run prebuild
86-
fi
87-
88-
exit 0
89-
fi
90-
91-
# Windows and MacOS
9283
run_prebuild
9384
else
9485
echo "No difference is package version ($VERSION_AT_HEAD_1 -> $VERSION_AT_HEAD)"

.evergreen/test.sh

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@ echo "Setting up environment"
88
export PATH="/opt/mongodbtoolchain/v2/bin:$PATH"
99
hash -r
1010

11-
export NODE_LTS_NAME="gallium"
11+
NODE_LTS_VERSION=${NODE_LTS_VERSION:-16}
12+
export NODE_LTS_VERSION=${NODE_LTS_VERSION}
1213
source ./.evergreen/install-dependencies.sh
1314

14-
15-
1615
# Handle the circular dependency when testing with a real client.
1716
MONGODB_CLIENT_ENCRYPTION_OVERRIDE="$(pwd)"
1817
export MONGODB_CLIENT_ENCRYPTION_OVERRIDE
@@ -22,15 +21,11 @@ echo "Installing package dependencies (includes a static build)"
2221
bash ./etc/build-static.sh
2322

2423
if [[ $OMIT_PEER_DEPS != "true" ]]; then
25-
npm install '@aws-sdk/credential-providers'
26-
npm install 'gcp-metadata'
24+
npm install '@aws-sdk/credential-providers'
25+
npm install 'gcp-metadata'
2726
fi
2827

2928
# Run tests
3029
echo "Running tests"
3130
npm run check:lint
3231
MONGODB_NODE_SKIP_LIVE_TESTS=true npm test
33-
34-
# Run prebuild and deploy
35-
echo "Running prebuild and deploy"
36-
bash ./.evergreen/prebuild.sh

test/providers/credentialsProvider.test.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,16 @@ describe('#loadCredentials', function () {
169169
httpServer = http
170170
.createServer((_, res) => {
171171
if (status === 200) {
172-
res.writeHead(200, { 'Content-Type': 'application/json' });
173-
res.writeHead(200, { 'Metadata-Flavor': 'Google' });
172+
res.writeHead(200, {
173+
'Content-Type': 'application/json',
174+
'Metadata-Flavor': 'Google'
175+
});
174176
res.end(JSON.stringify({ access_token: 'abc' }));
175177
} else {
176-
res.writeHead(401, { 'Content-Type': 'application/json' });
177-
res.writeHead(401, { 'Metadata-Flavor': 'Google' });
178+
res.writeHead(401, {
179+
'Content-Type': 'application/json',
180+
'Metadata-Flavor': 'Google'
181+
});
178182
res.end('{}');
179183
}
180184
})

0 commit comments

Comments
 (0)