-
Notifications
You must be signed in to change notification settings - Fork 693
Closed
Labels
area: file-configRelated to file-based configurationRelated to file-based configurationbugSomething isn't workingSomething isn't working
Milestone
Description
Steps To Reproduce
func TestBug(t *testing.T) {
data :=
`resource:
attributes:
-
`
cfg, err := ParseYAML([]byte(data))
require.NoError(t, err)
sdk, err := NewSDK(WithOpenTelemetryConfiguration(*cfg))
require.NoError(t, err)
assert.NoError(t, sdk.Shutdown(context.Background()))
}Output:
--- FAIL: TestBug (0.00s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0xb75609]
goroutine 19 [running]:
testing.tRunner.func1.2({0xc51c40, 0x1437b80})
/usr/local/go/src/testing/testing.go:1632 +0x230
testing.tRunner.func1()
/usr/local/go/src/testing/testing.go:1635 +0x35e
panic({0xc51c40?, 0x1437b80?})
/usr/local/go/src/runtime/panic.go:785 +0x132
go.opentelemetry.io/contrib/config/v0%2e3%2e0.newResource(0xc00011e2d0)
/home/ropajak/repos/opentelemetry-go-contrib/config/v0.3.0/resource.go:59 +0x249
go.opentelemetry.io/contrib/config/v0%2e3%2e0.NewSDK({0xc00019ff50?, 0xc000116820?, 0x0?})
/home/ropajak/repos/opentelemetry-go-contrib/config/v0.3.0/config.go:88 +0x1c5
go.opentelemetry.io/contrib/config/v0%2e3%2e0.TestBug(0xc000116820)
/home/ropajak/repos/opentelemetry-go-contrib/config/v0.3.0/fuzz_test.go:44 +0x128
testing.tRunner(0xc000116820, 0xdbc220)
/usr/local/go/src/testing/testing.go:1690 +0xf4
created by testing.(*T).Run in goroutine 1
/usr/local/go/src/testing/testing.go:1743 +0x390
FAIL go.opentelemetry.io/contrib/config/v0.3.0 0.008s
FAIL
Expected behavior
NewSDKmust handle handle nil schema URL.- NICE TO HAVE
nullattribute should probably be also be considered as an invalid input forParseYAML(and when parsing JSON as well) as we already have test cases likeinvalid nil value.
MrAlias
Metadata
Metadata
Assignees
Labels
area: file-configRelated to file-based configurationRelated to file-based configurationbugSomething isn't workingSomething isn't working