Files
Matthieu MORELandGitHub 28dadd2dab [chore]: enable require-error rule from testifylint (#11199)
#### Description

Testifylint is a linter that provides best practices with the use of
testify.

This PR enables
[require-error](https://github.com/Antonboom/testifylint?tab=readme-ov-file#require-error)
rule from [testifylint](https://github.com/Antonboom/testifylint)

Signed-off-by: Matthieu MOREL <[email protected]>
2024-09-18 15:02:22 -07:00

32 lines
712 B
Go

// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
package e2e
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/config/configopaque"
"go.opentelemetry.io/collector/confmap"
)
type TestStruct struct {
Opaque configopaque.String `json:"opaque" yaml:"opaque"`
Plain string `json:"plain" yaml:"plain"`
}
var example = TestStruct{
Opaque: "opaque",
Plain: "plain",
}
func TestConfMapMarshalConfigOpaque(t *testing.T) {
conf := confmap.New()
require.NoError(t, conf.Marshal(example))
assert.Equal(t, "[REDACTED]", conf.Get("opaque"))
assert.Equal(t, "plain", conf.Get("plain"))
}