Skip to content

Commit

Permalink
Add unit test for App Runner Origin
Browse files Browse the repository at this point in the history
* In open-telemetry#6141 we had added the app runner origin, but forgot to add a unit test
* This PR makes such that segment.origin is OriginAppRunner when the correct attrs are set
  • Loading branch information
NathanielRN committed Nov 23, 2021
1 parent 51cbd90 commit 58a26e8
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions exporter/awsxrayexporter/internal/translator/segment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,24 @@ func TestOriginEks(t *testing.T) {
assert.Equal(t, OriginEKS, *segment.Origin)
}

func TestOriginAppRunner(t *testing.T) {
attributes := make(map[string]interface{})
resource := pdata.NewResource()
attrs := pdata.NewAttributeMap()
attrs.InsertString(conventions.AttributeCloudProvider, conventions.AttributeCloudProviderAWS)
// TODO: Replace with semantic convention const when aws_app_runner is included in an official semconv release
attrs.InsertString(conventions.AttributeCloudPlatform, "aws_app_runner")
attrs.CopyTo(resource.Attributes())
spanName := "/test"
parentSpanID := newSegmentID()
span := constructServerSpan(parentSpanID, spanName, pdata.StatusCodeError, "OK", attributes)

segment, _ := MakeSegment(span, resource, []string{}, false)

assert.NotNil(t, segment)
assert.Equal(t, OriginAppRunner, *segment.Origin)
}

func TestOriginBlank(t *testing.T) {
spanName := "/test"
parentSpanID := newSegmentID()
Expand Down

0 comments on commit 58a26e8

Please sign in to comment.