diff --git a/hack/lib/init.sh b/hack/lib/init.sh index 0ba38456012b..26bf38a1567f 100644 --- a/hack/lib/init.sh +++ b/hack/lib/init.sh @@ -52,4 +52,9 @@ os::util::environment::update_path_var if [[ -z "${OS_TMP_ENV_SET-}" ]]; then os::util::environment::setup_tmpdir_vars "$( basename "$0" ".sh" )" +fi + +# Allow setting $JUNIT_REPORT to toggle output behavior +if [[ -n "${JUNIT_REPORT:-}" ]]; then + export JUNIT_REPORT_OUTPUT="${LOG_DIR}/raw_test_output.log" fi \ No newline at end of file diff --git a/hack/test-cmd.sh b/hack/test-cmd.sh index bb83922cf836..c16d08067b39 100755 --- a/hack/test-cmd.sh +++ b/hack/test-cmd.sh @@ -45,11 +45,6 @@ export NETWORK_PLUGIN='redhat/openshift-ovs-multitenant' os::cleanup::tmpdir os::util::environment::setup_all_server_vars -# Allow setting $JUNIT_REPORT to toggle output behavior -if [[ -n "${JUNIT_REPORT:-}" ]]; then - export JUNIT_REPORT_OUTPUT="${LOG_DIR}/raw_test_output.log" -fi - echo "Logging to ${LOG_DIR}..." os::log::system::start diff --git a/hack/test-end-to-end-docker.sh b/hack/test-end-to-end-docker.sh index 4acc5b60b191..dfa21d1074d2 100755 --- a/hack/test-end-to-end-docker.sh +++ b/hack/test-end-to-end-docker.sh @@ -14,11 +14,6 @@ os::util::environment::setup_all_server_vars os::util::environment::setup_time_vars export HOME="${FAKE_HOME_DIR}" -# Allow setting $JUNIT_REPORT to toggle output behavior -if [[ -n "${JUNIT_REPORT:-}" ]]; then - export JUNIT_REPORT_OUTPUT="${LOG_DIR}/raw_test_output.log" -fi - function cleanup() { return_code=$? diff --git a/hack/test-end-to-end.sh b/hack/test-end-to-end.sh index 39ae8bfdab94..97ce1c5bbaf1 100755 --- a/hack/test-end-to-end.sh +++ b/hack/test-end-to-end.sh @@ -34,11 +34,6 @@ os::util::environment::use_sudo os::cleanup::tmpdir os::util::environment::setup_all_server_vars -# Allow setting $JUNIT_REPORT to toggle output behavior -if [[ -n "${JUNIT_REPORT:-}" ]]; then - export JUNIT_REPORT_OUTPUT="${LOG_DIR}/raw_test_output.log" -fi - os::log::system::start os::start::configure_server diff --git a/hack/test-go.sh b/hack/test-go.sh index f26a70efcda7..ebd51e7318db 100755 --- a/hack/test-go.sh +++ b/hack/test-go.sh @@ -175,8 +175,6 @@ fi if [[ -n "${junit_report}" ]]; then # we need to generate jUnit xml - test_output_file="${LOG_DIR}/test-go.log" - export JUNIT_REPORT_OUTPUT="${test_output_file}" test_error_file="${LOG_DIR}/test-go-err.log" os::log::info "Running \`go test\`..." @@ -184,7 +182,7 @@ if [[ -n "${junit_report}" ]]; then set +o pipefail go test -i ${gotest_flags} ${test_packages} - go test ${gotest_flags} ${test_packages} 2>"${test_error_file}" | tee "${test_output_file}" + go test ${gotest_flags} ${test_packages} 2>"${test_error_file}" | tee "${JUNIT_REPORT_OUTPUT}" test_return_code="${PIPESTATUS[0]}" @@ -195,8 +193,8 @@ if [[ -n "${junit_report}" ]]; then $( cat "${test_error_file}") " fi - if grep -q 'WARNING: DATA RACE' "${test_output_file}"; then - locations=( $( sed -n '/WARNING: DATA RACE/=' "${test_output_file}") ) + if grep -q 'WARNING: DATA RACE' "${JUNIT_REPORT_OUTPUT}"; then + locations=( $( sed -n '/WARNING: DATA RACE/=' "${JUNIT_REPORT_OUTPUT}") ) if [[ "${#locations[@]}" -gt 1 ]]; then os::log::warning "\`go test\` detected data races." os::log::warning "Details can be found in the full output file at lines ${locations[*]}." diff --git a/hack/test-util.sh b/hack/test-util.sh index 5afb33f27bb6..ea608ad90943 100755 --- a/hack/test-util.sh +++ b/hack/test-util.sh @@ -6,7 +6,6 @@ trap os::test::junit::reconcile_output EXIT os::cleanup::tmpdir os::util::environment::setup_all_server_vars export HOME="${FAKE_HOME_DIR}" -export JUNIT_REPORT_OUTPUT="${LOG_DIR}/raw_test_output.log" # set verbosity so we can see that command output renders correctly VERBOSE=1 diff --git a/test/extended/alternate_certs.sh b/test/extended/alternate_certs.sh index b91327605511..4bf0bbd89fc7 100755 --- a/test/extended/alternate_certs.sh +++ b/test/extended/alternate_certs.sh @@ -21,11 +21,6 @@ os::log::info "Server logs will be at: ${LOG_DIR}/openshift.log" os::log::info "Test artifacts will be in: ${ARTIFACT_DIR}" os::log::info "Config dir is: ${SERVER_CONFIG_DIR}" -# Allow setting $JUNIT_REPORT to toggle output behavior -if [[ -n "${JUNIT_REPORT:-}" ]]; then - export JUNIT_REPORT_OUTPUT="${LOG_DIR}/raw_test_output.log" -fi - mkdir -p ${LOG_DIR} os::log::info "Scan of OpenShift related processes already up via ps -ef | grep openshift : " diff --git a/test/extended/alternate_launches.sh b/test/extended/alternate_launches.sh index b040297052e7..f159c75060da 100755 --- a/test/extended/alternate_launches.sh +++ b/test/extended/alternate_launches.sh @@ -30,11 +30,6 @@ os::log::info "Config dir is: ${SERVER_CONFIG_DIR}" os::log::info "Using images: ${USE_IMAGES}" os::log::info "MasterIP is: ${MASTER_ADDR}" -# Allow setting $JUNIT_REPORT to toggle output behavior -if [[ -n "${JUNIT_REPORT:-}" ]]; then - export JUNIT_REPORT_OUTPUT="${LOG_DIR}/raw_test_output.log" -fi - mkdir -p ${LOG_DIR} os::log::info "Scan of OpenShift related processes already up via ps -ef | grep openshift : " diff --git a/test/extended/clusterup.sh b/test/extended/clusterup.sh index d9dab445233e..8b880c871bae 100755 --- a/test/extended/clusterup.sh +++ b/test/extended/clusterup.sh @@ -2,11 +2,6 @@ source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh" os::util::environment::setup_all_server_vars "test-extended/clusterup" -# Allow setting $JUNIT_REPORT to toggle output behavior -if [[ -n "${JUNIT_REPORT:-}" ]]; then - export JUNIT_REPORT_OUTPUT="${LOG_DIR}/raw_test_output.log" -fi - os::util::ensure::built_binary_exists 'oc' os::util::environment::use_sudo diff --git a/test/extended/cmd.sh b/test/extended/cmd.sh index c7d70adacd08..7b18013d1c0e 100755 --- a/test/extended/cmd.sh +++ b/test/extended/cmd.sh @@ -32,11 +32,6 @@ os::log::system::start os::start::configure_server os::start::server -# Allow setting $JUNIT_REPORT to toggle output behavior -if [[ -n "${JUNIT_REPORT:-}" ]]; then - export JUNIT_REPORT_OUTPUT="${LOG_DIR}/raw_test_output.log" -fi - export KUBECONFIG="${ADMIN_KUBECONFIG}" oc login -u system:admin -n default diff --git a/test/extended/gssapi.sh b/test/extended/gssapi.sh index 29754815b5d2..82c8505e8d13 100755 --- a/test/extended/gssapi.sh +++ b/test/extended/gssapi.sh @@ -17,11 +17,6 @@ os::log::system::start os::util::ensure::iptables_privileges_exist -# Allow setting $JUNIT_REPORT to toggle output behavior -if [[ -n "${JUNIT_REPORT:-}" ]]; then - export JUNIT_REPORT_OUTPUT="${LOG_DIR}/raw_test_output.log" -fi - # Always keep containers' raw output for simplicity junit_gssapi_output="${LOG_DIR}/raw_test_output_gssapi.log" @@ -53,11 +48,6 @@ cp "${SERVER_CONFIG_DIR}/master/master-config.yaml" "${SERVER_CONFIG_DIR}/master openshift ex config patch "${SERVER_CONFIG_DIR}/master/master-config.tmp.yaml" --patch="${oauth_patch}" > "${SERVER_CONFIG_DIR}/master/master-config.yaml" os::start::server -# Allow setting $JUNIT_REPORT to toggle output behavior -if [[ -n "${JUNIT_REPORT:-}" ]]; then - export JUNIT_REPORT_OUTPUT="${LOG_DIR}/raw_test_output.log" -fi - export KUBECONFIG="${ADMIN_KUBECONFIG}" os::start::registry diff --git a/test/extended/ldap_groups.sh b/test/extended/ldap_groups.sh index 8114f7414cdf..c89dade956c2 100755 --- a/test/extended/ldap_groups.sh +++ b/test/extended/ldap_groups.sh @@ -29,11 +29,6 @@ os::log::system::start os::start::configure_server os::start::server -# Allow setting $JUNIT_REPORT to toggle output behavior -if [[ -n "${JUNIT_REPORT:-}" ]]; then - export JUNIT_REPORT_OUTPUT="${LOG_DIR}/raw_test_output.log" -fi - export KUBECONFIG="${ADMIN_KUBECONFIG}" os::start::registry diff --git a/test/extended/networking.sh b/test/extended/networking.sh index f6d1f3bd41ff..58e899b4f56b 100755 --- a/test/extended/networking.sh +++ b/test/extended/networking.sh @@ -368,7 +368,6 @@ else # Allow setting $JUNIT_REPORT to toggle output behavior if [[ -n "${JUNIT_REPORT:-}" ]]; then - export JUNIT_REPORT_OUTPUT="${LOG_DIR}/raw_test_output.log" # the Ginkgo tests also generate jUnit but expect different envars export TEST_REPORT_DIR="${ARTIFACT_DIR}/junit" mkdir -p $TEST_REPORT_DIR diff --git a/test/extended/setup.sh b/test/extended/setup.sh index 5ec867afdb1e..4b22e1afc38b 100644 --- a/test/extended/setup.sh +++ b/test/extended/setup.sh @@ -48,7 +48,6 @@ function os::test::extended::setup () { # Allow setting $JUNIT_REPORT to toggle output behavior if [[ -n "${JUNIT_REPORT:-}" ]]; then - export JUNIT_REPORT_OUTPUT="${LOG_DIR}/raw_test_output.log" # the Ginkgo tests also generate jUnit but expect different envars export TEST_REPORT_DIR="${ARTIFACT_DIR}/junit" mkdir -p $TEST_REPORT_DIR