Skip to content

Commit 42377cd

Browse files
committed
fix: api log line test flakes race condition
1 parent 88a793f commit 42377cd

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

tests/fixtures/docker/compose.override.mongodb.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ services:
55
teams-api:
66
depends_on: [mongodb]
77
image: us-central1-docker.pkg.dev/computer-vision-team/dev-docker/fiftyone-teams-api:${FIFTYONE_TEAMS_API_VERSION}
8+
# Force unbuffered stdout so the startup log line is flushed immediately
9+
# rather than sitting in a block buffer. Prevents flaky log assertions in
10+
# the integration tests (see checkContainerLogsWithRetries).
11+
environment:
12+
PYTHONUNBUFFERED: "1"
813
teams-app:
914
depends_on: [mongodb]
1015
image: us-central1-docker.pkg.dev/computer-vision-team/dev-docker/fiftyone-teams-app:${FIFTYONE_TEAMS_APP_VERSION}

tests/integration/compose/common_test.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,14 @@ func get_logs(t *testing.T, dockerOptions *docker.Options, container string) str
4242
}
4343

4444
func checkContainerLogsWithRetries(subT *testing.T, dockerOptions *docker.Options, container string, tc string, expected string) {
45-
maxRetries := 6
46-
retryDelay := 2 * time.Second
45+
// Give the log assertion at least as much headroom as validate_endpoint
46+
// (10 x 3s = 30s), plus margin. On loaded CI runners the larger compose
47+
// stacks (e.g. dedicated plugins) can take longer to emit their startup
48+
// line than the previous 6 x 2s (~12s) budget allowed, which caused
49+
// non-deterministic failures where an otherwise-healthy container's log
50+
// line had not yet surfaced within the window.
51+
maxRetries := 15
52+
retryDelay := 3 * time.Second
4753

4854
var log string
4955

0 commit comments

Comments
 (0)