1
+ name : Test-HA
2
+ on :
3
+ workflow_call :
4
+ jobs :
5
+ qualif :
6
+ runs-on : ubuntu-latest
7
+ steps :
8
+ - name : Check out code
9
+ uses : actions/checkout@v1
10
+ - name : Run custom action
11
+ # Use the location in the repository (without action.yml)
12
+ uses : ./.github/actions/setup
13
+ with :
14
+ install-chaos : true
15
+ - name : setup certs
16
+ shell : bash
17
+ run : |
18
+ openssl req -x509 -newkey rsa:4096 -nodes -subj '/CN=example.com' -keyout tls.key -out tls.crt -days 365
19
+ cp tls.crt ca.crt
20
+ kubectl create secret generic custom-cert --from-file=./tls.crt --from-file=./tls.key --from-file=./ca.crt
21
+ - name : deploy openldap-stack-ha
22
+ shell : bash
23
+ run : |
24
+ cd "$GITHUB_WORKSPACE"
25
+ helm install openldap-stack-ha -f .bin/myval.yaml .
26
+ kubectl rollout status sts openldap-stack-ha
27
+ - name : verify deployment
28
+ shell : bash
29
+ run : |
30
+ echo "test access to openldap database"
31
+ sleep 10
32
+ LDAPTLS_REQCERT=never ldapsearch -x -D 'cn=admin,dc=example,dc=org' -w Not@SecurePassw0rd -H ldaps://localhost:30636 -b 'dc=example,dc=org'
33
+ - name : test phpldapadmin access
34
+ shell : bash
35
+ run : |
36
+ echo "test access to phpldapadmin"
37
+ echo "127.0.0.1 phpldapadmin.example ssl-ldap2.example" | sudo tee -a /etc/hosts
38
+ curl phpldapadmin.example:8080
39
+ - name : test self service pwd access
40
+ shell : bash
41
+ run : |
42
+ echo "test access to ssp"
43
+ curl ssl-ldap2.example:8080
44
+ - name : verify certs
45
+ shell : bash
46
+ run : |
47
+ echo "verify certificate"
48
+ echo | openssl s_client -showcerts -servername example.com -connect localhost:30636 2>/dev/null | openssl x509 -inform pem -noout -text > /tmp/test-cert.txt
49
+ if ! grep -q "CN = example.com" /tmp/test-cert.txt; then echo exit 1; fi
50
+ - name : apply chaos tests
51
+ shell : bash
52
+ run : |
53
+ echo "test access to openldap database"
54
+ kubectl apply -f .bin/chaos.yaml
55
+ - name : test write
56
+ shell : bash
57
+ run : |
58
+ echo "Write test to openldap database"
59
+ LDAPTLS_REQCERT=never ldapadd -x -D 'cn=admin,dc=example,dc=org' -w Not@SecurePassw0rd -H ldaps://localhost:30636 -f .bin/user.ldif
60
+ LDAPTLS_REQCERT=never ldapsearch -o nettimeout=20 -x -D 'cn=admin,dc=example,dc=org' -w Not@SecurePassw0rd -H ldaps://localhost:30636 -b 'dc=example,dc=org' > /tmp/test-write.txt
61
+ if ! grep "Einstein" /tmp/test-write.txt; then exit 1 ; fi
62
+ if ! grep "objectClass: ownCloud" /tmp/test-write.txt; then echo 'no ownCloud entry found'; fi
63
+ - name : test memberOf
64
+ shell : bash
65
+ run : |
66
+ echo "MemberOf test to openldap database"
67
+ LDAPTLS_REQCERT=never ldapsearch -o nettimeout=20 -x -D 'cn=admin,dc=example,dc=org' -w Not@SecurePassw0rd -H ldaps://localhost:30636 -b 'dc=example,dc=org' "(memberOf=cn=testgroup,ou=Group,dc=example,dc=org)" > /tmp/test-write.txt
68
+ if [ $(grep "numResponses" /tmp/test-write.txt | cut -d ":" -f 2 | tr -d ' ') -ne 2 ]; then exit 1 ; fi
69
+ if ! grep -q "uid=test1,ou=People,dc=example,dc=org" /tmp/test-write.txt; then echo exit 1; fi
70
+ - name : chaos tests
71
+ shell : bash
72
+ run : |
73
+ echo "test access to openldap database"
74
+ for i in {1..20}; do LDAPTLS_REQCERT=never ldapsearch -o nettimeout=20 -x -D 'cn=admin,dc=example,dc=org' -w Not@SecurePassw0rd -H ldaps://localhost:30636 -b 'dc=example,dc=org' && sleep 60 ; done
0 commit comments