diff --git a/cmd/otelcomponentmapping/otelcomponentmapping_apply_test.go b/cmd/otelcomponentmapping/otelcomponentmapping_apply_test.go index 923df0a4..4b40a10d 100644 --- a/cmd/otelcomponentmapping/otelcomponentmapping_apply_test.go +++ b/cmd/otelcomponentmapping/otelcomponentmapping_apply_test.go @@ -10,7 +10,7 @@ import ( "github.com/stackvista/stackstate-cli/internal/di" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v2" + "gopkg.in/yaml.v3" ) func createTempYamlFile(t *testing.T, content string) string { diff --git a/cmd/otelcomponentmapping/otelcomponentmapping_describe_test.go b/cmd/otelcomponentmapping/otelcomponentmapping_describe_test.go index 74be399e..83cdf89b 100644 --- a/cmd/otelcomponentmapping/otelcomponentmapping_describe_test.go +++ b/cmd/otelcomponentmapping/otelcomponentmapping_describe_test.go @@ -12,7 +12,7 @@ import ( "github.com/stackvista/stackstate-cli/internal/di" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v2" + "gopkg.in/yaml.v3" ) func deepNormalizeOtelComponentMapping(m *stackstate_api.OtelComponentMapping) { diff --git a/cmd/otelrelationmapping/otelrelationmapping_apply_test.go b/cmd/otelrelationmapping/otelrelationmapping_apply_test.go index 80e5481f..b0a47e66 100644 --- a/cmd/otelrelationmapping/otelrelationmapping_apply_test.go +++ b/cmd/otelrelationmapping/otelrelationmapping_apply_test.go @@ -10,7 +10,7 @@ import ( "github.com/stackvista/stackstate-cli/internal/di" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v2" + "gopkg.in/yaml.v3" ) func createTempYamlFile(t *testing.T, content string) string { diff --git a/cmd/otelrelationmapping/otelrelationmapping_describe_test.go b/cmd/otelrelationmapping/otelrelationmapping_describe_test.go index edf74e82..f53c7cc8 100644 --- a/cmd/otelrelationmapping/otelrelationmapping_describe_test.go +++ b/cmd/otelrelationmapping/otelrelationmapping_describe_test.go @@ -10,7 +10,7 @@ import ( "github.com/stackvista/stackstate-cli/internal/di" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v2" + "gopkg.in/yaml.v3" ) func TestOtelRelationMappingDescribe_YAMLOutput(t *testing.T) { diff --git a/cmd/otelrelationmapping/otelrelationmapping_edit_test.go b/cmd/otelrelationmapping/otelrelationmapping_edit_test.go index 8be9fdaf..51bdfff4 100644 --- a/cmd/otelrelationmapping/otelrelationmapping_edit_test.go +++ b/cmd/otelrelationmapping/otelrelationmapping_edit_test.go @@ -5,8 +5,6 @@ import ( "io" "testing" - "gopkg.in/yaml.v2" - "github.com/stackvista/stackstate-cli/cmd/otelrelationmapping" "github.com/stackvista/stackstate-cli/generated/stackstate_api" "github.com/stackvista/stackstate-cli/internal/di" @@ -22,6 +20,9 @@ func (m *mockEditorStub) Edit(prefix, suffix string, contents io.Reader) ([]byte if m.err != nil { return nil, m.err } + if m.content == nil { + return io.ReadAll(contents) + } return m.content, nil } @@ -68,9 +69,7 @@ func TestOtelRelationMappingEdit_NoChange(t *testing.T) { mockIdentifier := "urn:otel:relation:edit-unchanged" orig := stackstate_api.OtelRelationMapping{Identifier: mockIdentifier, Name: "test-unchanged"} cli.MockClient.ApiMocks.OtelMappingApi.GetOtelRelationMappingResponse.Result = orig - // Echo original as-is, using canonical YAML - origYAML, _ := yaml.Marshal(orig) - cli.Editor = &mockEditorStub{content: origYAML} + cli.Editor = &mockEditorStub{} _, err := di.ExecuteCommandWithContext(&cli.Deps, cmd, "--identifier", mockIdentifier) diff --git a/go.mod b/go.mod index 6c90cc2c..caf27f47 100644 --- a/go.mod +++ b/go.mod @@ -22,7 +22,6 @@ require ( github.com/mcuadros/go-defaults v1.2.0 github.com/spf13/pflag v1.1.0 golang.org/x/text v0.44.0 - gopkg.in/yaml.v2 v2.4.0 k8s.io/kubectl v0.37.2 ) diff --git a/go.sum b/go.sum index 45359aa8..cfbce41f 100644 --- a/go.sum +++ b/go.sum @@ -269,8 +269,6 @@ gopkg.in/evanphx/json-patch.v4 v4.13.0 h1:czT3CmqEaQ1aanPc5SdlgQrrEIb8w/wwCvWWnf gopkg.in/evanphx/json-patch.v4 v4.13.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=