Skip to content

Commit 99137a1

Browse files
shailend-ggvisor-bot
authored andcommitted
[DO NOT SUBMIT] Repro TestJobControl flake and upload docker logs
PiperOrigin-RevId: 813873791
1 parent 5ad0647 commit 99137a1

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

.buildkite/hooks/post-command

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ rm -f repo.key
88
# Upload all relevant test failures.
99
make -s testlogs 2>/dev/null | grep // | sort | uniq | (
1010
declare log_count=0
11+
local testjobcontrol_failed=false
1112
while read target log; do
1213
if test -z "${target}"; then
1314
continue
@@ -25,10 +26,31 @@ make -s testlogs 2>/dev/null | grep // | sort | uniq | (
2526
buildkite-agent annotate --style error --context failures --append
2627
else
2728
buildkite-agent artifact upload "${log}"
29+
if grep -qP "TestJobControl" "${log}"; then
30+
testjobcontrol_failed=true
31+
fi
2832
echo " * [${target}](artifact://${log#/}) (${BUILDKITE_LABEL})" | \
2933
buildkite-agent annotate --style error --context failures --append
30-
fi
34+
35+
# List the first 5 specific failing go tests as sub-bullets.
36+
sed -n '/^--- FAIL:/ {s/^--- FAIL: \([^ ]*\) (.*)/\1/p}' "${log}" | \
37+
grep -v 'main_test' | head -n 5 | xargs -I {} echo " * {}" | \
38+
buildkite-agent annotate --style error --context failures --append
39+
# List the first 5 specific failing cpp tests as sub-bullets.
40+
sed -n '/\[ FAILED \]/ {s/.*\[ FAILED \] \([^ ]*\) (.*)/\1/p}' "${log}" | \
41+
grep -v 'main_test' | head -n 5 | xargs -I {} echo " * {}" | \
42+
buildkite-agent annotate --style error --context failures --append
43+
fi
3144
done
45+
46+
if [[ "${testjobcontrol_failed}" == true ]]; then
47+
sudo journalctl -u docker.service -p warning --since "2 hours ago" > /tmp/docker.log
48+
echo "#############" >> /tmp/docker.log
49+
docker --version >> /tmp/docker.log
50+
uname -a >> /tmp/docker.log
51+
echo "#############" >> /tmp/docker.log
52+
buildkite-agent artifact upload /tmp/docker.log
53+
fi
3254
)
3355

3456
# Upload all profiles, and include in an annotation.

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,11 @@ docker-tests: load-basic $(RUNTIME_BIN)
369369
@$(call test_runtime_cached,$(RUNTIME),$(INTEGRATION_TARGETS) --test_env=TEST_SAVE_RESTORE_NETSTACK=true //test/e2e:integration_runtime_test //test/e2e:runtime_in_docker_test)
370370
.PHONY: docker-tests
371371

372+
flake-repro: load-basic $(RUNTIME_BIN)
373+
@$(call install_runtime,$(RUNTIME),) # Clear flags.
374+
@$(call test_runtime,$(RUNTIME),//test/e2e:integration_test)
375+
.PHONY: flake-repro
376+
372377
plugin-network-tests: load-basic $(RUNTIME_BIN)
373378
@$(call install_runtime,$(RUNTIME)-dpdk,--network=plugin)
374379
@$(call test_runtime_cached,$(RUNTIME)-dpdk, --test_arg=-test.run=ConnectToSelf $(INTEGRATION_TARGETS))

test/e2e/integration_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,13 @@ func TestNumCPU(t *testing.T) {
347347

348348
// TestJobControl tests that job control characters are handled properly.
349349
func TestJobControl(t *testing.T) {
350+
for i := 0; i < 100; i++ {
351+
testJobControl(t)
352+
time.Sleep(time.Second)
353+
}
354+
}
355+
356+
func testJobControl(t *testing.T) {
350357
ctx := context.Background()
351358
d := dockerutil.MakeContainer(ctx, t)
352359
defer d.CleanUp(ctx)
@@ -360,6 +367,7 @@ func TestJobControl(t *testing.T) {
360367
}
361368
// Give shell a few seconds to start executing the sleep.
362369
time.Sleep(2 * time.Second)
370+
t.Logf("TestJobControl: container %v is sleeping", d.ID())
363371

364372
if _, err := p.Write(time.Second, []byte{0x03}); err != nil {
365373
t.Fatalf("error exit: %v", err)

0 commit comments

Comments
 (0)