mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-10-24 20:52:51 +00:00
test(server): synchronize remaining startup watchdog log capture
TestStartupWatchdogFiresAndNamesLastPhase and TestStartupWatchdogStopIsIdempotentAndPreventsFire still poll a plain bytes.Buffer while the watchdog goroutine writes it through zerolog, so 'go test -race' reports the same read/write data race that 4d2ee8666c fixed only in service_health_test.go. Reuse the package-level syncBuffer so the poll and the watchdog write are serialized; drop the now-unused bytes import.
Change-source: pulse-maintainer
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -27,7 +26,7 @@ func TestStartupPhaseMarkAndCurrent(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestStartupWatchdogFiresAndNamesLastPhase(t *testing.T) {
|
||||
var buf bytes.Buffer
|
||||
var buf syncBuffer
|
||||
logger := zerolog.New(&buf)
|
||||
|
||||
phase := &startupPhase{}
|
||||
@@ -54,7 +53,7 @@ func TestStartupWatchdogFiresAndNamesLastPhase(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestStartupWatchdogStopIsIdempotentAndPreventsFire(t *testing.T) {
|
||||
var buf bytes.Buffer
|
||||
var buf syncBuffer
|
||||
logger := zerolog.New(&buf)
|
||||
|
||||
stop := startStartupWatchdog(logger, &startupPhase{}, 15*time.Millisecond)
|
||||
|
||||
Reference in New Issue
Block a user