Skip to content

Commit

Permalink
pipes: Use 'go-cmp' in unit tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
ewbankkit committed Jun 9, 2023
1 parent 3229613 commit 3d5cef3
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 12 deletions.
10 changes: 7 additions & 3 deletions internal/service/pipes/enrichment_parameters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

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

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

assert.Equal(t, tt.expected, got)
if diff := cmp.Diff(got, tt.expected); diff != "" {
t.Errorf("unexpected diff (+wanted, -got): %s", diff)
}
})
}
}
Expand Down Expand Up @@ -137,7 +139,9 @@ func Test_flattenEnrichmentParameters(t *testing.T) {
t.Run(name, func(t *testing.T) {
got := flattenEnrichmentParameters(tt.config)

assert.Equal(t, tt.expected, got)
if diff := cmp.Diff(got, tt.expected); diff != "" {
t.Errorf("unexpected diff (+wanted, -got): %s", diff)
}
})
}
}
14 changes: 10 additions & 4 deletions internal/service/pipes/source_parameters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (

"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"
"github.com/stretchr/testify/assert"
)

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

assert.Equal(t, tt.expected, got)
if diff := cmp.Diff(got, tt.expected); diff != "" {
t.Errorf("unexpected diff (+wanted, -got): %s", diff)
}
})
}
}
Expand Down Expand Up @@ -1023,7 +1025,9 @@ func Test_flattenSourceParameters(t *testing.T) {
t.Run(name, func(t *testing.T) {
got := flattenSourceParameters(tt.config)

assert.Equal(t, tt.expected, got)
if diff := cmp.Diff(got, tt.expected); diff != "" {
t.Errorf("unexpected diff (+wanted, -got): %s", diff)
}
})
}
}
Expand Down Expand Up @@ -1494,7 +1498,9 @@ func Test_expandSourceUpdateParameters(t *testing.T) {
t.Run(name, func(t *testing.T) {
got := expandSourceUpdateParameters([]interface{}{tt.config})

assert.Equal(t, tt.expected, got)
if diff := cmp.Diff(got, tt.expected); diff != "" {
t.Errorf("unexpected diff (+wanted, -got): %s", diff)
}
})
}
}
4 changes: 2 additions & 2 deletions internal/service/pipes/target_parameters.go
Original file line number Diff line number Diff line change
Expand Up @@ -1693,7 +1693,7 @@ func flattenTargetBatchContainerOverrides(parameters *types.BatchContainerOverri
config := make(map[string]interface{})

if parameters.Command != nil {
config["command"] = flex.FlattenStringValueSet(parameters.Command)
config["command"] = flex.FlattenStringValueList(parameters.Command)
}
if parameters.InstanceType != nil {
config["instance_type"] = aws.ToString(parameters.InstanceType)
Expand Down Expand Up @@ -1891,7 +1891,7 @@ func flattenTargetECSTaskOverrideContainerOverride(parameters types.EcsContainer
config["name"] = aws.ToString(parameters.Name)
}
if parameters.Command != nil {
config["command"] = flex.FlattenStringValueSet(parameters.Command)
config["command"] = flex.FlattenStringValueList(parameters.Command)
}

var environmentValues []map[string]interface{}
Expand Down
10 changes: 7 additions & 3 deletions internal/service/pipes/target_parameters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (

"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"
"github.com/stretchr/testify/assert"
)

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

assert.Equal(t, tt.expected, got)
if diff := cmp.Diff(got, tt.expected); diff != "" {
t.Errorf("unexpected diff (+wanted, -got): %s", diff)
}
})
}
}
Expand Down Expand Up @@ -1104,7 +1106,9 @@ func Test_flattenTargetParameters(t *testing.T) {
t.Run(name, func(t *testing.T) {
got := flattenTargetParameters(tt.config)

assert.Equal(t, tt.expected, got)
if diff := cmp.Diff(got, tt.expected); diff != "" {
t.Errorf("unexpected diff (+wanted, -got): %s", diff)
}
})
}
}

0 comments on commit 3d5cef3

Please sign in to comment.