Skip to content

Commit

Permalink
Merge pull request kubernetes#94549 from knight42/fix/TestRecordOpera…
Browse files Browse the repository at this point in the history
…tion

test(kuberuntime): deflake TestRecordOperation
  • Loading branch information
k8s-ci-robot authored Sep 5, 2020
2 parents 1f708f6 + c6f9b40 commit 22772d0
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pkg/kubelet/kuberuntime/instrumented_services_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,16 @@ func TestRecordOperation(t *testing.T) {
legacyregistry.MustRegister(metrics.RuntimeOperationsDuration)
legacyregistry.MustRegister(metrics.RuntimeOperationsErrors)

temporalServer := "127.0.0.1:1234"
l, err := net.Listen("tcp", temporalServer)
l, err := net.Listen("tcp", "127.0.0.1:0")
assert.NoError(t, err)
defer l.Close()

prometheusURL := "http://" + temporalServer + "/metrics"
prometheusURL := "http://" + l.Addr().String() + "/metrics"
mux := http.NewServeMux()
//lint:ignore SA1019 ignore deprecated warning until we move off of global registries
mux.Handle("/metrics", legacyregistry.Handler())
server := &http.Server{
Addr: temporalServer,
Addr: l.Addr().String(),
Handler: mux,
}
go func() {
Expand Down

0 comments on commit 22772d0

Please sign in to comment.