-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathsimple-python.bats
More file actions
108 lines (75 loc) · 1.64 KB
/
Copy pathsimple-python.bats
File metadata and controls
108 lines (75 loc) · 1.64 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# Integration test for a simple go app
# source environment helpers
. util/env.sh
payload() {
cat <<-END
{
"code_dir": "/tmp/code",
"data_dir": "/data",
"app_dir": "/tmp/app",
"cache_dir": "/tmp/cache",
"etc_dir": "/data/etc",
"env_dir": "/data/etc/env.d",
"config": {}
}
END
}
setup() {
# cd into the engine bin dir
cd /engine/bin
}
@test "setup" {
# prepare environment (create directories etc)
prepare_environment
# prepare pkgsrc
run prepare_pkgsrc
# create the code_dir
mkdir -p /tmp/code
# copy the app into place
cp -ar /test/apps/simple-python/* /tmp/code
run pwd
[ "$output" = "/engine/bin" ]
}
@test "boxfile" {
run /engine/bin/boxfile "$(payload)"
echo "$output"
[ "$status" -eq 0 ]
}
@test "build" {
run /engine/bin/build "$(payload)"
echo "$output"
[ "$status" -eq 0 ]
}
@test "cleanup" {
run /engine/bin/cleanup "$(payload)"
echo "$output"
[ "$status" -eq 0 ]
}
@test "release" {
run /engine/bin/release "$(payload)"
echo "$output"
[ "$status" -eq 0 ]
}
@test "verify" {
# remove the code dir
rm -rf /tmp/code
# mv the app_dir to code_dir
mv /tmp/app /tmp/code
# cd into the app code_dir
cd /tmp/code
# source the profile.d/pip.sh env
source /data/etc/profile.d/pip.sh
# start the server in the background
/tmp/code/.nanobox/pip/bin/gunicorn -b 0.0.0.0:8080 app:wsgiapp &
# grab the pid
pid=$!
# sleep a few seconds so the server can start
sleep 3
# curl the index
run curl -s 127.0.0.1:8080 2>/dev/null
expected="Hello, World!"
# kill the server
kill -9 $pid > /dev/null 2>&1
echo "$output"
[ "$output" = "$expected" ]
}