MCPcopy
hub / github.com/nats-io/nats.go / TestGroupDuration

Function TestGroupDuration

bench/benchlib_test.go:82–90  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

80}
81
82func TestGroupDuration(t *testing.T) {
83 sg := NewSampleGroup()
84 sg.AddSample(millionMessagesSecondSample(1))
85 sg.AddSample(millionMessagesSecondSample(2))
86 duration := sg.End.Sub(sg.Start)
87 if duration != sg.Duration() || duration != time.Duration(2)*time.Second {
88 t.Fatal("Expected aggregate duration to be 2.0 seconds")
89 }
90}
91
92func TestGroupSeconds(t *testing.T) {
93 sg := NewSampleGroup()

Callers

nothing calls this directly

Calls 4

AddSampleMethod · 0.95
NewSampleGroupFunction · 0.85
DurationMethod · 0.80

Tested by

no test coverage detected