| 1 |
// Copyright The OpenTelemetry Authors |
| 2 |
// SPDX-License-Identifier: Apache-2.0 |
| 3 |
|
| 4 |
package e2e |
| 5 |
|
| 6 |
import ( |
| 7 |
"testing" |
| 8 |
|
| 9 |
"github.com/stretchr/testify/assert" |
| 10 |
"github.com/stretchr/testify/require" |
| 11 |
|
| 12 |
"go.opentelemetry.io/collector/config/configopaque" |
| 13 |
"go.opentelemetry.io/collector/confmap" |
| 14 |
) |
| 15 |
|
| 16 |
type TestStruct struct { |
| 17 |
Opaque configopaque.String `json:"opaque" yaml:"opaque"` |
| 18 |
Plain string `json:"plain" yaml:"plain"` |
| 19 |
} |
| 20 |
|
| 21 |
var example = TestStruct{ |
| 22 |
Opaque: "opaque", |
| 23 |
Plain: "plain", |
| 24 |
} |
| 25 |
|
| 26 |
func TestConfMapMarshalConfigOpaque(t *testing.T) { |
| 27 |
conf := confmap.New() |
| 28 |
require.NoError(t, conf.Marshal(example)) |
| 29 |
assert.Equal(t, "[REDACTED]", conf.Get("opaque")) |
| 30 |
assert.Equal(t, "plain", conf.Get("plain")) |
| 31 |
} |