-
Notifications
You must be signed in to change notification settings - Fork 30
/
.travis.sh
66 lines (61 loc) · 1.8 KB
/
.travis.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
TEST_FLAGS=''
if [ $TRAVIS_PYTHON_VERSION == '3.6' -o $TRAVIS_PYTHON_VERSION == '3.7' ]; then
TEST_FLAGS='-v --locals'
fi
echo "Running File backend tests"
python test.py $TEST_FLAGS
E_FILE=$?
echo "Exited with $E_FILE"
echo 'travis_fold:start:File_backend'
cat test.log
echo 'travis_fold:end:File_backend'
rm -f test.log
echo
echo "Running MySQL backend tests"
mysql -e 'CREATE DATABASE totpcgi;'
mysql totpcgi < contrib/mysql.sql
mysql_connect_host='localhost' \
mysql_connect_db='totpcgi' \
mysql_connect_user='travis' \
mysql_connect_password='' \
python test.py $TEST_FLAGS
E_MYSQL=$?
echo "Exited with $E_MYSQL"
echo 'travis_fold:start:MySQL_backend'
cat test.log
echo 'travis_fold:end:MySQL_backend'
rm -f test.log
echo
echo "Running PostgreSQL backend tests"
psql -U postgres -c 'create database totpcgi;'
psql -U postgres -d totpcgi -f contrib/postgres.sql
pg_connect_string='postgresql://localhost/totpcgi' \
python test.py $TEST_FLAGS
E_PSQL=$?
echo "Exited with $E_PSQL"
echo 'travis_fold:start:PostgreSQL_backend'
cat test.log
echo 'travis_fold:end:PostgreSQL_backend'
rm -f test.log
echo
echo "Running LDAP backend tests"
mkdir /tmp/slapd
slapd -f test/ldap/slapd.conf -h ldap://localhost:3389 &
sleep 3
ldapadd -h localhost:3389 -D cn=admin,dc=example,dc=com -w test -f test/ldap/base.ldif
ldapadd -h localhost:3389 -D cn=admin,dc=example,dc=com -w test -f test/ldap/valid.ldif
ldap_url='ldap://localhost:3389' \
ldap_dn='cn=$username,dc=example,dc=com' \
ldap_cacert='' \
ldap_user='valid' \
ldap_password='wakkawakka' \
python test.py $TEST_FLAGS
E_LDAP=$?
echo "Exited with $E_LDAP"
echo 'travis_fold:start:LDAP_backend'
cat test.log
echo 'travis_fold:end:LDAP_backend'
if [ $E_FILE -gt 0 -o $E_MYSQL -gt 0 -o $E_PSQL -gt 0 -o $E_LDAP -gt 0 ]; then
exit 1
fi