Skip to content

Commit 8bff30d

Browse files
committed
chore(ci): use encoded cert in e2e tests
1 parent f22a0d8 commit 8bff30d

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

.evergreen/connectivity-tests/run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ docker run \
2222
-e E2E_TESTS_FREE_TIER_HOST="${E2E_TESTS_FREE_TIER_HOST}" \
2323
-e E2E_TESTS_ATLAS_USERNAME="${E2E_TESTS_ATLAS_USERNAME}" \
2424
-e E2E_TESTS_ATLAS_PASSWORD="${E2E_TESTS_ATLAS_PASSWORD}" \
25-
-e E2E_TESTS_ATLAS_X509_PEM="${E2E_TESTS_ATLAS_X509_PEM}" \
25+
-e E2E_TESTS_ATLAS_X509_PEM_BASE64="${E2E_TESTS_ATLAS_X509_PEM_BASE64}" \
2626
-e MONGODB_VERSION="${MONGODB_VERSION}" \
2727
--add-host mongodb-kerberos-1.example.com:0.0.0.0 \
2828
--add-host mongodb-kerberos-2.example.com:0.0.0.0 \

.evergreen/functions.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ variables:
6262
E2E_TESTS_FREE_TIER_HOST: ${e2e_tests_free_tier_host}
6363
E2E_TESTS_ATLAS_USERNAME: ${e2e_tests_atlas_username}
6464
E2E_TESTS_ATLAS_PASSWORD: ${e2e_tests_atlas_password}
65-
E2E_TESTS_ATLAS_X509_PEM: ${e2e_tests_atlas_x509_pem}
65+
E2E_TESTS_ATLAS_X509_PEM_BASE64: ${e2e_tests_atlas_x509_pem_base64}
6666
E2E_TESTS_ATLAS_IAM_ACCESS_KEY_ID: ${e2e_tests_atlas_iam_aws_access_key_id}
6767
E2E_TESTS_ATLAS_IAM_SECRET_ACCESS_KEY: ${e2e_tests_atlas_iam_aws_secret_access_key}
6868
E2E_TESTS_ATLAS_IAM_TEMP_ROLE_ARN: ${e2e_tests_atlas_iam_temp_role_arn}

packages/compass-e2e-tests/tests/connection.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function hasAtlasEnvironmentVariables(): boolean {
3939
'E2E_TESTS_FREE_TIER_HOST',
4040
'E2E_TESTS_ATLAS_USERNAME',
4141
'E2E_TESTS_ATLAS_PASSWORD',
42-
'E2E_TESTS_ATLAS_X509_PEM',
42+
'E2E_TESTS_ATLAS_X509_PEM_BASE64',
4343
'E2E_TESTS_ATLAS_IAM_ACCESS_KEY_ID',
4444
'E2E_TESTS_ATLAS_IAM_SECRET_ACCESS_KEY',
4545
'E2E_TESTS_ATLAS_IAM_TEMP_ROLE_ARN',
@@ -724,7 +724,11 @@ describe('Connection form', function () {
724724
try {
725725
tempdir = await fs.mkdtemp(path.join(os.tmpdir(), 'connect-tests-'));
726726
const certPath = path.join(tempdir, 'x509.pem');
727-
await fs.writeFile(certPath, process.env.E2E_TESTS_ATLAS_X509_PEM ?? '');
727+
await fs.writeFile(
728+
certPath,
729+
process.env.E2E_TESTS_ATLAS_X509_PEM_BASE64 ?? '',
730+
'base64'
731+
);
728732

729733
const atlasConnectionOptions: ConnectFormState = {
730734
hosts: [process.env.E2E_TESTS_ATLAS_HOST ?? ''],

packages/data-service/src/connect.spec.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const {
3030
E2E_TESTS_SERVERLESS_HOST,
3131
E2E_TESTS_FREE_TIER_HOST,
3232
E2E_TESTS_ANALYTICS_NODE_HOST,
33-
E2E_TESTS_ATLAS_X509_PEM,
33+
E2E_TESTS_ATLAS_X509_PEM_BASE64,
3434
} = process.env;
3535

3636
const buildConnectionString = (
@@ -204,15 +204,22 @@ describe('connect', function () {
204204
});
205205

206206
it('connects to atlas with X509', async function () {
207-
if (!IS_CI && !(E2E_TESTS_ATLAS_HOST || E2E_TESTS_ATLAS_X509_PEM)) {
207+
if (
208+
!IS_CI &&
209+
!(E2E_TESTS_ATLAS_HOST || E2E_TESTS_ATLAS_X509_PEM_BASE64)
210+
) {
208211
return this.skip();
209212
}
210213

211214
let tempdir;
212215
try {
213216
tempdir = await fs.mkdtemp(path.join(os.tmpdir(), 'connect-tests-'));
214217
const certPath = path.join(tempdir, 'x509.pem');
215-
await fs.writeFile(certPath, E2E_TESTS_ATLAS_X509_PEM);
218+
await fs.writeFile(
219+
certPath,
220+
process.env.E2E_TESTS_ATLAS_X509_PEM_BASE64 ?? '',
221+
'base64'
222+
);
216223

217224
const url = new ConnectionStringUrl(
218225
`mongodb+srv://${E2E_TESTS_ATLAS_HOST || ''}/admin`

0 commit comments

Comments
 (0)