2
2
3
3
set -Eeou pipefail
4
4
5
+ test " ${MDB_BASH_DEBUG:- 0} " -eq 1 && set -x
5
6
# #
6
7
# # The script deploys a single test application and waits until it finishes.
7
8
# # All the Operator deployment, configuration and teardown work is done in 'e2e' script
@@ -15,6 +16,23 @@ source scripts/funcs/operator_deployment
15
16
16
17
check_env_var " TEST_NAME" " The 'TEST_NAME' must be specified to run the Operator single e2e test"
17
18
19
+ find_test_file_by_fixture_mark () {
20
+ fixture_mark=" $1 "
21
+
22
+ cd docker/mongodb-kubernetes-tests
23
+ if ! test_files=" $( grep -l -R " mark.${fixture_mark} $" --include ' *.py' ) " ; then
24
+ >&2 echo " Cannot find any test file containing a pytest fixture mark: ${fixture_mark} "
25
+ return 1
26
+ fi
27
+ number_of_files_matched=$( wc -l <<< " ${test_files}" )
28
+ if [[ ${number_of_files_matched} -gt 1 ]]; then
29
+ >&2 echo " Found more than one file with the same pytest fixture mark ${fixture_mark} :"
30
+ grep --color=auto --line-number --recursive -C2 " mark.${fixture_mark} $" --include ' *.py' .
31
+ return 1
32
+ fi
33
+
34
+ echo -n " ${test_files} "
35
+ }
18
36
19
37
deploy_test_app () {
20
38
printenv
@@ -33,12 +51,17 @@ deploy_test_app() {
33
51
BUILD_ID=" ${BUILD_ID:- default_build_id} "
34
52
BUILD_VARIANT=" ${BUILD_VARIANT:- default_build_variant} "
35
53
54
+ if ! test_file=$( find_test_file_by_fixture_mark " ${TASK_NAME} " ) ; then
55
+ return 1
56
+ fi
57
+
36
58
# note, that the 4 last parameters are used only for Mongodb resource testing - not for Ops Manager
37
59
helm_params=(
38
60
" --set" " taskId=${task_id:- ' not-specified' } "
39
61
" --set" " repo=${BASE_REPO_URL:= 268558157000.dkr.ecr.us-east-1.amazonaws.com/ dev} "
40
62
" --set" " namespace=${NAMESPACE} "
41
63
" --set" " taskName=${task_name} "
64
+ " --set" " testFile=${test_file} "
42
65
" --set" " tag=${tag} "
43
66
" --set" " aws.accessKey=${AWS_ACCESS_KEY_ID} "
44
67
" --set" " aws.secretAccessKey=${AWS_SECRET_ACCESS_KEY} "
@@ -128,7 +151,9 @@ deploy_test_app() {
128
151
129
152
helm_params+=(" --set" " opsManagerVersion=${ops_manager_version} " )
130
153
131
- helm template " scripts/evergreen/deployments/test-app" " ${helm_params[@]} " > " ${helm_template_file} " || exit 1
154
+ echo " Executing helm template:"
155
+ echo " helm template scripts/evergreen/deployments/test-app ${helm_params[*]} "
156
+ helm template " scripts/evergreen/deployments/test-app" " ${helm_params[@]} " > " ${helm_template_file} " || return 1
132
157
133
158
cat " ${helm_template_file} "
134
159
@@ -189,7 +214,9 @@ run_tests() {
189
214
190
215
prepare_operator_config_map " ${operator_context} "
191
216
192
- deploy_test_app " ${test_pod_context} "
217
+ if ! deploy_test_app " ${test_pod_context} " ; then
218
+ return 1
219
+ fi
193
220
194
221
wait_until_pod_is_running_or_failed_or_succeeded " ${test_pod_context} "
195
222
0 commit comments