diff --git a/Makefile b/Makefile index 75ea833..d16753d 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -MOCKGEN := go run github.com/golang/mock/mockgen@v1.6.0 +MOCKGEN := go run go.uber.org/mock/mockgen .PHONY: test test: go test ./... -coverprofile=coverage.txt -covermode=count @@ -9,7 +9,8 @@ push-test-container: test-container docker push loilodev/http-server:latest version: go run cli/cage/main.go -v | cut -f 3 -d ' ' -mocks: mocks/mock_awsiface/iface.go \ +mocks: go.sum \ + mocks/mock_awsiface/iface.go \ mocks/mock_types/iface.go \ mocks/mock_upgrade/upgrade.go \ mocks/mock_task/task.go \ diff --git a/cli/cage/commands/command_test.go b/cli/cage/commands/command_test.go index 804e702..346b084 100644 --- a/cli/cage/commands/command_test.go +++ b/cli/cage/commands/command_test.go @@ -5,13 +5,13 @@ import ( "strings" "testing" - "github.com/golang/mock/gomock" "github.com/loilo-inc/canarycage/env" "github.com/loilo-inc/canarycage/mocks/mock_types" "github.com/loilo-inc/canarycage/test" "github.com/loilo-inc/canarycage/types" "github.com/stretchr/testify/assert" "github.com/urfave/cli/v2" + "go.uber.org/mock/gomock" ) func TestCommands(t *testing.T) { diff --git a/cli/cage/commands/upgrade_test.go b/cli/cage/commands/upgrade_test.go index 1b24474..e7122a8 100644 --- a/cli/cage/commands/upgrade_test.go +++ b/cli/cage/commands/upgrade_test.go @@ -3,12 +3,12 @@ package commands_test import ( "testing" - "github.com/golang/mock/gomock" "github.com/loilo-inc/canarycage/cli/cage/commands" "github.com/loilo-inc/canarycage/cli/cage/upgrade" "github.com/loilo-inc/canarycage/mocks/mock_upgrade" "github.com/stretchr/testify/assert" "github.com/urfave/cli/v2" + "go.uber.org/mock/gomock" ) func TestUpgrade(t *testing.T) { diff --git a/go.mod b/go.mod index 4639c0f..105ad40 100644 --- a/go.mod +++ b/go.mod @@ -9,12 +9,12 @@ require ( github.com/aws/aws-sdk-go-v2/service/ec2 v1.161.4 github.com/aws/aws-sdk-go-v2/service/ecs v1.41.11 github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.31.1 - github.com/golang/mock v1.6.0 github.com/google/go-github/v62 v62.0.0 github.com/google/uuid v1.6.0 github.com/jarcoal/httpmock v1.3.1 github.com/stretchr/testify v1.9.0 github.com/urfave/cli/v2 v2.27.2 + go.uber.org/mock v0.4.0 ) require github.com/google/go-querystring v1.1.0 // indirect diff --git a/go.sum b/go.sum index 7ea82f3..663d6ea 100644 --- a/go.sum +++ b/go.sum @@ -47,8 +47,6 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= -github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= @@ -116,38 +114,24 @@ github.com/urfave/cli/v2 v2.27.2 h1:6e0H+AkS+zDckwPCUrZkKX38mRaau4nL2uipkJpbkcI= github.com/urfave/cli/v2 v2.27.2/go.mod h1:g0+79LmHHATl7DAcHO99smiR/T7uGLw84w8Y42x+4eM= github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4= github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= +go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU= golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/mocks/mock_awsiface/iface.go b/mocks/mock_awsiface/iface.go index 4fac71b..a7dc97d 100644 --- a/mocks/mock_awsiface/iface.go +++ b/mocks/mock_awsiface/iface.go @@ -11,7 +11,7 @@ import ( ec2 "github.com/aws/aws-sdk-go-v2/service/ec2" ecs "github.com/aws/aws-sdk-go-v2/service/ecs" elasticloadbalancingv2 "github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockEcsClient is a mock of EcsClient interface. diff --git a/mocks/mock_rollout/executor.go b/mocks/mock_rollout/executor.go index 97296be..4ee039e 100644 --- a/mocks/mock_rollout/executor.go +++ b/mocks/mock_rollout/executor.go @@ -8,7 +8,7 @@ import ( context "context" reflect "reflect" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" types "github.com/loilo-inc/canarycage/types" ) diff --git a/mocks/mock_task/factory.go b/mocks/mock_task/factory.go index fbcee8e..eb99313 100644 --- a/mocks/mock_task/factory.go +++ b/mocks/mock_task/factory.go @@ -8,7 +8,7 @@ import ( reflect "reflect" types "github.com/aws/aws-sdk-go-v2/service/ecs/types" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" task "github.com/loilo-inc/canarycage/task" ) diff --git a/mocks/mock_task/task.go b/mocks/mock_task/task.go index fa6ea25..d991706 100644 --- a/mocks/mock_task/task.go +++ b/mocks/mock_task/task.go @@ -8,7 +8,7 @@ import ( context "context" reflect "reflect" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockTask is a mock of Task interface. diff --git a/mocks/mock_taskset/taskset.go b/mocks/mock_taskset/taskset.go index 8127ce8..3cd1520 100644 --- a/mocks/mock_taskset/taskset.go +++ b/mocks/mock_taskset/taskset.go @@ -8,7 +8,7 @@ import ( context "context" reflect "reflect" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockSet is a mock of Set interface. diff --git a/mocks/mock_types/iface.go b/mocks/mock_types/iface.go index 29f83b1..a119993 100644 --- a/mocks/mock_types/iface.go +++ b/mocks/mock_types/iface.go @@ -9,7 +9,7 @@ import ( reflect "reflect" time "time" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" types "github.com/loilo-inc/canarycage/types" ) diff --git a/mocks/mock_upgrade/upgrade.go b/mocks/mock_upgrade/upgrade.go index 452603b..70de7a7 100644 --- a/mocks/mock_upgrade/upgrade.go +++ b/mocks/mock_upgrade/upgrade.go @@ -7,7 +7,7 @@ package mock_upgrade import ( reflect "reflect" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" upgrade "github.com/loilo-inc/canarycage/cli/cage/upgrade" ) diff --git a/rollout/executor_test.go b/rollout/executor_test.go index 8d60197..b20d785 100644 --- a/rollout/executor_test.go +++ b/rollout/executor_test.go @@ -7,7 +7,6 @@ import ( "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/service/ecs" ecstypes "github.com/aws/aws-sdk-go-v2/service/ecs/types" - "github.com/golang/mock/gomock" "github.com/loilo-inc/canarycage/env" "github.com/loilo-inc/canarycage/key" "github.com/loilo-inc/canarycage/mocks/mock_awsiface" @@ -17,6 +16,7 @@ import ( "github.com/loilo-inc/canarycage/types" "github.com/loilo-inc/logos/di" "github.com/stretchr/testify/assert" + "go.uber.org/mock/gomock" ) func TestNewExecutor(t *testing.T) { diff --git a/rollout_test.go b/rollout_test.go index d7c1136..c28859e 100644 --- a/rollout_test.go +++ b/rollout_test.go @@ -10,7 +10,6 @@ import ( ecstypes "github.com/aws/aws-sdk-go-v2/service/ecs/types" alb "github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2" albtypes "github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2/types" - "github.com/golang/mock/gomock" "github.com/loilo-inc/canarycage/env" "github.com/loilo-inc/canarycage/key" "github.com/loilo-inc/canarycage/mocks/mock_awsiface" @@ -19,6 +18,7 @@ import ( "github.com/loilo-inc/canarycage/types" "github.com/loilo-inc/logos/di" "github.com/stretchr/testify/assert" + "go.uber.org/mock/gomock" ) // fake integration test with test.MockContext diff --git a/run_test.go b/run_test.go index ac91ca3..efa9a74 100644 --- a/run_test.go +++ b/run_test.go @@ -7,7 +7,6 @@ import ( "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/service/ecs" ecstypes "github.com/aws/aws-sdk-go-v2/service/ecs/types" - "github.com/golang/mock/gomock" cage "github.com/loilo-inc/canarycage" "github.com/loilo-inc/canarycage/env" "github.com/loilo-inc/canarycage/key" @@ -16,6 +15,7 @@ import ( "github.com/loilo-inc/canarycage/types" "github.com/loilo-inc/logos/di" "github.com/stretchr/testify/assert" + "go.uber.org/mock/gomock" ) func TestCage_Run(t *testing.T) { diff --git a/task/alb_task_test.go b/task/alb_task_test.go index e652d34..650403a 100644 --- a/task/alb_task_test.go +++ b/task/alb_task_test.go @@ -13,13 +13,13 @@ import ( ecstypes "github.com/aws/aws-sdk-go-v2/service/ecs/types" elbv2 "github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2" elbv2types "github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2/types" - "github.com/golang/mock/gomock" "github.com/loilo-inc/canarycage/env" "github.com/loilo-inc/canarycage/key" "github.com/loilo-inc/canarycage/mocks/mock_awsiface" "github.com/loilo-inc/canarycage/test" "github.com/loilo-inc/logos/di" "github.com/stretchr/testify/assert" + "go.uber.org/mock/gomock" ) func TestNewAlbTask(t *testing.T) { diff --git a/task/common_test.go b/task/common_test.go index 1d0113a..438fcd0 100644 --- a/task/common_test.go +++ b/task/common_test.go @@ -9,7 +9,6 @@ import ( "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/service/ecs" ecstypes "github.com/aws/aws-sdk-go-v2/service/ecs/types" - "github.com/golang/mock/gomock" "github.com/loilo-inc/canarycage/env" "github.com/loilo-inc/canarycage/key" "github.com/loilo-inc/canarycage/mocks/mock_awsiface" @@ -17,6 +16,7 @@ import ( "github.com/loilo-inc/canarycage/test" "github.com/loilo-inc/logos/di" "github.com/stretchr/testify/assert" + "go.uber.org/mock/gomock" ) func TestCommon_Start(t *testing.T) { diff --git a/task/simple_task_test.go b/task/simple_task_test.go index 3d164e1..8a25409 100644 --- a/task/simple_task_test.go +++ b/task/simple_task_test.go @@ -8,13 +8,13 @@ import ( "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/service/ecs" ecstypes "github.com/aws/aws-sdk-go-v2/service/ecs/types" - "github.com/golang/mock/gomock" "github.com/loilo-inc/canarycage/key" "github.com/loilo-inc/canarycage/mocks/mock_awsiface" "github.com/loilo-inc/canarycage/mocks/mock_types" "github.com/loilo-inc/canarycage/test" "github.com/loilo-inc/logos/di" "github.com/stretchr/testify/assert" + "go.uber.org/mock/gomock" ) func TestNewSimpleTask(t *testing.T) { diff --git a/task_definition_test.go b/task_definition_test.go index dc96c02..a688608 100644 --- a/task_definition_test.go +++ b/task_definition_test.go @@ -6,13 +6,13 @@ import ( "github.com/aws/aws-sdk-go-v2/service/ecs" ecstypes "github.com/aws/aws-sdk-go-v2/service/ecs/types" - "github.com/golang/mock/gomock" "github.com/loilo-inc/canarycage/env" "github.com/loilo-inc/canarycage/key" "github.com/loilo-inc/canarycage/mocks/mock_awsiface" "github.com/loilo-inc/canarycage/test" "github.com/loilo-inc/logos/di" "github.com/stretchr/testify/assert" + "go.uber.org/mock/gomock" "golang.org/x/xerrors" ) diff --git a/taskset/taskset_test.go b/taskset/taskset_test.go index f433384..2e672b1 100644 --- a/taskset/taskset_test.go +++ b/taskset/taskset_test.go @@ -6,11 +6,11 @@ import ( "testing" ecstypes "github.com/aws/aws-sdk-go-v2/service/ecs/types" - "github.com/golang/mock/gomock" "github.com/loilo-inc/canarycage/mocks/mock_task" "github.com/loilo-inc/canarycage/task" "github.com/loilo-inc/canarycage/taskset" "github.com/stretchr/testify/assert" + "go.uber.org/mock/gomock" ) func TestSet(t *testing.T) { diff --git a/test/setup.go b/test/setup.go index 8c351dd..1ff9a88 100644 --- a/test/setup.go +++ b/test/setup.go @@ -10,9 +10,9 @@ import ( "github.com/aws/aws-sdk-go-v2/service/ecs" ecstypes "github.com/aws/aws-sdk-go-v2/service/ecs/types" elbv2 "github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2" - "github.com/golang/mock/gomock" "github.com/loilo-inc/canarycage/env" "github.com/loilo-inc/canarycage/mocks/mock_awsiface" + "go.uber.org/mock/gomock" ) func Setup(ctrl *gomock.Controller, envars *env.Envars, currentTaskCount int, launchType ecstypes.LaunchType) ( diff --git a/up_test.go b/up_test.go index e929dfd..92a2b5d 100644 --- a/up_test.go +++ b/up_test.go @@ -4,12 +4,12 @@ import ( "context" "testing" - "github.com/golang/mock/gomock" cage "github.com/loilo-inc/canarycage" "github.com/loilo-inc/canarycage/key" "github.com/loilo-inc/canarycage/test" "github.com/loilo-inc/logos/di" "github.com/stretchr/testify/assert" + "go.uber.org/mock/gomock" ) func TestCage_Up(t *testing.T) {