-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·52 lines (43 loc) · 1.28 KB
/
test.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
#!/usr/bin/env bash
set -o errexit
# xtrace turned on only within the travis folds
start() { echo travis_fold':'start:$1; echo $1; set -v; }
end() { set +v; echo travis_fold':'end:$1; echo; echo; }
die() { set +v; echo "$*" 1>&2 ; exit 1; }
retry() {
TRIES=1
until curl --silent --fail http://localhost:$PORT/ > /tmp/response.txt; do
echo "$TRIES: not up yet"
if (( $TRIES > 10 )); then
$OPT_SUDO docker logs $CONTAINER_NAME
die "HTTP requests to app never succeeded"
fi
(( TRIES++ ))
sleep 1
done
echo 'Container responded with:'
head -n50 /tmp/response.txt
}
source environment.sh
start doctest
python -m doctest context/*.py && echo 'doctests pass' || die 'Fix doctests'
end doctest
start format
flake8 context || die "Run 'autopep8 --in-place -r context'"
end format
start docker_build
./docker_build.sh
end docker_build
start docker_run
./docker_run.sh
retry
echo "docker is responsive"
EXPECTED_FILE='fixtures/expected-outside_data.js'
ACTUAL_TEXT=`curl http://localhost:8888/outside_data.js`
diff $EXPECTED_FILE <(echo "$ACTUAL_TEXT") \
|| die "Did not find expected $EXPECTED_FILE; Perhaps update to:
$ACTUAL_TEXT"
docker stop $CONTAINER_NAME
docker rm $CONTAINER_NAME
echo "container cleaned up"
end docker_run