Skip to content

Commit

Permalink
Reproduce agent close issue when setting SocketBufferSize
Browse files Browse the repository at this point in the history
  • Loading branch information
ChenX1993 committed May 9, 2023
1 parent 5c3c20d commit e25216c
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions cmd/agent/app/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,37 @@ func TestStartStopRace(t *testing.T) {
t.Fatal("Expecting server exit log")
}

func TestStopIssueReproduce(t *testing.T) {
resetDefaultPrometheusRegistry()
cfg := Builder{
Processors: []ProcessorConfiguration{
{
Model: jaegerModel,
Protocol: compactProtocol,
Workers: 1,
Server: ServerConfiguration{
HostPort: "127.0.0.1:0",
SocketBufferSize: 10,
},
},
},
}
logger := zap.NewNop()
mBldr := &metricsbuilder.Builder{HTTPRoute: "/metrics", Backend: "prometheus"}
metricsFactory, err := mBldr.CreateMetricsFactory("jaeger")
mFactory := fork.New("internal", metrics.NullFactory, metricsFactory)
require.NoError(t, err)
agent, err := cfg.CreateAgent(fakeCollectorProxy{}, logger, mFactory)
require.NoError(t, err)

if err := agent.Run(); err != nil {
t.Fatalf("error from agent.Run(): %s", err)
}

t.Log("stopping agent")
agent.Stop()
}

func resetDefaultPrometheusRegistry() {
// Create and assign a new Prometheus Registerer/Gatherer for each test
registry := prometheus.NewRegistry()
Expand Down

0 comments on commit e25216c

Please sign in to comment.