Permalink
Browse files

* tests/alltests.js: Many new tests.

  • Loading branch information...
1 parent 9f75e01 commit 3133922f047fe46dbda3915cda43e871102248d0 @jeremycx committed Jan 3, 2013
Showing with 42 additions and 7 deletions.
  1. +34 −1 tests/alltests.js
  2. +3 −3 tests/run_tests.sh
  3. +5 −3 tests/slapd.conf
View
@@ -1,10 +1,40 @@
+/*jshint globalstrict: true, node: true, trailing:true, unused:true, es5:true */
+
+"use strict";
+
var LDAP = require('../LDAP');
var ldap;
var assert = require('assert');
var schema;
var tests = [
{
+ name: 'RECONNECT_SYNCREPL',
+ description: 'Disconnect while syncrepl running',
+ fn: function() {
+ ldap.sync({
+ base: 'dc=com',
+ scope: ldap.SUBTREE,
+ filter: '(objectClass=*)',
+ attrs: '*',
+ rid: '234',
+ cookie: '',
+ syncentry: function(data) {
+ console.log('------');
+ console.log(data);
+ },
+ newcookie: function(cookie) {
+ console.log('newcookie' + cookie);
+ }
+ });
+ console.log('Sync configured.');
+ setTimeout(function() {
+ console.log('Proceeding');
+ next();
+ }, 20000);
+ }
+ },
+ {
name: 'SCHEMA',
description: 'Schema Load',
fn: function() {
@@ -219,7 +249,8 @@ var tests = [
fn: function() {
ldap.search({
base: 'dc=sample,dc=com',
- filter: '(cn=Oooo*)'
+ filter: '(cn=Oooo*)',
+ attrs: '+',
}, function(err, data) {
assert(!err);
assert(data.length == 1);
@@ -502,5 +533,7 @@ function next() {
}
}
+var slapd_pid = process.argv[2];
+
console.log('');
next();
View
@@ -10,11 +10,11 @@ $RM -rf openldap-data
$MKDIR openldap-data
$SLAPADD -f slapd.conf < startup.ldif
-$SLAPD -F . -f slapd.conf -hldap://localhost:1234
-
+$SLAPD -d0 -f slapd.conf -hldap://localhost:1234 &
+SLAPD_PID=$!
# slapd should be running now
-node alltests.js
+node alltests.js $SLAPD_PID
# kill slapd
$KILL -15 `cat slapd.pid`
View
@@ -47,13 +47,16 @@ moduleload back_bdb
#
# rootdn can always read and write EVERYTHING!
-idletimeout 1
+idletimeout 100
#######################################################################
# BDB database definitions
#######################################################################
database bdb
+overlay syncprov
+syncprov-checkpoint 10 10
+
suffix "dc=sample,dc=com"
rootdn "cn=Manager,dc=sample,dc=com"
# Cleartext passwords, especially for the rootdn, should
@@ -65,5 +68,4 @@ rootpw secret
# Mode 700 recommended.
directory ./openldap-data
# Indices to maintain
-index objectClass eq
-index cn eq
+index objectClass,cn,contextCSN eq

0 comments on commit 3133922

Please sign in to comment.