Skip to content

Commit

Permalink
fix test (#3787)
Browse files Browse the repository at this point in the history
  • Loading branch information
Feroze Mohideen authored Oct 10, 2023
1 parent 60fb770 commit 5b6ad3e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ require (
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/google/btree v1.1.2 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/go-cmp v0.5.9
github.com/google/go-containerregistry v0.9.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
Expand Down
12 changes: 5 additions & 7 deletions internal/porter_app/test/porter_app_to_yaml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ import (
"context"
"fmt"
"os"
"reflect"
"testing"

"github.com/kr/pretty"
"github.com/google/go-cmp/cmp"
"github.com/matryer/is"
porterv1 "github.com/porter-dev/api-contracts/generated/go/porter/v1"
"github.com/porter-dev/porter/internal/porter_app"
Expand Down Expand Up @@ -44,8 +43,8 @@ func TestPorterAppToYAML(t *testing.T) {
func diffPorterAppWithOriginalYamlTest(t *testing.T, is *is.I, wantYaml []byte, got v2.PorterApp) {
t.Helper()

var want map[string]interface{}
err := yaml.Unmarshal(wantYaml, &want)
var wantMap map[string]interface{}
err := yaml.Unmarshal(wantYaml, &wantMap)
is.NoErr(err)

gotYaml, err := yaml.Marshal(got)
Expand All @@ -55,8 +54,7 @@ func diffPorterAppWithOriginalYamlTest(t *testing.T, is *is.I, wantYaml []byte,
err = yaml.Unmarshal(gotYaml, &gotMap)
is.NoErr(err)

// Compare the maps for equality
if !reflect.DeepEqual(want, gotMap) {
t.Errorf("Maps are not equal. Diff: %v", pretty.Diff(want, gotMap))
if diff := cmp.Diff(wantMap, gotMap); diff != "" {
t.Errorf("diff between want and got: %s", diff)
}
}

0 comments on commit 5b6ad3e

Please sign in to comment.