This repository has been archived by the owner on Apr 25, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathe2e.sh
executable file
·66 lines (51 loc) · 1.58 KB
/
e2e.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
#!/usr/bin/env bash
set -o nounset -o pipefail -o errexit
export PROJECT_NAME='dashboard'
renameComposeContainer() {
local serviceNum=1
for container in $(docker-compose -p "${PROJECT_NAME}" -f docker-compose.yml ps -q); do
local serviceName=$(docker-compose -p "${PROJECT_NAME}" -f docker-compose.yml ps --services | sed "${serviceNum}q;d")
docker rename "${container}" "${PROJECT_NAME}_${serviceName}"
((serviceNum++))
done
}
main() {
echo Starting Dashboard with local configuration
go run cmd/compose/compose.go \
-authBasic \
-domain=:1080 \
-environment="e2e" \
-github=false \
-mailer=false \
-selenium=true \
-tls=false \
-tracing=false \
-rollbar=false \
-traefik=false \
-version=$(git rev-parse --short HEAD) \
> docker-compose.yml
go get github.com/ViBiOh/auth/cmd/bcrypt
export ADMIN_PASSWORD=$(bcrypt admin)
docker-compose -p "${PROJECT_NAME}" -f docker-compose.yml up -d
renameComposeContainer
set +e
echo Running e2e tests
docker run \
-it \
--rm \
--network "${PROJECT_NAME}_default" \
--link "${PROJECT_NAME}_selenium":selenium \
-v $(pwd)/e2e:/tests codeception/codeceptjs \
codeceptjs run-multiple --all
result=$?
set -e
if [[ "${result}" != "0" ]]; then
echo Checking logs on failure
docker-compose -p "${PROJECT_NAME}" -f docker-compose.yml logs
fi
echo Stopping started containers
docker-compose -p "${PROJECT_NAME}" -f docker-compose.yml stop
docker-compose -p "${PROJECT_NAME}" -f docker-compose.yml rm -f -v
exit $result
}
main "${@}"