Skip to content

Commit d3a1d54

Browse files
authored
chore(ci): add plain ldap auth test
NODE-875
1 parent 61a1d32 commit d3a1d54

File tree

6 files changed

+52
-117
lines changed

6 files changed

+52
-117
lines changed

.evergreen/config.yml

+10
Original file line numberDiff line numberDiff line change
@@ -1076,6 +1076,13 @@ tasks:
10761076
VERSION: latest
10771077
TOPOLOGY: server
10781078
- func: run tls tests
1079+
- name: test-auth-ldap
1080+
tags:
1081+
- auth
1082+
- ldap
1083+
commands:
1084+
- func: install dependencies
1085+
- func: run ldap tests
10791086
- name: test-latest-ocsp-valid-cert-server-staples
10801087
tags:
10811088
- ocsp
@@ -1371,6 +1378,7 @@ buildvariants:
13711378
- test-2.6-sharded_cluster-unified
13721379
- test-atlas-connectivity
13731380
- test-tls-support
1381+
- test-auth-ldap
13741382
- test-latest-ocsp-valid-cert-server-staples
13751383
- test-latest-ocsp-invalid-cert-server-staples
13761384
- test-latest-ocsp-valid-cert-server-does-not-staple
@@ -1482,6 +1490,7 @@ buildvariants:
14821490
- test-2.6-replica_set-unified
14831491
- test-2.6-sharded_cluster-unified
14841492
- test-atlas-connectivity
1493+
- test-auth-ldap
14851494
- name: ubuntu-14.04-dubnium
14861495
display_name: Ubuntu 14.04 Node Dubnium
14871496
run_on: ubuntu1404-test
@@ -1557,6 +1566,7 @@ buildvariants:
15571566
- test-3.2-sharded_cluster-unified
15581567
- test-atlas-connectivity
15591568
- test-tls-support
1569+
- test-auth-ldap
15601570
- test-latest-ocsp-valid-cert-server-staples
15611571
- test-latest-ocsp-invalid-cert-server-staples
15621572
- test-latest-ocsp-valid-cert-server-does-not-staple

.evergreen/generate_evergreen_tasks.js

+5
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ TASKS.push(
126126
},
127127
{ func: 'run tls tests' }
128128
]
129+
},
130+
{
131+
name: 'test-auth-ldap',
132+
tags: ['auth', 'ldap'],
133+
commands: [{ func: 'install dependencies' }, { func: 'run ldap tests' }]
129134
}
130135
);
131136

.evergreen/run-ldap-tests.sh

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
set -o errexit # Exit the script with error if any of the commands fail
4+
5+
export PROJECT_DIRECTORY="$(pwd)"
6+
NODE_ARTIFACTS_PATH="${PROJECT_DIRECTORY}/node-artifacts"
7+
export NVM_DIR="${NODE_ARTIFACTS_PATH}/nvm"
8+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
9+
10+
npm run check:ldap

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
"scripts": {
6767
"atlas": "mocha --opts '{}' ./test/manual/atlas_connectivity.test.js",
6868
"check:tls": "mocha --opts '{}' test/manual/tls_support.test.js",
69+
"check:ldap": "mocha --opts '{}' test/manual/ldap.test.js",
6970
"test": "npm run lint && mocha --recursive test/functional test/unit test/core",
7071
"test-nolint": "mocha --recursive test/functional test/unit test/core",
7172
"coverage": "istanbul cover mongodb-test-runner -- -t 60000 test/core test/unit test/functional",

test/functional/ldap.test.js

-117
This file was deleted.

test/manual/ldap.test.js

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
'use strict';
2+
const MongoClient = require('../..').MongoClient;
3+
var test = require('../functional/shared').assert;
4+
5+
describe('LDAP', function() {
6+
if (process.env.MONGODB_URI == null) {
7+
throw new Error(`skipping SSL tests, MONGODB_URI environment variable is not defined`);
8+
}
9+
10+
it('Should correctly authenticate against ldap', function(done) {
11+
const client = new MongoClient(process.env.MONGODB_URI);
12+
client.connect(function(err, client) {
13+
test.equal(null, err);
14+
15+
client
16+
.db('ldap')
17+
.collection('test')
18+
.findOne(function(err, doc) {
19+
test.equal(null, err);
20+
test.equal(true, doc.ldap);
21+
22+
client.close(done);
23+
});
24+
});
25+
});
26+
});

0 commit comments

Comments
 (0)