-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathone.sh
227 lines (205 loc) · 4.82 KB
/
one.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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
#!/bin/bash
# Author: Roman Kharkovski, IBM, blog: http://whywebsphere.com
# ---------------------------- Now we include the utils script
source utils.sh
###############################################
# Test that measures how long it takes to start an existing server that already exists and was started some time before
###############################################
startExistingEmptyServer()
{
# prep work - need to remove any existing old servers, create one, start it and stop it at least once
stop_server
remove_server
create_server
start_server
short_sleep
stop_server
short_sleep
# actual timed test
start_timer
start_server
stop_timer
}
###############################################
# Restart existing server with an app in it deployed earlier
###############################################
restartExistingServerWithApp()
{
# prep work
setup_app $DefaultApp
stop_server
remove_server
create_server
start_server
deploy_old_app
wait_for_app_deploy
long_sleep
# actual timed test
start_timer
stop_server
start_server
wait_for_app_deploy
stop_timer
}
###############################################
# Start existing server without any prep or cleanup of any sort
###############################################
stopWhateverExistingServer()
{
start_timer
stop_server
stop_timer
}
###############################################
# Stop existing server without any cleanup of any sort
###############################################
startWhateverExistingServer()
{
start_timer
start_server
stop_timer
}
###############################################
# Start server without cleanup of deployments
###############################################
startExistingServer()
{
# actual timed test
start_timer
start_server
stop_timer
}
###############################################
# ReStart server without cleanup of deployments
###############################################
restartExistingServer()
{
# actual timed test
start_timer
stop_server
start_server
stop_timer
}
###############################################
# Deploy app into existing and running server
###############################################
deployAppInRunningServer()
{
# prep work
setup_app $DefaultApp
stop_server
remove_server
create_server
start_server
long_sleep
# actual timed test
start_timer
deploy_old_app
wait_for_app_deploy
stop_timer
}
###############################################
# Deploy app into stopped server
###############################################
deployAppAndStartServer()
{
# prep work
setup_app $DefaultApp
stop_server
remove_server
create_server
start_server
short_sleep
undeploy_app
stop_server
short_sleep
# actual timed test
start_timer
deploy_old_app
start_server
wait_for_app_deploy
stop_timer
}
###############################################
# Re-Deploy app in a server
###############################################
redeployJenkins()
{
setup_app $JenkinsApp
redeployAppInRunningServer
}
###############################################
# Re-Deploy app in a server
###############################################
redeployHelloWorld()
{
setup_app $HelloWorldApp
redeployAppInRunningServer
}
###############################################
# Re-Deploy app in a server
###############################################
redeployAppInRunningServer()
{
# prep work
stop_server
remove_server
create_server
start_server
deploy_old_app
wait_for_app_deploy
long_sleep
# actual timed test
start_timer
# undeploy_app
deploy_new_app
# because the app may be quite large, we may need to sleep a little bit
sleep $APP_REDEPLOY_SLEEP
wait_for_app_deploy
stop_timer
}
################################################################
# Run all targets in sequence
################################################################
default_target()
{
echo "Usage: ./run.sh [<server_type> <task_name>]"
echo "<Server_types>"
for RUNTIME in $LIST_OF_SERVERS
do
echo " -$RUNTIME"
done
echo "<Task_names>"
for TASK in $LIST_OF_TASKS
do
echo " -$TASK"
done
echo
exit 1
}
################################################################
# Run one selected task
################################################################
run_test()
{
echo "------------------ Begin test for Runtime='$RUNTIME', Task='$TASK'..."
$TASK
echo "------------------ End of test."
echo -e "$RUNTIME\t$WAR_NAME\t$TASK\t$MEASURED_TIME" >> $RESULTS_FILE
}
################################################################
# Main
################################################################
#echo "$# input arguments provided: $1 $2"
echo
echo "Begin '$BASH_SOURCE' script..."
if [ $# -gt 1 ]; then
RUNTIME=$1
TASK=$2
# ---------------------------- Now we include the script appropriate for whatever server runtime
source $RUNTIME.sh
run_test
else
default_target
fi
echo "The '$BASH_SOURCE' script is done."