Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions internal/datastreams/processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,9 @@ func TestProcessor(t *testing.T) {

t.Run("test_service_name_override", func(t *testing.T) {
p := NewProcessor(nil, "env", "service", "v1", &url.URL{Scheme: "http", Host: "agent-address"}, nil)
tp := time.Now().Truncate(bucketDuration)
// Use a fixed time so the test is deterministic regardless of wall-clock speed.
tp := time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC).Truncate(bucketDuration)
p.timeSource = func() time.Time { return tp }
p.add(statsPoint{
serviceName: "service1",
edgeTags: []string{"type:edge-1"},
Expand Down Expand Up @@ -237,7 +239,7 @@ func TestProcessor(t *testing.T) {
ProcessTags: processtags.GlobalTags().Slice(),
Stats: []StatsBucket{
{
Start: uint64(tp1.Add(-10 * time.Second).UnixNano()),
Start: uint64(tp.Add(-10 * time.Second).UnixNano()),
Duration: uint64(bucketDuration.Nanoseconds()),
Stats: []StatsPoint{{
EdgeTags: []string{"type:edge-1"},
Expand All @@ -251,7 +253,7 @@ func TestProcessor(t *testing.T) {
Backlogs: []Backlog{},
},
{
Start: uint64(tp1.UnixNano()),
Start: uint64(tp.UnixNano()),
Duration: uint64(bucketDuration.Nanoseconds()),
Stats: []StatsPoint{{
EdgeTags: []string{"type:edge-1"},
Expand All @@ -276,7 +278,7 @@ func TestProcessor(t *testing.T) {
ProcessTags: processtags.GlobalTags().Slice(),
Stats: []StatsBucket{
{
Start: uint64(tp1.Add(-10 * time.Second).UnixNano()),
Start: uint64(tp.Add(-10 * time.Second).UnixNano()),
Duration: uint64(bucketDuration.Nanoseconds()),
Stats: []StatsPoint{{
EdgeTags: []string{"type:edge-1"},
Expand All @@ -290,7 +292,7 @@ func TestProcessor(t *testing.T) {
Backlogs: []Backlog{},
},
{
Start: uint64(tp1.UnixNano()),
Start: uint64(tp.UnixNano()),
Duration: uint64(bucketDuration.Nanoseconds()),
Stats: []StatsPoint{{
EdgeTags: []string{"type:edge-1"},
Expand Down
Loading