Skip to content

Commit

Permalink
Test TelemetryAttributes key and value
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitgorana committed Mar 19, 2024
1 parent f8a74e4 commit abe73b6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cmd/telemetrygen/internal/logs/worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package logs

import (
"fmt"
"testing"
"time"

Expand Down Expand Up @@ -145,6 +146,13 @@ func TestLogsWithOneTelemetryAttributes(t *testing.T) {
for i := 0; i < rlogs.Len(); i++ {
attrs := rlogs.At(i).ScopeLogs().At(0).LogRecords().At(0).Attributes()
assert.Equal(t, 2, attrs.Len(), "shouldn't have less than 2 attributes")

val, ok := attrs.Get(telemetryAttrKeyOne)
assert.True(t, ok, fmt.Sprintf("there should be an attribute with key %s", telemetryAttrKeyOne))
if ok {
assert.EqualValues(t, val.AsString(), telemetryAttrValueOne)
}

}
}
}
Expand Down

0 comments on commit abe73b6

Please sign in to comment.