Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[configopaque, confmap] Change yaml test by confmap test #9442

Merged
Merged
Show file tree
Hide file tree
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
10 changes: 10 additions & 0 deletions config/configopaque/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,24 @@ go 1.20

require (
github.com/stretchr/testify v1.8.4
go.opentelemetry.io/collector/confmap v0.93.0
go.uber.org/goleak v1.3.0
gopkg.in/yaml.v3 v3.0.1
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/knadh/koanf/maps v0.1.1 // indirect
github.com/knadh/koanf/providers/confmap v0.1.0 // indirect
github.com/knadh/koanf/v2 v2.0.1 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/mapstructure v1.5.1-0.20231216201459-8508981c8b6c // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rogpeppe/go-internal v1.10.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
)

replace go.opentelemetry.io/collector/confmap => ../../confmap
14 changes: 14 additions & 0 deletions config/configopaque/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions config/configopaque/opaque_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import (

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gopkg.in/yaml.v3"

"go.opentelemetry.io/collector/confmap"
)

var _ encoding.TextMarshaler = String("")
Expand Down Expand Up @@ -47,10 +48,11 @@ func TestStringJSON(t *testing.T) {
assert.Equal(t, `{"opaque":"[REDACTED]","plain":"plain"}`, string(bytes))
}

func TestStringYAML(t *testing.T) {
mx-psi marked this conversation as resolved.
Show resolved Hide resolved
bytes, err := yaml.Marshal(example)
require.NoError(t, err)
assert.Equal(t, "opaque: '[REDACTED]'\nplain: plain\n", string(bytes))
func TestConfMapMarshalConfigOpaque(t *testing.T) {
conf := confmap.New()
assert.NoError(t, conf.Marshal(example))
assert.Equal(t, "[REDACTED]", conf.Get("opaque"))
assert.Equal(t, "plain", conf.Get("plain"))
}

func TestStringFmt(t *testing.T) {
Expand Down
2 changes: 2 additions & 0 deletions config/configtls/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ require (
)

replace go.opentelemetry.io/collector/config/configopaque => ../configopaque

replace go.opentelemetry.io/collector/confmap => ../../confmap
7 changes: 7 additions & 0 deletions config/configtls/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions confmap/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@ require (

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rogpeppe/go-internal v1.10.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
)

retract (
Expand Down
13 changes: 2 additions & 11 deletions confmap/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading