forked from Kong/docker-kong
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.sh
executable file
·48 lines (38 loc) · 1.32 KB
/
tests.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
#!/bin/bash
set +e
####################################################
# Test the proper version was buid
pushd $BASE
version_given="$(grep 'ENV KONG_VERSION' Dockerfile | awk '{print $3}' | tr -d '[:space:]')"
version_built="$(docker run -ti --rm kong-$BASE kong version | tr -d '[:space:]')"
if [[ "$version_given" != "$version_built" ]]; then
echo "Kong version mismatch:";
echo "\tVersion given is $version_given";
echo "\tVersion built is $version_built";
exit 1;
fi
####################################################
# Test LuaRocks is functional for installing rocks
docker run -ti kong-$BASE luarocks install version
popd
####################################################
# Validate Kong is running as the Kong user
pushd compose
docker-compose up -d
until docker-compose ps | grep compose_kong_1 | grep -q "Up"; do sleep 1; done
docker-compose exec kong ps aux | sed -n 2p | grep -q kong
if [ $? -ne 0 ]; then
echo "Kong is not running as the Kong user";
echo "\tRunning instead as ";
docker-compose exec kong ps aux | sed -n 2p
exit 1;
fi
popd
#####################################################
# Run Kong functional tests
git clone https://github.com/Kong/kong.git
pushd kong
git checkout $version_given
popd
pushd kong-build-tools
TEST_HOST=`hostname --ip-address` KONG_VERSION=$version_given make run_tests