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