Skip to content

Commit 270783e

Browse files
committed
pipes: Use 'reflect.DeepEquals' in unit tests.
1 parent 3d5cef3 commit 270783e

File tree

3 files changed

+38
-17
lines changed

3 files changed

+38
-17
lines changed

internal/service/pipes/enrichment_parameters_test.go

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package pipes
22

33
import (
4+
"reflect"
45
"testing"
56

67
"github.com/aws/aws-sdk-go-v2/service/pipes/types"
78
"github.com/aws/aws-sdk-go/aws"
8-
"github.com/google/go-cmp/cmp"
99
)
1010

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

71-
if diff := cmp.Diff(got, tt.expected); diff != "" {
72-
t.Errorf("unexpected diff (+wanted, -got): %s", diff)
71+
if !reflect.DeepEqual(got, tt.expected) {
72+
t.Fatalf(
73+
"Got:\n\n%#v\n\nExpected:\n\n%#v\n",
74+
got,
75+
tt.expected)
7376
}
7477
})
7578
}
@@ -139,8 +142,11 @@ func Test_flattenEnrichmentParameters(t *testing.T) {
139142
t.Run(name, func(t *testing.T) {
140143
got := flattenEnrichmentParameters(tt.config)
141144

142-
if diff := cmp.Diff(got, tt.expected); diff != "" {
143-
t.Errorf("unexpected diff (+wanted, -got): %s", diff)
145+
if !reflect.DeepEqual(got, tt.expected) {
146+
t.Fatalf(
147+
"Got:\n\n%#v\n\nExpected:\n\n%#v\n",
148+
got,
149+
tt.expected)
144150
}
145151
})
146152
}

internal/service/pipes/source_parameters_test.go

+16-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package pipes
22

33
import (
4+
"reflect"
45
"testing"
56
"time"
67

78
"github.com/aws/aws-sdk-go-v2/service/pipes/types"
89
"github.com/aws/aws-sdk-go/aws"
9-
"github.com/google/go-cmp/cmp"
1010
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
1111
)
1212

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

547-
if diff := cmp.Diff(got, tt.expected); diff != "" {
548-
t.Errorf("unexpected diff (+wanted, -got): %s", diff)
547+
if !reflect.DeepEqual(got, tt.expected) {
548+
t.Fatalf(
549+
"Got:\n\n%#v\n\nExpected:\n\n%#v\n",
550+
got,
551+
tt.expected)
549552
}
550553
})
551554
}
@@ -1025,8 +1028,11 @@ func Test_flattenSourceParameters(t *testing.T) {
10251028
t.Run(name, func(t *testing.T) {
10261029
got := flattenSourceParameters(tt.config)
10271030

1028-
if diff := cmp.Diff(got, tt.expected); diff != "" {
1029-
t.Errorf("unexpected diff (+wanted, -got): %s", diff)
1031+
if !reflect.DeepEqual(got, tt.expected) {
1032+
t.Fatalf(
1033+
"Got:\n\n%#v\n\nExpected:\n\n%#v\n",
1034+
got,
1035+
tt.expected)
10301036
}
10311037
})
10321038
}
@@ -1498,8 +1504,11 @@ func Test_expandSourceUpdateParameters(t *testing.T) {
14981504
t.Run(name, func(t *testing.T) {
14991505
got := expandSourceUpdateParameters([]interface{}{tt.config})
15001506

1501-
if diff := cmp.Diff(got, tt.expected); diff != "" {
1502-
t.Errorf("unexpected diff (+wanted, -got): %s", diff)
1507+
if !reflect.DeepEqual(got, tt.expected) {
1508+
t.Fatalf(
1509+
"Got:\n\n%#v\n\nExpected:\n\n%#v\n",
1510+
got,
1511+
tt.expected)
15031512
}
15041513
})
15051514
}

internal/service/pipes/target_parameters_test.go

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package pipes
22

33
import (
4+
"reflect"
45
"testing"
56

67
"github.com/aws/aws-sdk-go-v2/aws"
78
"github.com/aws/aws-sdk-go-v2/service/pipes/types"
8-
"github.com/google/go-cmp/cmp"
99
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
1010
)
1111

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

545-
if diff := cmp.Diff(got, tt.expected); diff != "" {
546-
t.Errorf("unexpected diff (+wanted, -got): %s", diff)
545+
if !reflect.DeepEqual(got, tt.expected) {
546+
t.Fatalf(
547+
"Got:\n\n%#v\n\nExpected:\n\n%#v\n",
548+
got,
549+
tt.expected)
547550
}
548551
})
549552
}
@@ -1106,8 +1109,11 @@ func Test_flattenTargetParameters(t *testing.T) {
11061109
t.Run(name, func(t *testing.T) {
11071110
got := flattenTargetParameters(tt.config)
11081111

1109-
if diff := cmp.Diff(got, tt.expected); diff != "" {
1110-
t.Errorf("unexpected diff (+wanted, -got): %s", diff)
1112+
if !reflect.DeepEqual(got, tt.expected) {
1113+
t.Fatalf(
1114+
"Got:\n\n%#v\n\nExpected:\n\n%#v\n",
1115+
got,
1116+
tt.expected)
11111117
}
11121118
})
11131119
}

0 commit comments

Comments
 (0)