Skip to content

Commit 182d5e5

Browse files
Use LDAP container for integration tests (#235)
* Use LDAP container for integration tests
1 parent 98a04cd commit 182d5e5

File tree

6 files changed

+62
-4
lines changed

6 files changed

+62
-4
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ before_install:
2727
- export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64
2828
- java -version
2929
- source src/main/docker/env.bash
30-
- docker-compose -f src/main/docker/docker-compose.yml up -d eiffel-er mongodb rabbitmq jenkins mail-server
30+
- docker-compose -f src/main/docker/docker-compose.yml up -d eiffel-er mongodb rabbitmq jenkins mail-server ldap ldap-seed
3131

3232

3333
install:

src/integrationtest/resources/integration-test.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,11 @@ er.url:
122122
#er.url: http://localhost:8080/eventrepository/search/
123123
# settings for ldap server if ldap authentication is needed
124124
ldap.enabled: true
125-
ldap.url: ldap://ldap.forumsys.com:389/dc=example,dc=com
125+
ldap.url: ldap://localhost:389/dc=example,dc=org
126126
ldap.base.dn:
127-
ldap.username: cn=read-only-admin,dc=example,dc=com
127+
ldap.username: cn=admin,dc=example,dc=org
128128
# For security reasons and to avoid authorization problems this
129129
# password should be encoded. It will be decoded in EndpointSecurity.java.
130130
# Password needs to be encoded with base64.
131-
ldap.password: cGFzc3dvcmQ=
131+
ldap.password: YWRtaW4=
132132
ldap.user.filter: uid={0}

src/main/docker/docker-compose.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,5 +389,31 @@ services:
389389
- logging.level.org.springframework.web=DEBUG
390390
- logging.level.com.ericsson.ei=DEBUG
391391

392+
ldap:
393+
restart: always
394+
image: osixia/openldap
395+
hostname: "example.org"
396+
expose:
397+
- "389"
398+
- "636"
399+
ports:
400+
- "389:389"
401+
- "636:636"
402+
environment:
403+
LDAP_TLS: 'false'
404+
LDAP_ORGANISATION: "Test"
405+
LDAP_DOMAIN: "example.org"
406+
LDAP_BASE_DN: "dc=example,dc=org"
407+
LDAP_ADMIN_PASSWORD: "admin"
408+
409+
ldap-seed:
410+
image: osixia/openldap
411+
volumes:
412+
- ./ldap-seed:/container/service/slapd/assets/test/
413+
links:
414+
- ldap
415+
command: chmod +x /container/service/slapd/assets/test/addAll.sh
416+
entrypoint: sh -c '/container/service/slapd/assets/test/addAll.sh'
417+
392418
networks:
393419
eiffel_2.0_1:

src/main/docker/ldap-seed/addAll.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
sleep 5
3+
ldapadd -h ldap -D "cn=admin,dc=example,dc=org" -w admin -f /container/service/slapd/assets/test/gauss.ldif
4+
ldapadd -h ldap -D "cn=admin,dc=example,dc=org" -w admin -f /container/service/slapd/assets/test/newton.ldif

src/main/docker/ldap-seed/gauss.ldif

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
dn: uid=gauss,dc=example,dc=org
2+
uid: gauss
3+
cn: gauss
4+
sn: 3
5+
objectClass: top
6+
objectClass: posixAccount
7+
objectClass: inetOrgPerson
8+
loginShell: /bin/bash
9+
homeDirectory: /home/gauss
10+
uidNumber: 14583102
11+
gidNumber: 14564100
12+
userPassword: password
13+
mail: gauss@example.org
14+
gecos: Gauss User

src/main/docker/ldap-seed/newton.ldif

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
dn: uid=newton,dc=example,dc=org
2+
uid: newton
3+
cn: newton
4+
sn: 3
5+
objectClass: top
6+
objectClass: posixAccount
7+
objectClass: inetOrgPerson
8+
loginShell: /bin/bash
9+
homeDirectory: /home/newton
10+
uidNumber: 14583103
11+
gidNumber: 14564101
12+
userPassword: password
13+
mail: newton@example.org
14+
gecos: Newton User

0 commit comments

Comments
 (0)