replication

This commit is contained in:
ofreax
2015-07-14 18:46:36 +02:00
parent aae4e8508c
commit b594287d50
19 changed files with 114 additions and 244 deletions
+48 -1
View File
@@ -44,7 +44,7 @@ load test_helper
}
@test "ldapsearch existing database and config" {
skip
run_image -h ldap.example.org -e USE_TLS=false -v $BATS_TEST_DIRNAME/database:/var/lib/ldap -v $BATS_TEST_DIRNAME/config:/etc/ldap/slapd.d
wait_service slapd
run docker exec $CONTAINER_ID ldapsearch -x -h ldap.example.org -b dc=osixia,dc=net -D "cn=admin,dc=osixia,dc=net" -w admin
@@ -55,3 +55,50 @@ load test_helper
[ "$status" -eq 0 ]
}
@test "replication with new databases and strict TLS" {
tmp_file="$BATS_TMPDIR/docker-test"
# replication ldap server
LDAP_REPL_CID=$(docker run -h ldap2.example.org -e USE_REPLICATION=true -d $IMAGE_NAME)
LDAP_REPL_IP=$(get_container_ip_by_cid $LDAP_REPL_CID)
# ldap server
run_image -h ldap.example.org -e USE_REPLICATION=true
# add route to hosts
docker exec $LDAP_REPL_CID /osixia/test/add-host.sh $CONTAINER_IP ldap.example.org
docker exec $CONTAINER_ID /osixia/test/add-host.sh $LDAP_REPL_IP ldap2.example.org
# wait services on both servers
wait_service slapd
wait_service_by_cid $LDAP_REPL_CID slapd
# restart slapd
docker exec $LDAP_REPL_CID pkill slapd
docker exec $CONTAINER_ID pkill slapd
# wait services on both servers
wait_service slapd
wait_service_by_cid $LDAP_REPL_CID slapd
# add user on ldap2.example.org
docker exec $LDAP_REPL_CID ldapadd -x -D "cn=admin,dc=example,dc=org" -w admin -f /osixia/test/new-user.ldif -h ldap2.example.org -ZZ
sleep 5
# search user on ldap.example.org
docker exec $CONTAINER_ID ldapsearch -x -h ldap.example.org -b dc=example,dc=org -D "cn=admin,dc=example,dc=org" -w admin -ZZ >> $tmp_file
run grep -c "billy" $tmp_file
rm $tmp_file
clear_container
clear_containers_by_cid $LDAP_REPL_CID
[ "$status" -eq 0 ]
[ "$output" = "6" ]
}