Skip to content

Commit

Permalink
[Feature] [Fix] Ensure Correct Logs Display for Go Test Logs in Build…
Browse files Browse the repository at this point in the history
…kite Runner (#2837)
  • Loading branch information
tinaxfwu authored Feb 9, 2025
1 parent ffa6a30 commit bc17cd9
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 5 deletions.
50 changes: 50 additions & 0 deletions .buildkite/format.awk
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
###############################################################################
# This AWK script processes lines from test logs.
#
# - If a line starts with "=== RUN":
# 1) Split the third field on the "/" delimiter to check if it's a subtest.
# (e.g., $3 might be "Test/SomeSubtest")
# 2) If it is a subtest, print as is.
# (=== RUN Test/SomeSubtest)
# 3) Otherwise, replace "===" with "---" (indicating a main test).
# (--- RUN Test)
#
# - If a line contains "---" but does NOT contain "RUN", we interpret it as
# non-RUN log lines. We replace "---" with "###".
# ("--- PASS" to "### PASS")
#
# - All other lines are printed unchanged.
###############################################################################

# Match lines starting with "=== RUN"
/^=== RUN/ {

# Split the 3rd field on "/"
split($3, parts, "/")

# Check if more than one part was created after splitting on "/"
# This indicates it's a subtest (e.g., "Test/SomeSubtest").
if (length(parts) > 1) {
# For subtests, print the line unchanged
print
} else {
# If not a subtest, it's the main test. Replace "===" with "---".
gsub(/===/, "---")
print
}

# Skip any further rules for this line
next
}

# Match lines containing "---" but not containing "RUN"
/---/ && !/RUN/ {

# Replace "---" with "###"
gsub(/---/, "###")
print
next
}

# Print all other lines unchanged
{ print }
12 changes: 9 additions & 3 deletions .buildkite/test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
- IMG=kuberay/operator:nightly make deploy
- kubectl wait --timeout=90s --for=condition=Available=true deployment kuberay-operator
# Run e2e tests and print KubeRay operator logs if tests fail
- KUBERAY_TEST_TIMEOUT_SHORT=1m KUBERAY_TEST_TIMEOUT_MEDIUM=5m KUBERAY_TEST_TIMEOUT_LONG=10m go test -timeout 30m -v ./test/e2e || (kubectl logs --tail -1 -l app.kubernetes.io/name=kuberay && exit 1)
- echo "--- START:Running e2e rayservice (nightly operator) tests"
- KUBERAY_TEST_TIMEOUT_SHORT=1m KUBERAY_TEST_TIMEOUT_MEDIUM=5m KUBERAY_TEST_TIMEOUT_LONG=10m go test -timeout 30m -v ./test/e2e | awk -f ../.buildkite/format.awk || (kubectl logs --tail -1 -l app.kubernetes.io/name=kuberay && exit 1)
- echo "--- END:e2e rayservice (nightly operator) tests finished"

- label: 'Test E2E rayservice (nightly operator)'
instance_size: large
Expand All @@ -28,7 +30,9 @@
- IMG=kuberay/operator:nightly make deploy
- kubectl wait --timeout=90s --for=condition=Available=true deployment kuberay-operator
# Run e2e tests and print KubeRay operator logs if tests fail
- KUBERAY_TEST_TIMEOUT_SHORT=1m KUBERAY_TEST_TIMEOUT_MEDIUM=5m KUBERAY_TEST_TIMEOUT_LONG=10m go test -timeout 30m -v ./test/e2erayservice || (kubectl logs --tail -1 -l app.kubernetes.io/name=kuberay && exit 1)
- echo "--- START:Running e2e rayservice (nightly operator) tests"
- KUBERAY_TEST_TIMEOUT_SHORT=1m KUBERAY_TEST_TIMEOUT_MEDIUM=5m KUBERAY_TEST_TIMEOUT_LONG=10m go test -timeout 30m -v ./test/e2erayservice | awk -f ../.buildkite/format.awk || (kubectl logs --tail -1 -l app.kubernetes.io/name=kuberay && exit 1)
- echo "--- END:e2e rayservice (nightly operator) tests finished"

- label: 'Test Autoscaler E2E (nightly operator)'
instance_size: large
Expand All @@ -44,4 +48,6 @@
- IMG=kuberay/operator:nightly make deploy
- kubectl wait --timeout=90s --for=condition=Available=true deployment kuberay-operator
# Run e2e tests and print KubeRay operator logs if tests fail
- KUBERAY_TEST_TIMEOUT_SHORT=1m KUBERAY_TEST_TIMEOUT_MEDIUM=5m KUBERAY_TEST_TIMEOUT_LONG=10m go test -timeout 30m -v ./test/e2eautoscaler || (kubectl logs --tail -1 -l app.kubernetes.io/name=kuberay && exit 1)
- echo "--- START:Running Autoscaler e2e (nightly operator) tests"
- KUBERAY_TEST_TIMEOUT_SHORT=1m KUBERAY_TEST_TIMEOUT_MEDIUM=5m KUBERAY_TEST_TIMEOUT_LONG=10m go test -timeout 30m -v ./test/e2eautoscaler | awk -f ../.buildkite/format.awk || (kubectl logs --tail -1 -l app.kubernetes.io/name=kuberay && exit 1)
- echo "--- END:Autoscaler e2e (nightly operator) tests finished"
8 changes: 6 additions & 2 deletions .buildkite/test-sample-yamls.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
- IMG=kuberay/operator:nightly make deploy
- kubectl wait --timeout=90s --for=condition=Available=true deployment kuberay-operator
# Run sample YAML tests
- KUBERAY_TEST_TIMEOUT_SHORT=1m KUBERAY_TEST_TIMEOUT_MEDIUM=5m KUBERAY_TEST_TIMEOUT_LONG=10m go test -timeout 30m -v ./test/sampleyaml
- echo "--- START:Running Sample YAMLs (nightly operator) tests"
- KUBERAY_TEST_TIMEOUT_SHORT=1m KUBERAY_TEST_TIMEOUT_MEDIUM=5m KUBERAY_TEST_TIMEOUT_LONG=10m go test -timeout 30m -v ./test/sampleyaml | awk -f ../.buildkite/format.awk
- echo "--- END:Sample YAMLs (nightly operator) tests finished"
# Printing KubeRay operator logs
- kubectl logs --tail -1 -l app.kubernetes.io/name=kuberay

Expand All @@ -28,6 +30,8 @@
- IMG=quay.io/kuberay/operator:v1.2.2 make deploy
- kubectl wait --timeout=90s --for=condition=Available=true deployment kuberay-operator
# Run sample YAML tests
- KUBERAY_TEST_TIMEOUT_SHORT=1m KUBERAY_TEST_TIMEOUT_MEDIUM=5m KUBERAY_TEST_TIMEOUT_LONG=10m go test -timeout 30m -v ./test/sampleyaml
- echo "--- START:Running Sample YAMLs (latest release) tests"
- KUBERAY_TEST_TIMEOUT_SHORT=1m KUBERAY_TEST_TIMEOUT_MEDIUM=5m KUBERAY_TEST_TIMEOUT_LONG=10m go test -timeout 30m -v ./test/sampleyaml | awk -f ../.buildkite/format.awk
- echo "--- END:Sample YAMLs (latest release) tests finished"
# Printing KubeRay operator logs
- kubectl logs --tail -1 -l app.kubernetes.io/name=kuberay

0 comments on commit bc17cd9

Please sign in to comment.