Skip to content

Commit 06c7f04

Browse files
authored
chore(testing): prevent excessive MongoDB binary downloads in testing MONGOSH-1875 (#2559)
This is making use of the new locking mechanism with the runner. Should help with setup flakiness.
1 parent 8a5d765 commit 06c7f04

File tree

14 files changed

+296
-120
lines changed

14 files changed

+296
-120
lines changed

package-lock.json

Lines changed: 99 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
"husky": "^9.0.11",
118118
"mocha": "^10.2.0",
119119
"mongodb": "^6.19.0",
120-
"mongodb-runner": "^5.7.1",
120+
"mongodb-runner": "^6.0.0",
121121
"node-gyp": "^9.0.0 || ^10.2.0",
122122
"nyc": "^15.1.0",
123123
"pkg-up": "^3.1.0",

packages/build/src/download-center/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const fallback = require('./fallback.json');
1+
import fallback from './fallback.json';
22

33
/**
44
* The S3 bucket for download center configurations.

packages/build/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import type { Config, PackageVariant } from './config';
99
import { updateJsonFeedCTA } from './download-center';
1010
import Ajv from 'ajv';
1111

12+
export { downloadCryptLibrary } from './packaging/download-crypt-library';
1213
export { getArtifactUrl, downloadMongoDb };
1314

1415
const validCommands: (ReleaseCommand | 'trigger-release' | 'update-cta')[] = [

packages/build/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"compilerOptions": {
44
"outDir": "./lib",
55
"allowJs": true,
6-
"removeComments": false
6+
"removeComments": false,
7+
"resolveJsonModule": true
78
},
89
"include": ["src/**/*"],
910
"exclude": ["./src/**/*.spec.*"]

testing/.eslintrc.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const { fixCygwinPath } = require('@mongodb-js/eslint-config-mongosh/utils');
2+
3+
module.exports = {
4+
root: true,
5+
extends: ['@mongodb-js/eslint-config-mongosh'],
6+
parserOptions: {
7+
tsconfigRootDir: fixCygwinPath(__dirname),
8+
project: ['./tsconfig.json'],
9+
},
10+
};

testing/.prettierrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"@mongodb-js/prettier-config-devtools"

testing/certificates/README.md

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ This directory contains all certificates and keys used in testing.
55
To recreate the certificates follow the steps outlined below.
66

77
## Setup CA
8+
89
1. Create a new key to use for the CA:
910
```
1011
openssl genrsa -out ca.key 4096
@@ -13,10 +14,11 @@ To recreate the certificates follow the steps outlined below.
1314
```
1415
openssl req -new -x509 -key ca.key -out ca.crt -days 99999
1516
```
16-
* Organization Name: `MongoDB`
17-
* Organizational Unit Name: `DevTools`
18-
* Common Name: `DevTools CA`
17+
- Organization Name: `MongoDB`
18+
- Organizational Unit Name: `DevTools`
19+
- Common Name: `DevTools CA`
1920
3. To sign and revoke certificates, an openssl config files is required. Create `ca.cnf` with the following content:
21+
2022
```
2123
[ca]
2224
default_ca=CA_default
@@ -43,12 +45,14 @@ To recreate the certificates follow the steps outlined below.
4345
commonName=supplied
4446
emailAddress=optional
4547
```
48+
4649
4. Ensure the `ca.db` file exists:
4750
```
4851
touch ca.db
4952
```
5053

5154
## Setup Server Certificate
55+
5256
1. Create a new key to use for the server:
5357
```
5458
openssl genrsa -out server.key 4096
@@ -57,9 +61,9 @@ To recreate the certificates follow the steps outlined below.
5761
```
5862
openssl req -new -key server.key -out server.csr -days 99999
5963
```
60-
* Organization Name: `MongoDB`
61-
* Organizational Unit Name: `DevTools`
62-
* Common Name: `localhost`
64+
- Organization Name: `MongoDB`
65+
- Organizational Unit Name: `DevTools`
66+
- Common Name: `localhost`
6367
3. Sign the CSR to generate server certificate:
6468
```
6569
openssl ca -create_serial -config ca.cnf -in server.csr -out server.pem -days 99999
@@ -71,6 +75,7 @@ To recreate the certificates follow the steps outlined below.
7175
```
7276

7377
## Setup Server Certificate with invalid hostname
78+
7479
1. Create a new key to use for the server:
7580
```
7681
openssl genrsa -out server-invalidhost.key 4096
@@ -79,9 +84,9 @@ To recreate the certificates follow the steps outlined below.
7984
```
8085
openssl req -new -key server-invalidhost.key -out server-invalidhost.csr -days 99999
8186
```
82-
* Organization Name: `MongoDB`
83-
* Organizational Unit Name: `DevTools`
84-
* Common Name: `invalidhost`
87+
- Organization Name: `MongoDB`
88+
- Organizational Unit Name: `DevTools`
89+
- Common Name: `invalidhost`
8590
3. Sign the CSR to generate server certificate:
8691
```
8792
openssl ca -create_serial -config ca.cnf -in server-invalidhost.csr -out server-invalidhost.pem -days 99999
@@ -93,6 +98,7 @@ To recreate the certificates follow the steps outlined below.
9398
```
9499

95100
## Setup "Non-CA" for testing invalid CA cert
101+
96102
1. Create a new key to use for the Non CA:
97103
```
98104
openssl genrsa -out non-ca.key 4096
@@ -101,11 +107,12 @@ To recreate the certificates follow the steps outlined below.
101107
```
102108
openssl req -new -x509 -key non-ca.key -out non-ca.crt -days 99999
103109
```
104-
* Organization Name: `MongoDB`
105-
* Organizational Unit Name: `DevTools`
106-
* Common Name: `NOT DevTools CA`
110+
- Organization Name: `MongoDB`
111+
- Organizational Unit Name: `DevTools`
112+
- Common Name: `NOT DevTools CA`
107113

108114
## Revoke Server Certificate and generate CRL
115+
109116
1. Revoke the server's certificate:
110117
```
111118
openssl ca -config ca.cnf -revoke server.pem
@@ -116,6 +123,7 @@ To recreate the certificates follow the steps outlined below.
116123
```
117124

118125
## Create Client Certificate from CA
126+
119127
1. Create a new key to use for the client:
120128
```
121129
openssl genrsa -out client.key 4096
@@ -124,10 +132,10 @@ To recreate the certificates follow the steps outlined below.
124132
```
125133
openssl req -new -key client.key -out client.csr -days 99999
126134
```
127-
* Organization Name: `MongoDB`
128-
* Organizational Unit Name: `DevTools Testers`
129-
* Common Name: `Wonderwoman`
130-
* E-Mail: `tester@example.com`
135+
- Organization Name: `MongoDB`
136+
- Organizational Unit Name: `DevTools Testers`
137+
- Common Name: `Wonderwoman`
138+
- E-Mail: `tester@example.com`
131139
3. Sign the CSR to generate server certificate:
132140
```
133141
openssl ca -create_serial -config ca.cnf -in client.csr -out client.pem -days 99999
@@ -146,9 +154,10 @@ To recreate the certificates follow the steps outlined below.
146154
```
147155
openssl pkcs12 -inkey client.bundle.pem -in client.bundle.pem -export -out client.bundle.pfx
148156
```
149-
* Password: `passw0rd`
157+
- Password: `passw0rd`
150158

151159
## Create Client Certificate not from CA
160+
152161
1. Create a new key to use for the Non CA:
153162
```
154163
openssl genrsa -out invalid-client.key 4096
@@ -157,10 +166,10 @@ To recreate the certificates follow the steps outlined below.
157166
```
158167
openssl req -new -x509 -key invalid-client.key -out invalid-client.crt -days 99999
159168
```
160-
* Organization Name: `MongoDB`
161-
* Organizational Unit Name: `DevTools Testers`
162-
* Common Name: `Wonderwoman`
163-
* E-Mail: `tester@example.com`
169+
- Organization Name: `MongoDB`
170+
- Organizational Unit Name: `DevTools Testers`
171+
- Common Name: `Wonderwoman`
172+
- E-Mail: `tester@example.com`
164173
3. Create a bundle with client key and certificate to use for connecting:
165174
```
166175
cat invalid-client.crt invalid-client.key > invalid-client.bundle.pem

0 commit comments

Comments
 (0)