This repository has been archived by the owner on Jan 9, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathentrypoint_test.sh
executable file
·111 lines (102 loc) · 5.68 KB
/
entrypoint_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
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
109
110
111
#!/bin/sh -e
function clean() {
unset VCAP_APPLICATION
unset HTTPS_PROXYHOST
unset HTTPS_PROXYPORT
unset HTTPS_PROXYUSER
unset HTTPS_PROXYPASSWORD
unset CUSTOM_OPTIONS
unset CUSTOM_HOSTNAMES
}
function itStartsUpTheServerWithOneRoute() {
clean
export VCAP_APPLICATION='{"instance_id":"fe98dc76ba549876543210abcd1234","instance_index":0,"host":"0.0.0.0","port":61857,"started_at":"2013-08-1200:05:29 +0000","started_at_timestamp":1376265929,"start":"2013-08-12 00:05:29+0000","state_timestamp":1376265929,"limits":{"mem":512,"disk":1024,"fds":16384},"application_version":"ab12cd34-5678-abcd-0123-abcdef987654","application_name":"jb-testserver","application_uris":["myfirst.route"],"version":"ab12cd34-5678-abcd-0123-abcdef987654","name":"my-app","uris":["myfirst.route"],"users":null}'
result=$(exec ${USER_HOME}/entrypoint.sh)
if [ "$result" != "Called mock with: configure --listen 0.0.0.0 --port 8111 --jetty.virtualHosts.names=myfirst.route --temp-dir /home/jetbrains/license-server/temp
Called mock with: run
Called mock with: run" ]; then
echo "Does not start up the server as expected: $result"
exit 1
fi
}
function itStartsUpTheServerWithMultipleRoutes() {
clean
export VCAP_APPLICATION='{"instance_id":"fe98dc76ba549876543210abcd1234","instance_index":0,"host":"0.0.0.0","port":61857,"started_at":"2013-08-1200:05:29 +0000","started_at_timestamp":1376265929,"start":"2013-08-12 00:05:29+0000","state_timestamp":1376265929,"limits":{"mem":512,"disk":1024,"fds":16384},"application_version":"ab12cd34-5678-abcd-0123-abcdef987654","application_name":"jb-testserver","application_uris":["myfirst.route","mysecond.route"],"version":"ab12cd34-5678-abcd-0123-abcdef987654","name":"my-app","uris":["myfirst.route","mysecond.route"],"users":null}'
result=$(exec ${USER_HOME}/entrypoint.sh)
if [ "$result" != "Called mock with: configure --listen 0.0.0.0 --port 8111 --jetty.virtualHosts.names=myfirst.route,mysecond.route --temp-dir /home/jetbrains/license-server/temp
Called mock with: run
Called mock with: run" ]; then
echo "Does not start up the server as expected: $result"
exit 1
fi
}
function itUsesApplicationUris() {
clean
export VCAP_APPLICATION='{"someOtherArray":["somethingElse"],"application_uris":["myfirst.route","mysecond.route"],"uris":["not.this.route","not.this.route2"]}'
result=$(exec ${USER_HOME}/entrypoint.sh)
if [ "$result" != "Called mock with: configure --listen 0.0.0.0 --port 8111 --jetty.virtualHosts.names=myfirst.route,mysecond.route --temp-dir /home/jetbrains/license-server/temp
Called mock with: run
Called mock with: run" ]; then
echo "Didn't use the application_uris: $result"
exit 1
fi
}
function itCommunicatesViaHttpsProxyIfProvided() {
clean
export HTTPS_PROXYHOST='myCompanys.proxy'
export HTTPS_PROXYPORT='8443'
export VCAP_APPLICATION='{"someOtherArray":["somethingElse"],"application_uris":["myfirst.route","mysecond.route"],"uris":["not.this.route","not.this.route2"]}'
result=$(exec ${USER_HOME}/entrypoint.sh)
if [ "$result" != "Called mock with: configure --listen 0.0.0.0 --port 8111 --jetty.virtualHosts.names=myfirst.route,mysecond.route --temp-dir /home/jetbrains/license-server/temp -J-Dhttps.proxyHost=myCompanys.proxy -J-Dhttps.proxyPort=8443
Called mock with: run
Called mock with: run" ]; then
echo "Didn't use the https proxy server: $result"
exit 1
fi
}
function itCommunicatesViaSecuredHttpsProxyIfProvided() {
clean
export HTTPS_PROXYUSER='myUser'
export HTTPS_PROXYPASSWORD='myPassword'
export HTTPS_PROXYHOST='myCompanys.proxy'
export HTTPS_PROXYPORT='8443'
export VCAP_APPLICATION='{"someOtherArray":["somethingElse"],"application_uris":["myfirst.route","mysecond.route"],"uris":["not.this.route","not.this.route2"]}'
result=$(exec ${USER_HOME}/entrypoint.sh)
if [ "$result" != "Called mock with: configure --listen 0.0.0.0 --port 8111 --jetty.virtualHosts.names=myfirst.route,mysecond.route --temp-dir /home/jetbrains/license-server/temp -J-Dhttps.proxyHost=myCompanys.proxy -J-Dhttps.proxyPort=8443 -J-Dhttps.proxyUser=myUser -J-Dhttps.proxyPassword=myPassword
Called mock with: run
Called mock with: run" ]; then
echo "Didn't use the secured https proxy server: $result"
exit 1
fi
}
function itAddsCustomOptionsApplicationUris() {
clean
export CUSTOM_OPTIONS='THIS_IS_CUSTOM'
export VCAP_APPLICATION='{"someOtherArray":["somethingElse"],"application_uris":["myfirst.route","mysecond.route"],"uris":["not.this.route","not.this.route2"]}'
result=$(exec ${USER_HOME}/entrypoint.sh)
if [ "$result" != "Called mock with: configure --listen 0.0.0.0 --port 8111 --jetty.virtualHosts.names=myfirst.route,mysecond.route --temp-dir /home/jetbrains/license-server/temp THIS_IS_CUSTOM
Called mock with: run
Called mock with: run" ]; then
echo "Didn't add custom options: $result"
exit 1
fi
}
function itAddsCustomOptionsApplicationUrisWithCustomHostname() {
clean
export CUSTOM_HOSTNAMES='custom.host,second.custom'
export VCAP_APPLICATION='{"someOtherArray":["somethingElse"],"application_uris":["myfirst.route","mysecond.route"],"uris":["not.this.route","not.this.route2"]}'
result=$(exec ${USER_HOME}/entrypoint.sh)
if [ "$result" != "Called mock with: configure --listen 0.0.0.0 --port 8111 --jetty.virtualHosts.names=myfirst.route,mysecond.route,custom.host,second.custom --temp-dir /home/jetbrains/license-server/temp
Called mock with: run
Called mock with: run" ]; then
echo "Didn't add custom hostnames: $result"
exit 1
fi
}
itStartsUpTheServerWithOneRoute
itStartsUpTheServerWithMultipleRoutes
itUsesApplicationUris
itCommunicatesViaHttpsProxyIfProvided
itCommunicatesViaSecuredHttpsProxyIfProvided
itAddsCustomOptionsApplicationUris
itAddsCustomOptionsApplicationUrisWithCustomHostname