Skip to content

Commit

Permalink
chore(ci): add plain ldap auth test
Browse files Browse the repository at this point in the history
  • Loading branch information
emadum authored Aug 6, 2020
1 parent 61a1d32 commit d3a1d54
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 117 deletions.
10 changes: 10 additions & 0 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1076,6 +1076,13 @@ tasks:
VERSION: latest
TOPOLOGY: server
- func: run tls tests
- name: test-auth-ldap
tags:
- auth
- ldap
commands:
- func: install dependencies
- func: run ldap tests
- name: test-latest-ocsp-valid-cert-server-staples
tags:
- ocsp
Expand Down Expand Up @@ -1371,6 +1378,7 @@ buildvariants:
- test-2.6-sharded_cluster-unified
- test-atlas-connectivity
- test-tls-support
- test-auth-ldap
- test-latest-ocsp-valid-cert-server-staples
- test-latest-ocsp-invalid-cert-server-staples
- test-latest-ocsp-valid-cert-server-does-not-staple
Expand Down Expand Up @@ -1482,6 +1490,7 @@ buildvariants:
- test-2.6-replica_set-unified
- test-2.6-sharded_cluster-unified
- test-atlas-connectivity
- test-auth-ldap
- name: ubuntu-14.04-dubnium
display_name: Ubuntu 14.04 Node Dubnium
run_on: ubuntu1404-test
Expand Down Expand Up @@ -1557,6 +1566,7 @@ buildvariants:
- test-3.2-sharded_cluster-unified
- test-atlas-connectivity
- test-tls-support
- test-auth-ldap
- test-latest-ocsp-valid-cert-server-staples
- test-latest-ocsp-invalid-cert-server-staples
- test-latest-ocsp-valid-cert-server-does-not-staple
Expand Down
5 changes: 5 additions & 0 deletions .evergreen/generate_evergreen_tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ TASKS.push(
},
{ func: 'run tls tests' }
]
},
{
name: 'test-auth-ldap',
tags: ['auth', 'ldap'],
commands: [{ func: 'install dependencies' }, { func: 'run ldap tests' }]
}
);

Expand Down
10 changes: 10 additions & 0 deletions .evergreen/run-ldap-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -o errexit # Exit the script with error if any of the commands fail

export PROJECT_DIRECTORY="$(pwd)"
NODE_ARTIFACTS_PATH="${PROJECT_DIRECTORY}/node-artifacts"
export NVM_DIR="${NODE_ARTIFACTS_PATH}/nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

npm run check:ldap
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"scripts": {
"atlas": "mocha --opts '{}' ./test/manual/atlas_connectivity.test.js",
"check:tls": "mocha --opts '{}' test/manual/tls_support.test.js",
"check:ldap": "mocha --opts '{}' test/manual/ldap.test.js",
"test": "npm run lint && mocha --recursive test/functional test/unit test/core",
"test-nolint": "mocha --recursive test/functional test/unit test/core",
"coverage": "istanbul cover mongodb-test-runner -- -t 60000 test/core test/unit test/functional",
Expand Down
117 changes: 0 additions & 117 deletions test/functional/ldap.test.js

This file was deleted.

26 changes: 26 additions & 0 deletions test/manual/ldap.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
'use strict';
const MongoClient = require('../..').MongoClient;
var test = require('../functional/shared').assert;

describe('LDAP', function() {
if (process.env.MONGODB_URI == null) {
throw new Error(`skipping SSL tests, MONGODB_URI environment variable is not defined`);
}

it('Should correctly authenticate against ldap', function(done) {
const client = new MongoClient(process.env.MONGODB_URI);
client.connect(function(err, client) {
test.equal(null, err);

client
.db('ldap')
.collection('test')
.findOne(function(err, doc) {
test.equal(null, err);
test.equal(true, doc.ldap);

client.close(done);
});
});
});
});

0 comments on commit d3a1d54

Please sign in to comment.