Skip to content

Commit 0ba84ed

Browse files
Merge pull request #16911 from stevekuznetsov/skuznets/global-junit
Automatic merge from submit-queue (batch tested with PRs 16888, 16911, 16913, 16904). Parse $JUNIT_REPORT=true in the Bash init script Signed-off-by: Steve Kuznetsov <[email protected]> /cc @csrwng /test origin-verify
2 parents 91ca5a4 + fde93bc commit 0ba84ed

14 files changed

+8
-58
lines changed

hack/lib/init.sh

+5
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,9 @@ os::util::environment::update_path_var
5252

5353
if [[ -z "${OS_TMP_ENV_SET-}" ]]; then
5454
os::util::environment::setup_tmpdir_vars "$( basename "$0" ".sh" )"
55+
fi
56+
57+
# Allow setting $JUNIT_REPORT to toggle output behavior
58+
if [[ -n "${JUNIT_REPORT:-}" ]]; then
59+
export JUNIT_REPORT_OUTPUT="${LOG_DIR}/raw_test_output.log"
5560
fi

hack/test-cmd.sh

-5
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@ export NETWORK_PLUGIN='redhat/openshift-ovs-multitenant'
4545
os::cleanup::tmpdir
4646
os::util::environment::setup_all_server_vars
4747

48-
# Allow setting $JUNIT_REPORT to toggle output behavior
49-
if [[ -n "${JUNIT_REPORT:-}" ]]; then
50-
export JUNIT_REPORT_OUTPUT="${LOG_DIR}/raw_test_output.log"
51-
fi
52-
5348
echo "Logging to ${LOG_DIR}..."
5449

5550
os::log::system::start

hack/test-end-to-end-docker.sh

-5
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ os::util::environment::setup_all_server_vars
1414
os::util::environment::setup_time_vars
1515
export HOME="${FAKE_HOME_DIR}"
1616

17-
# Allow setting $JUNIT_REPORT to toggle output behavior
18-
if [[ -n "${JUNIT_REPORT:-}" ]]; then
19-
export JUNIT_REPORT_OUTPUT="${LOG_DIR}/raw_test_output.log"
20-
fi
21-
2217
function cleanup() {
2318
return_code=$?
2419

hack/test-end-to-end.sh

-5
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ os::util::environment::use_sudo
3434
os::cleanup::tmpdir
3535
os::util::environment::setup_all_server_vars
3636

37-
# Allow setting $JUNIT_REPORT to toggle output behavior
38-
if [[ -n "${JUNIT_REPORT:-}" ]]; then
39-
export JUNIT_REPORT_OUTPUT="${LOG_DIR}/raw_test_output.log"
40-
fi
41-
4237
os::log::system::start
4338

4439
os::start::configure_server

hack/test-go.sh

+3-5
Original file line numberDiff line numberDiff line change
@@ -175,16 +175,14 @@ fi
175175
if [[ -n "${junit_report}" ]]; then
176176
# we need to generate jUnit xml
177177

178-
test_output_file="${LOG_DIR}/test-go.log"
179-
export JUNIT_REPORT_OUTPUT="${test_output_file}"
180178
test_error_file="${LOG_DIR}/test-go-err.log"
181179

182180
os::log::info "Running \`go test\`..."
183181
# we don't care if the `go test` fails in this pipe, as we want to generate the report and summarize the output anyway
184182
set +o pipefail
185183

186184
go test -i ${gotest_flags} ${test_packages}
187-
go test ${gotest_flags} ${test_packages} 2>"${test_error_file}" | tee "${test_output_file}"
185+
go test ${gotest_flags} ${test_packages} 2>"${test_error_file}" | tee "${JUNIT_REPORT_OUTPUT}"
188186

189187
test_return_code="${PIPESTATUS[0]}"
190188

@@ -195,8 +193,8 @@ if [[ -n "${junit_report}" ]]; then
195193
$( cat "${test_error_file}") "
196194
fi
197195

198-
if grep -q 'WARNING: DATA RACE' "${test_output_file}"; then
199-
locations=( $( sed -n '/WARNING: DATA RACE/=' "${test_output_file}") )
196+
if grep -q 'WARNING: DATA RACE' "${JUNIT_REPORT_OUTPUT}"; then
197+
locations=( $( sed -n '/WARNING: DATA RACE/=' "${JUNIT_REPORT_OUTPUT}") )
200198
if [[ "${#locations[@]}" -gt 1 ]]; then
201199
os::log::warning "\`go test\` detected data races."
202200
os::log::warning "Details can be found in the full output file at lines ${locations[*]}."

hack/test-util.sh

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ trap os::test::junit::reconcile_output EXIT
66
os::cleanup::tmpdir
77
os::util::environment::setup_all_server_vars
88
export HOME="${FAKE_HOME_DIR}"
9-
export JUNIT_REPORT_OUTPUT="${LOG_DIR}/raw_test_output.log"
109

1110
# set verbosity so we can see that command output renders correctly
1211
VERBOSE=1

test/extended/alternate_certs.sh

-5
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ os::log::info "Server logs will be at: ${LOG_DIR}/openshift.log"
2121
os::log::info "Test artifacts will be in: ${ARTIFACT_DIR}"
2222
os::log::info "Config dir is: ${SERVER_CONFIG_DIR}"
2323

24-
# Allow setting $JUNIT_REPORT to toggle output behavior
25-
if [[ -n "${JUNIT_REPORT:-}" ]]; then
26-
export JUNIT_REPORT_OUTPUT="${LOG_DIR}/raw_test_output.log"
27-
fi
28-
2924
mkdir -p ${LOG_DIR}
3025

3126
os::log::info "Scan of OpenShift related processes already up via ps -ef | grep openshift : "

test/extended/alternate_launches.sh

-5
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@ os::log::info "Config dir is: ${SERVER_CONFIG_DIR}"
3030
os::log::info "Using images: ${USE_IMAGES}"
3131
os::log::info "MasterIP is: ${MASTER_ADDR}"
3232

33-
# Allow setting $JUNIT_REPORT to toggle output behavior
34-
if [[ -n "${JUNIT_REPORT:-}" ]]; then
35-
export JUNIT_REPORT_OUTPUT="${LOG_DIR}/raw_test_output.log"
36-
fi
37-
3833
mkdir -p ${LOG_DIR}
3934

4035
os::log::info "Scan of OpenShift related processes already up via ps -ef | grep openshift : "

test/extended/clusterup.sh

-5
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22
source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh"
33
os::util::environment::setup_all_server_vars "test-extended/clusterup"
44

5-
# Allow setting $JUNIT_REPORT to toggle output behavior
6-
if [[ -n "${JUNIT_REPORT:-}" ]]; then
7-
export JUNIT_REPORT_OUTPUT="${LOG_DIR}/raw_test_output.log"
8-
fi
9-
105
os::util::ensure::built_binary_exists 'oc'
116
os::util::environment::use_sudo
127

test/extended/cmd.sh

-5
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@ os::log::system::start
3232
os::start::configure_server
3333
os::start::server
3434

35-
# Allow setting $JUNIT_REPORT to toggle output behavior
36-
if [[ -n "${JUNIT_REPORT:-}" ]]; then
37-
export JUNIT_REPORT_OUTPUT="${LOG_DIR}/raw_test_output.log"
38-
fi
39-
4035
export KUBECONFIG="${ADMIN_KUBECONFIG}"
4136

4237
oc login -u system:admin -n default

test/extended/gssapi.sh

-10
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@ os::log::system::start
1717

1818
os::util::ensure::iptables_privileges_exist
1919

20-
# Allow setting $JUNIT_REPORT to toggle output behavior
21-
if [[ -n "${JUNIT_REPORT:-}" ]]; then
22-
export JUNIT_REPORT_OUTPUT="${LOG_DIR}/raw_test_output.log"
23-
fi
24-
2520
# Always keep containers' raw output for simplicity
2621
junit_gssapi_output="${LOG_DIR}/raw_test_output_gssapi.log"
2722

@@ -53,11 +48,6 @@ cp "${SERVER_CONFIG_DIR}/master/master-config.yaml" "${SERVER_CONFIG_DIR}/master
5348
openshift ex config patch "${SERVER_CONFIG_DIR}/master/master-config.tmp.yaml" --patch="${oauth_patch}" > "${SERVER_CONFIG_DIR}/master/master-config.yaml"
5449
os::start::server
5550

56-
# Allow setting $JUNIT_REPORT to toggle output behavior
57-
if [[ -n "${JUNIT_REPORT:-}" ]]; then
58-
export JUNIT_REPORT_OUTPUT="${LOG_DIR}/raw_test_output.log"
59-
fi
60-
6151
export KUBECONFIG="${ADMIN_KUBECONFIG}"
6252

6353
os::start::registry

test/extended/ldap_groups.sh

-5
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@ os::log::system::start
2929
os::start::configure_server
3030
os::start::server
3131

32-
# Allow setting $JUNIT_REPORT to toggle output behavior
33-
if [[ -n "${JUNIT_REPORT:-}" ]]; then
34-
export JUNIT_REPORT_OUTPUT="${LOG_DIR}/raw_test_output.log"
35-
fi
36-
3732
export KUBECONFIG="${ADMIN_KUBECONFIG}"
3833

3934
os::start::registry

test/extended/networking.sh

-1
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,6 @@ else
368368

369369
# Allow setting $JUNIT_REPORT to toggle output behavior
370370
if [[ -n "${JUNIT_REPORT:-}" ]]; then
371-
export JUNIT_REPORT_OUTPUT="${LOG_DIR}/raw_test_output.log"
372371
# the Ginkgo tests also generate jUnit but expect different envars
373372
export TEST_REPORT_DIR="${ARTIFACT_DIR}/junit"
374373
mkdir -p $TEST_REPORT_DIR

test/extended/setup.sh

-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ function os::test::extended::setup () {
4848

4949
# Allow setting $JUNIT_REPORT to toggle output behavior
5050
if [[ -n "${JUNIT_REPORT:-}" ]]; then
51-
export JUNIT_REPORT_OUTPUT="${LOG_DIR}/raw_test_output.log"
5251
# the Ginkgo tests also generate jUnit but expect different envars
5352
export TEST_REPORT_DIR="${ARTIFACT_DIR}/junit"
5453
mkdir -p $TEST_REPORT_DIR

0 commit comments

Comments
 (0)