-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathmongodb_oidc_k8s.prose.07.test.ts
More file actions
38 lines (31 loc) · 1.21 KB
/
mongodb_oidc_k8s.prose.07.test.ts
File metadata and controls
38 lines (31 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { expect } from 'chai';
import { type Collection, MongoClient } from '../../../src';
const DEFAULT_URI = 'mongodb://127.0.0.1:27017';
describe('OIDC Auth Spec K8s Tests', function () {
// Note there is no spec or tests for K8s, and it's optional to run the entire
// machine prose tests on the additional environments so we do 1 sanity check
// here. This same test will run in CI on AKS, EKS, and GKE.
describe('7. K8s Tests', function () {
let client: MongoClient;
let collection: Collection;
beforeEach(function () {
if (!this.configuration.isOIDC(process.env.MONGODB_URI_SINGLE, 'k8s')) {
this.skipReason = 'K8s OIDC prose tests require a K8s OIDC environment.';
this.skip();
}
});
afterEach(async function () {
await client?.close();
});
describe('7.1 K8s With Environment Set', function () {
beforeEach(function () {
client = new MongoClient(process.env.MONGODB_URI_SINGLE ?? DEFAULT_URI);
collection = client.db('test').collection('test');
});
it('successfully authenticates', async function () {
const result = await collection.findOne();
expect(result).to.not.be.null;
});
});
});
});