Debian Codegraph @

pdata/internal/otlp/logs_test.go

raw
1 // Copyright The OpenTelemetry Authors
2 // SPDX-License-Identifier: Apache-2.0
3
4 package otlp
5
6 import (
7 "testing"
8
9 "github.com/stretchr/testify/assert"
10
11 "go.opentelemetry.io/collector/pdata/internal"
12 )
13
14 func TestDeprecatedScopeLogs(t *testing.T) {
15 sl := new(internal.ScopeLogs)
16 rls := []*internal.ResourceLogs{
17 {
18 ScopeLogs: []*internal.ScopeLogs{sl},
19 DeprecatedScopeLogs: []*internal.ScopeLogs{sl},
20 },
21 {
22 ScopeLogs: []*internal.ScopeLogs{},
23 DeprecatedScopeLogs: []*internal.ScopeLogs{sl},
24 },
25 }
26
27 MigrateLogs(rls)
28 assert.Same(t, sl, rls[0].ScopeLogs[0])
29 assert.Same(t, sl, rls[1].ScopeLogs[0])
30 assert.Nil(t, rls[0].DeprecatedScopeLogs)
31 assert.Nil(t, rls[0].DeprecatedScopeLogs)
32 }