Skip to content

Commit

Permalink
chore: resolve golangci-lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ekristen committed Apr 23, 2024
1 parent 40ff152 commit 53967b2
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 16 deletions.
5 changes: 3 additions & 2 deletions resources/elasticache-memcacheclusters.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ package resources

import (
"context"
"github.com/aws/aws-sdk-go/service/elasticache/elasticacheiface"
"github.com/ekristen/libnuke/pkg/types"

"github.com/sirupsen/logrus"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/elasticache"
"github.com/aws/aws-sdk-go/service/elasticache/elasticacheiface"

"github.com/ekristen/libnuke/pkg/registry"
"github.com/ekristen/libnuke/pkg/resource"
"github.com/ekristen/libnuke/pkg/types"

"github.com/ekristen/aws-nuke/pkg/nuke"
)
Expand Down
17 changes: 10 additions & 7 deletions resources/elasticache-memcacheclusters_mock_test.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
package resources

import (
"context"
"testing"

"github.com/golang/mock/gomock"
"github.com/stretchr/testify/assert"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/elasticache"

"github.com/ekristen/aws-nuke/mocks/mock_elasticacheiface"
"github.com/ekristen/aws-nuke/pkg/nuke"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/assert"
"testing"
)

func Test_Mock_ElastiCache_CacheCluster_Remove(t *testing.T) {
Expand All @@ -26,7 +30,7 @@ func Test_Mock_ElastiCache_CacheCluster_Remove(t *testing.T) {
CacheClusterId: aws.String("foobar"),
}).Return(&elasticache.DeleteCacheClusterOutput{}, nil)

err := cacheCluster.Remove(nil)
err := cacheCluster.Remove(context.TODO())
a.Nil(err)
}

Expand Down Expand Up @@ -54,7 +58,7 @@ func Test_Mock_ElastiCache_CacheCluster_List_NoTags(t *testing.T) {
ResourceName: aws.String("foobar"),
}).Return(&elasticache.TagListMessage{}, nil)

resources, err := cacheClusterLister.List(nil, &nuke.ListerOpts{})
resources, err := cacheClusterLister.List(context.TODO(), &nuke.ListerOpts{})
a.Nil(err)
a.Len(resources, 1)

Expand Down Expand Up @@ -96,7 +100,7 @@ func Test_Mock_ElastiCache_CacheCluster_List_WithTags(t *testing.T) {
},
}, nil)

resources, err := cacheClusterLister.List(nil, &nuke.ListerOpts{})
resources, err := cacheClusterLister.List(context.TODO(), &nuke.ListerOpts{})
a.Nil(err)
a.Len(resources, 1)

Expand All @@ -105,5 +109,4 @@ func Test_Mock_ElastiCache_CacheCluster_List_WithTags(t *testing.T) {
a.Equal("foobar", resource.String())
a.Equal("foobar", resource.Properties().Get("tag:Name"))
a.Equal("test", resource.Properties().Get("tag:aws-nuke"))

}
7 changes: 4 additions & 3 deletions resources/elasticache-subnetgroups.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ package resources
import (
"context"
"fmt"
"github.com/aws/aws-sdk-go/service/elasticache/elasticacheiface"
"github.com/ekristen/libnuke/pkg/types"
"github.com/sirupsen/logrus"
"strings"

"github.com/sirupsen/logrus"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/elasticache"
"github.com/aws/aws-sdk-go/service/elasticache/elasticacheiface"

"github.com/ekristen/libnuke/pkg/registry"
"github.com/ekristen/libnuke/pkg/resource"
"github.com/ekristen/libnuke/pkg/types"

"github.com/ekristen/aws-nuke/pkg/nuke"
)
Expand Down
11 changes: 7 additions & 4 deletions resources/elasticache-subnetgroups_mock_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package resources

import (
"context"
"testing"

"github.com/golang/mock/gomock"
Expand All @@ -25,9 +26,11 @@ func Test_Mock_ElastiCache_SubnetGroup_Remove(t *testing.T) {
name: aws.String("foobar"),
}

mockElastiCache.EXPECT().DeleteCacheSubnetGroup(gomock.Any()).Return(&elasticache.DeleteCacheSubnetGroupOutput{}, nil)
mockElastiCache.EXPECT().DeleteCacheSubnetGroup(&elasticache.DeleteCacheSubnetGroupInput{
CacheSubnetGroupName: aws.String("foobar"),
}).Return(&elasticache.DeleteCacheSubnetGroupOutput{}, nil)

err := subnetGroup.Remove(nil)
err := subnetGroup.Remove(context.TODO())
a.Nil(err)
a.Equal("foobar", *subnetGroup.name)
}
Expand Down Expand Up @@ -55,7 +58,7 @@ func Test_Mock_ElastiCache_SubnetGroup_List_NoTags(t *testing.T) {
ResourceName: aws.String("foobar"),
}).Return(&elasticache.TagListMessage{}, nil)

resources, err := subnetGroupsLister.List(nil, &nuke.ListerOpts{})
resources, err := subnetGroupsLister.List(context.TODO(), &nuke.ListerOpts{})
a.Nil(err)
a.Len(resources, 1)

Expand Down Expand Up @@ -99,7 +102,7 @@ func Test_Mock_ElastiCache_SubnetGroup_List_WithTags(t *testing.T) {
},
}, nil)

resources, err := subnetGroupsLister.List(nil, &nuke.ListerOpts{})
resources, err := subnetGroupsLister.List(context.TODO(), &nuke.ListerOpts{})
a.Nil(err)

a.Len(resources, 1)
Expand Down

0 comments on commit 53967b2

Please sign in to comment.