Flaky test: TestEventServer fails with connection refused due to startup race
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 86/100
Línea de trabajo
Lee internal/server/event_server_test.go, especialmente el inicio del servidor alrededor de la línea 143, el primer POST alrededor de la línea 309 y la comprobación de disponibilidad existente alrededor de las líneas 412–418. Añade la espera de disponibilidad después de iniciar la goroutine del servidor y luego ejecuta TestEventServer con las condiciones propensas a carreras que se han informado; se considera terminado cuando el primer POST ya no compite con el inicio del servidor.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Environment: main at d4eaa7a, Go 1.27.4, Ubuntu on WSL2
What I saw
During a full make test run, I hit a failure on the forwards_when_source_is_a_match subtest in TestEventServer with this exact error:
Post "http://localhost:<port>": dial tcp 127.0.0.1:<port>: connect: connection refused
It passed on a re-run. I ran it 30 separate times in a loop and they all passed, so it's a rare timing flake.
Cause
The server is started in a background goroutine (internal/server/event_server_test.go:143), but there is no readiness wait before the first http.Post executes (around line 309). If the Go scheduler delays the goroutine slightly, which is more likely under heavy load, such as during a full parallel make test with -race, the POST request fires before the server is actually listening.
Proof
I added a temporary time.Sleep(200 * time.Millisecond) at the top of EventServer.ListenAndServe in internal/server/event_server.go. With that delay, all 13 subtests instantly fail with connection refused (because the tests execute quickly enough that all of them run and fail inside that 200ms window).
Proposed fix
Add a readiness wait immediately after the server goroutine starts. We can use the exact same g.Eventually(net.Dial...) block that is already used elsewhere in the file (internal/server/event_server_test.go lines 412–418). Adding this check makes the test pass reliably, even with the artificial 200ms delay injected.
I can open a PR with this fix if you'd like.
- Lenguaje dominante
- Go
- Estrellas
- 182
- Forks
- 183
- Merge medio
- 9 h 20 min
- PR fusionados (30 d)
- 26
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de fluxcd/notification-controller
-
area/alerting area/api enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
fluxcd/notification-controller#1155 · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Improve documentation on debugging the controller locallyQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abiertoarea/docs good first issue help wanted
Dificultad 2/5 Medio día Aptitud para principiantes 72/100
fluxcd/notification-controller#362 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Commit status: opt-in event message as description (spec.commitStatusDescriptionExpr)Posiblemente ocupada @schdief la tomó hace 2 días. Abierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 38/100
fluxcd/notification-controller#1436 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
fluxcd/notification-controller#1386 · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 42/100
fluxcd/notification-controller#1371 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de fluxcd/notification-controller
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
OneBusAway/maglev#2145 ·
Los mantenedores suelen responder en 2 días
-
priority/medium status/ready type/chore
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
discobox-ai/discobox#1357 ·
Los mantenedores suelen responder en 1 día
-
TestPseudoLocaleRemote fails now and then: it types the code before the laptop asks for itPosiblemente ocupada @fzn0x la tomó hoy. Abiertobug priority: low
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
edit_file diff rendering panics on invalid UTF-8 textPosiblemente ocupada @TDnorthgarden la tomó hoy. Abiertoarea/tui
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
docker/docker-agent#4955 ·
Los mantenedores suelen responder en 1 día
-
enhancement ui/ux
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
jbigler/railswitch#243 ·
Los mantenedores suelen responder en 1 día