Skip to content

Commit

Permalink
Merge pull request #16911 from stevekuznetsov/skuznets/global-junit
Browse files Browse the repository at this point in the history
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 <skuznets@redhat.com>

/cc @csrwng

/test origin-verify
  • Loading branch information
openshift-merge-robot authored Oct 18, 2017
2 parents 91ca5a4 + fde93bc commit 0ba84ed
Show file tree
Hide file tree
Showing 14 changed files with 8 additions and 58 deletions.
5 changes: 5 additions & 0 deletions hack/lib/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 0 additions & 5 deletions hack/test-cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions hack/test-end-to-end-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=$?

Expand Down
5 changes: 0 additions & 5 deletions hack/test-end-to-end.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 3 additions & 5 deletions hack/test-go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -175,16 +175,14 @@ 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\`..."
# we don't care if the `go test` fails in this pipe, as we want to generate the report and summarize the output anyway
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]}"

Expand All @@ -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[*]}."
Expand Down
1 change: 0 additions & 1 deletion hack/test-util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions test/extended/alternate_certs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 : "
Expand Down
5 changes: 0 additions & 5 deletions test/extended/alternate_launches.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 : "
Expand Down
5 changes: 0 additions & 5 deletions test/extended/clusterup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 0 additions & 5 deletions test/extended/cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 0 additions & 10 deletions test/extended/gssapi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions test/extended/ldap_groups.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion test/extended/networking.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion test/extended/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0ba84ed

Please sign in to comment.