Skip to content

Commit

Permalink
Test utility for configuring test LDAP directories (#35)
Browse files Browse the repository at this point in the history
Added test configuration framework and changed tests to use testDN.
  • Loading branch information
hoylen authored Jun 28, 2020
1 parent 9e9eaf8 commit 2483a3d
Show file tree
Hide file tree
Showing 26 changed files with 1,839 additions and 1,237 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ tags
.project
*~
.dart_tool/

test/CONFIG.yaml
test/CONFIG.YAML
test/config.yaml
test/Config.yaml
2 changes: 1 addition & 1 deletion lib/src/dartdap/client/ldap_connection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,7 @@ class LdapConnection {

var result = await c.future;

if (_bindException) {
if (_bindException ?? false) {
assert(result == null);
throw _bindException;
}
Expand Down
12 changes: 12 additions & 0 deletions test/CONFIG-default.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Default test configuration file
#
# To run tests using this configuration, make sure there is no file or symlink
# called "CONFIG.yaml". See README.md for details.
#
# DO NOT CHANGE THIS FILE. To customize for a local test environment, create
# a new configuration file and a "CONFIG.yaml" symlink to it.


# This file deliberately does not define any directory configurations.
# Tests that don't require an LDAP directory will still run, so it can
# be used without requiring the tester to setup a test environment.
26 changes: 26 additions & 0 deletions test/CONFIG-opendj.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Example custom config file for special tests
#
# To run tests using this configuration, create a "CONFIG.yaml" symlink to it.
# See README.md for details.

directories:
populated-with-2000-users:
host: localhost
port: 1389
ssl: false
validate-certificate: false
bindDN: uid=admin
password: password
testDN: ou=people,ou=identities

directory-with-valid-certificates:
host: test-ldap.example.com
port: 636
ssl: true
validate-certificate: true # perform normal X.509 validation
bindDN: uid=admin
password: password
testDN: ou=people,ou=identities

# Note: this file needs a better name, since the tests can work with any
# suitably configured LDAP directory, not just the OpenDJ implementation.
48 changes: 48 additions & 0 deletions test/CONFIG-standard.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Standard test config file
#
# To run tests using this configuration, create a "CONFIG.yaml" symlink to it.
# See README.md for details.
#
# DO NOT CHANGE THIS FILE. To customize for a local test environment, create
# a new configuration file and a "CONFIG.yaml" symlink to it.

directories:
# Directory for tests with no special requirements
default:
host: "localhost"
port: 1389
ssl: false
bindDN: "cn=Manager,dc=example,dc=com"
password: "password"
testDN: "ou=testing,dc=example,dc=com"

# Directory for tests that require LDAP (must not use LDAPS, i.e. no TLS)
ldap:
host: "localhost"
port: 1389 # use a SSH tunnel to port 389 on the server
ssl: false
bindDN: "cn=Manager,dc=example,dc=com"
password: "password"
testDN: "ou=testing,dc=example,dc=com"

# Directory for tests that require LDAPS (must use LDAP over TLS)
ldaps:
host: "localhost"
port: 1636 # use a SSH tunnel to port 636 on the server
ssl: true
bindDN: "cn=Manager,dc=example,dc=com"
password: "password"
validate-certificate: false # accepts self-signed certificates
testDN: "ou=testing,dc=example,dc=com"

# logging:
# ldap.connection: INFO
# ldap.control: INFO
# ldap.recv.asn1: INFO
# ldap.recv.bytes: INFO
# ldap.recv.ldap: INFO
# ldap.recv: INFO
# ldap.send.bytes: INFO
# ldap.send.ldap: INFO
# ldap.send: INFO
# ldap: INFO
Loading

0 comments on commit 2483a3d

Please sign in to comment.