@@ -22,7 +22,7 @@ set -o pipefail # don't hide errors within pipes
22
22
nginx_server_proto=" http"
23
23
nginx_server_host=" localhost"
24
24
nginx_server_port=" 8989"
25
- minio_server= " http://localhost:9090 "
25
+
26
26
test_server=" ${nginx_server_proto} ://${nginx_server_host} :${nginx_server_port} "
27
27
test_fail_exit_code=2
28
28
no_dep_exit_code=3
@@ -31,6 +31,12 @@ test_dir="${script_dir}/test"
31
31
test_compose_config=" ${test_dir} /docker-compose.yaml"
32
32
test_compose_project=" ngt"
33
33
34
+ minio_server=" http://localhost:9090"
35
+ minio_user=" AKIAIOSFODNN7EXAMPLE"
36
+ minio_passwd=" wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
37
+ minio_name=" ${test_compose_project} _minio_1"
38
+ minio_bucket=" bucket-1"
39
+
34
40
is_windows=" 0"
35
41
if [ -z " ${OS} " ] && [ " ${OS} " == " Windows_NT" ]; then
36
42
is_windows=" 1"
@@ -137,6 +143,12 @@ if ! [ -x "${curl_cmd}" ]; then
137
143
exit ${no_dep_exit_code}
138
144
fi
139
145
146
+ mc_cmd=" $( command -v mc) "
147
+ if ! [ -x " ${mc_cmd} " ]; then
148
+ e " required dependency not found: mc not found in the path or not executable"
149
+ exit ${no_dep_exit_code}
150
+ fi
151
+
140
152
wait_for_it_cmd=" $( command -v wait-for-it || true) "
141
153
if [ -x " ${wait_for_it_cmd} " ]; then
142
154
wait_for_it_installed=1
@@ -168,16 +180,7 @@ compose() {
168
180
${docker_compose_cmd} -f " ${test_compose_config} " -p " ${test_compose_project} " " $@ "
169
181
}
170
182
171
- integration_test () {
172
- printf " \033[34;1m▶\033[0m"
173
- printf " \e[1m Integration test suite for v%s signatures\e[22m\n" " $1 "
174
- printf " \033[34;1m▶\033[0m"
175
- printf " \e[1m Integration test suite with ALLOW_DIRECTORY_LIST=%s\e[22m\n" " $2 "
176
- printf " \033[34;1m▶\033[0m"
177
- printf " \e[1m Integration test suite with PROVIDE_INDEX_PAGE=%s\e[22m\n" " $3 "
178
- printf " \033[34;1m▶\033[0m"
179
- printf " \e[1m Integration test suite with APPEND_SLASH_FOR_POSSIBLE_DIRECTORY=%s\e[22m\n" " $4 "
180
-
183
+ integration_test_data () {
181
184
182
185
# Write problematic files to disk if we are not on Windows. Originally,
183
186
# these files were checked in, but that prevented the git repository from
@@ -187,23 +190,10 @@ integration_test() {
187
190
echo ' We are but selling water next to a river.' > " ${test_dir} " ' /data/bucket-1/a/%@!*()=$#^&|.txt'
188
191
fi
189
192
190
- # See if Minio is already running, if it isn't then we don't need to build it
191
- # COMPOSE_COMPATIBILITY=true Supports older style compose filenames with _ vs -
192
-
193
- if [ -z " $( docker ps -q -f name=${test_compose_project} _minio-_1) " ]; then
194
- p " Building Docker Compose environment"
195
- COMPOSE_COMPATIBILITY=true AWS_SIGS_VERSION=$1 ALLOW_DIRECTORY_LIST=$2 PROVIDE_INDEX_PAGE=$3 APPEND_SLASH_FOR_POSSIBLE_DIRECTORY=$4 compose up --no-start
196
-
197
- p " Adding test data to container"
198
- echo " Copying contents of ${test_dir} /data to Docker container ${test_compose_project} _minio_1:/"
199
- " ${docker_cmd} " cp " ${test_dir} /data" " ${test_compose_project} " _minio_1:/
200
- echo " Docker diff output:"
201
- " ${docker_cmd} " diff " ${test_compose_project} " _minio_1
202
- fi
203
-
204
193
p " Starting Docker Compose Environment"
205
- COMPOSE_COMPATIBILITY=true AWS_SIGS_VERSION=$1 ALLOW_DIRECTORY_LIST=$2 PROVIDE_INDEX_PAGE=$3 APPEND_SLASH_FOR_POSSIBLE_DIRECTORY=$4 compose up -d
206
-
194
+ # COMPOSE_COMPATIBILITY=true Supports older style compose filenames with _ vs -
195
+ COMPOSE_COMPATIBILITY=true compose up -d
196
+
207
197
if [ " ${wait_for_it_installed} " ]; then
208
198
# Hit minio's health check end point to see if it has started up
209
199
for (( i= 1 ; i<= 3 ; i++ ))
@@ -216,7 +206,32 @@ integration_test() {
216
206
sleep 2
217
207
fi
218
208
done
209
+ fi
210
+
211
+ p " Adding test data to container"
212
+ " ${mc_cmd} " alias set " $minio_name " " $minio_server " " $minio_user " " $minio_passwd "
213
+ " ${mc_cmd} " mb " $minio_name /$minio_bucket "
214
+ echo " Copying contents of ${test_dir} /data/$minio_bucket to Docker container $minio_name "
215
+ " ${mc_cmd} " cp -r " ${test_dir} /data/$minio_bucket /" " $minio_name /"
216
+ echo " Docker diff output:"
217
+ " ${docker_cmd} " diff " $minio_name "
218
+ }
219
+
220
+ integration_test () {
221
+ printf " \033[34;1m▶\033[0m"
222
+ printf " \e[1m Integration test suite for v%s signatures\e[22m\n" " $1 "
223
+ printf " \033[34;1m▶\033[0m"
224
+ printf " \e[1m Integration test suite with ALLOW_DIRECTORY_LIST=%s\e[22m\n" " $2 "
225
+ printf " \033[34;1m▶\033[0m"
226
+ printf " \e[1m Integration test suite with PROVIDE_INDEX_PAGE=%s\e[22m\n" " $3 "
227
+ printf " \033[34;1m▶\033[0m"
228
+ printf " \e[1m Integration test suite with APPEND_SLASH_FOR_POSSIBLE_DIRECTORY=%s\e[22m\n" " $4 "
219
229
230
+ p " Starting Docker Compose Environment"
231
+ # COMPOSE_COMPATIBILITY=true Supports older style compose filenames with _ vs -
232
+ COMPOSE_COMPATIBILITY=true AWS_SIGS_VERSION=$1 ALLOW_DIRECTORY_LIST=$2 PROVIDE_INDEX_PAGE=$3 APPEND_SLASH_FOR_POSSIBLE_DIRECTORY=$4 compose up -d
233
+
234
+ if [ " ${wait_for_it_installed} " ]; then
220
235
if [ -x " ${wait_for_it_cmd} " ]; then
221
236
" ${wait_for_it_cmd} " -h " ${nginx_server_host} " -p " ${nginx_server_port} "
222
237
fi
@@ -247,7 +262,8 @@ finish() {
247
262
248
263
p " Cleaning up Docker compose environment"
249
264
compose stop
250
- compose rm -f
265
+ compose rm -f -v
266
+ " ${mc_cmd} " alias rm " $minio_name "
251
267
252
268
exit ${result}
253
269
}
@@ -352,6 +368,8 @@ runUnitTestWithSessionToken "s3gateway_test.js"
352
368
353
369
# ## INTEGRATION TESTS
354
370
371
+ integration_test_data
372
+
355
373
p " Testing API with AWS Signature V2 and allow directory listing off"
356
374
integration_test 2 0 0 0
357
375
0 commit comments