Skip to content

Commit

Permalink
pipes: Use 'reflect.DeepEquals' in unit tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
ewbankkit committed Jun 9, 2023
1 parent 3d5cef3 commit 270783e
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 17 deletions.
16 changes: 11 additions & 5 deletions internal/service/pipes/enrichment_parameters_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package pipes

import (
"reflect"
"testing"

"github.com/aws/aws-sdk-go-v2/service/pipes/types"
"github.com/aws/aws-sdk-go/aws"
"github.com/google/go-cmp/cmp"
)

func Test_expandEnrichmentParameters(t *testing.T) {
Expand Down Expand Up @@ -68,8 +68,11 @@ func Test_expandEnrichmentParameters(t *testing.T) {
t.Run(name, func(t *testing.T) {
got := expandEnrichmentParameters([]interface{}{tt.config})

if diff := cmp.Diff(got, tt.expected); diff != "" {
t.Errorf("unexpected diff (+wanted, -got): %s", diff)
if !reflect.DeepEqual(got, tt.expected) {
t.Fatalf(
"Got:\n\n%#v\n\nExpected:\n\n%#v\n",
got,
tt.expected)
}
})
}
Expand Down Expand Up @@ -139,8 +142,11 @@ func Test_flattenEnrichmentParameters(t *testing.T) {
t.Run(name, func(t *testing.T) {
got := flattenEnrichmentParameters(tt.config)

if diff := cmp.Diff(got, tt.expected); diff != "" {
t.Errorf("unexpected diff (+wanted, -got): %s", diff)
if !reflect.DeepEqual(got, tt.expected) {
t.Fatalf(
"Got:\n\n%#v\n\nExpected:\n\n%#v\n",
got,
tt.expected)
}
})
}
Expand Down
23 changes: 16 additions & 7 deletions internal/service/pipes/source_parameters_test.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package pipes

import (
"reflect"
"testing"
"time"

"github.com/aws/aws-sdk-go-v2/service/pipes/types"
"github.com/aws/aws-sdk-go/aws"
"github.com/google/go-cmp/cmp"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

Expand Down Expand Up @@ -544,8 +544,11 @@ func Test_expandSourceParameters(t *testing.T) {
t.Run(name, func(t *testing.T) {
got := expandSourceParameters([]interface{}{tt.config})

if diff := cmp.Diff(got, tt.expected); diff != "" {
t.Errorf("unexpected diff (+wanted, -got): %s", diff)
if !reflect.DeepEqual(got, tt.expected) {
t.Fatalf(
"Got:\n\n%#v\n\nExpected:\n\n%#v\n",
got,
tt.expected)
}
})
}
Expand Down Expand Up @@ -1025,8 +1028,11 @@ func Test_flattenSourceParameters(t *testing.T) {
t.Run(name, func(t *testing.T) {
got := flattenSourceParameters(tt.config)

if diff := cmp.Diff(got, tt.expected); diff != "" {
t.Errorf("unexpected diff (+wanted, -got): %s", diff)
if !reflect.DeepEqual(got, tt.expected) {
t.Fatalf(
"Got:\n\n%#v\n\nExpected:\n\n%#v\n",
got,
tt.expected)
}
})
}
Expand Down Expand Up @@ -1498,8 +1504,11 @@ func Test_expandSourceUpdateParameters(t *testing.T) {
t.Run(name, func(t *testing.T) {
got := expandSourceUpdateParameters([]interface{}{tt.config})

if diff := cmp.Diff(got, tt.expected); diff != "" {
t.Errorf("unexpected diff (+wanted, -got): %s", diff)
if !reflect.DeepEqual(got, tt.expected) {
t.Fatalf(
"Got:\n\n%#v\n\nExpected:\n\n%#v\n",
got,
tt.expected)
}
})
}
Expand Down
16 changes: 11 additions & 5 deletions internal/service/pipes/target_parameters_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package pipes

import (
"reflect"
"testing"

"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/pipes/types"
"github.com/google/go-cmp/cmp"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

Expand Down Expand Up @@ -542,8 +542,11 @@ func Test_expandTargetParameters(t *testing.T) {
t.Run(name, func(t *testing.T) {
got := expandTargetParameters([]interface{}{tt.config})

if diff := cmp.Diff(got, tt.expected); diff != "" {
t.Errorf("unexpected diff (+wanted, -got): %s", diff)
if !reflect.DeepEqual(got, tt.expected) {
t.Fatalf(
"Got:\n\n%#v\n\nExpected:\n\n%#v\n",
got,
tt.expected)
}
})
}
Expand Down Expand Up @@ -1106,8 +1109,11 @@ func Test_flattenTargetParameters(t *testing.T) {
t.Run(name, func(t *testing.T) {
got := flattenTargetParameters(tt.config)

if diff := cmp.Diff(got, tt.expected); diff != "" {
t.Errorf("unexpected diff (+wanted, -got): %s", diff)
if !reflect.DeepEqual(got, tt.expected) {
t.Fatalf(
"Got:\n\n%#v\n\nExpected:\n\n%#v\n",
got,
tt.expected)
}
})
}
Expand Down

0 comments on commit 270783e

Please sign in to comment.