Skip to content

Commit 493c3d4

Browse files
BobgyArk-kun
authored andcommitted
[testing] Fix e2e tests timed out, but there's empty test log (#2810)
* Wait longer for e2e tests * Let api integration test stream log output while testing * Also fix initialization test * Fix exit code on error * Update test/initialization-test/run_test.sh Co-Authored-By: Alexey Volkov <avolkov@google.com> * Update according to CR Co-authored-by: Alexey Volkov <alexey.volkov@ark-kun.com>
1 parent 10a4f55 commit 493c3d4

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

test/api-integration-test/run_test.sh

+6-5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# limitations under the License.
1616

1717
set -xe
18+
set -o pipefail
1819

1920
# K8s Namespace that all resources deployed to
2021
NAMESPACE=kubeflow
@@ -64,13 +65,13 @@ cd "${BASE_DIR}/${TEST_DIR}"
6465
export GO111MODULE=on
6566

6667
echo "Run integration test..."
67-
TEST_RESULT=`go test -v ./... -namespace ${NAMESPACE} -args -runIntegrationTests=true 2>&1`
68-
TEST_EXIT_CODE=$?
68+
LOG_FILE=$(mktemp)
69+
# Note, "set -o pipefail" at top of file is required to catch exit code of the pipe.
70+
TEST_EXIT_CODE=0 # reference for how to save exit code: https://stackoverflow.com/a/18622662
71+
go test -v ./... -namespace ${NAMESPACE} -args -runIntegrationTests=true |& tee $LOG_FILE || TEST_EXIT_CODE=$?
6972

70-
# Log the test result
71-
printf '%s\n' "$TEST_RESULT"
7273
# Convert test result to junit.xml
73-
printf '%s\n' "$TEST_RESULT" | go-junit-report > ${JUNIT_TEST_RESULT}
74+
< "$LOG_FILE" go-junit-report > "${JUNIT_TEST_RESULT}"
7475

7576
echo "Copy test result to GCS ${RESULTS_GCS_DIR}/${JUNIT_TEST_RESULT}"
7677
gsutil cp ${JUNIT_TEST_RESULT} ${RESULTS_GCS_DIR}/${JUNIT_TEST_RESULT}

test/initialization-test/run_test.sh

+6-5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# limitations under the License.
1616

1717
set -xe
18+
set -o pipefail
1819

1920
# K8s Namespace that all resources deployed to
2021
NAMESPACE=kubeflow
@@ -64,13 +65,13 @@ cd "${BASE_DIR}/${TEST_DIR}"
6465
export GO111MODULE=on
6566

6667
echo "Run Initialization test..."
67-
TEST_RESULT=`go test -v ./... -namespace ${NAMESPACE} -args -runIntegrationTests=true 2>&1`
68-
TEST_EXIT_CODE=$?
68+
LOG_FILE=$(mktemp)
69+
# Note, "set -o pipefail" at top of file is required to catch exit code of the pipe.
70+
TEST_EXIT_CODE=0 # reference for how to save exit code: https://stackoverflow.com/a/18622662
71+
go test -v ./... -namespace ${NAMESPACE} -args -runIntegrationTests=true |& tee $LOG_FILE || TEST_EXIT_CODE=$?
6972

70-
# Log the test result
71-
printf '%s\n' "$TEST_RESULT"
7273
# Convert test result to junit.xml
73-
printf '%s\n' "$TEST_RESULT" | go-junit-report > ${JUNIT_TEST_RESULT}
74+
< "$LOG_FILE" go-junit-report > "${JUNIT_TEST_RESULT}"
7475

7576
echo "Copy test result to GCS ${RESULTS_GCS_DIR}/${JUNIT_TEST_RESULT}"
7677
gsutil cp ${JUNIT_TEST_RESULT} ${RESULTS_GCS_DIR}/${JUNIT_TEST_RESULT}

test/presubmit-tests-with-pipeline-deployment.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ usage()
3131
PLATFORM=gcp
3232
PROJECT=ml-pipeline-test
3333
TEST_RESULT_BUCKET=ml-pipeline-test
34-
TIMEOUT_SECONDS=1800
34+
TIMEOUT_SECONDS=1800 # 30 minutes
3535
NAMESPACE=kubeflow
3636
ENABLE_WORKLOAD_IDENTITY=true
3737

0 commit comments

Comments
 (0)