Skip to content

Commit

Permalink
Migrate gomock to go.uber.org/mock/mockgen (#622)
Browse files Browse the repository at this point in the history
* Migrate off deprecated gomock module: dependency updates

* Generate updated mocks and package imports

* Ensure pagerduty is configured for mock generation
  • Loading branch information
joshbranham authored Oct 30, 2024
1 parent 6502be6 commit 3492862
Show file tree
Hide file tree
Showing 28 changed files with 174 additions and 149 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ mockgen: ensure-mockgen
@git diff --exit-code -- ./pkg/provider/aws/mock

ensure-mockgen:
GOBIN=${BASE_DIR}/bin/ go install github.com/golang/mock/mockgen@v1.6.0
GOBIN=${BASE_DIR}/bin/ go install go.uber.org/mock/mockgen@v0.5.0

test:
go test ${BUILDFLAGS} ./... -covermode=atomic -coverpkg=./...
Expand Down
2 changes: 1 addition & 1 deletion cmd/account/get/account-claim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"strings"
"testing"

"github.com/golang/mock/gomock"
. "github.com/onsi/gomega"
"go.uber.org/mock/gomock"

mockk8s "github.com/openshift/osdctl/cmd/hive/clusterdeployment/mock/k8s"
"github.com/openshift/osdctl/internal/utils/globalflags"
Expand Down
2 changes: 1 addition & 1 deletion cmd/account/get/account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"strings"
"testing"

"github.com/golang/mock/gomock"
. "github.com/onsi/gomega"
"go.uber.org/mock/gomock"

mockk8s "github.com/openshift/osdctl/cmd/hive/clusterdeployment/mock/k8s"
"github.com/openshift/osdctl/internal/utils/globalflags"
Expand Down
2 changes: 1 addition & 1 deletion cmd/account/get/id_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"strings"
"testing"

"github.com/golang/mock/gomock"
. "github.com/onsi/gomega"
"go.uber.org/mock/gomock"

mockk8s "github.com/openshift/osdctl/cmd/hive/clusterdeployment/mock/k8s"
"k8s.io/cli-runtime/pkg/genericclioptions"
Expand Down
2 changes: 1 addition & 1 deletion cmd/account/get/legal-entity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"strings"
"testing"

"github.com/golang/mock/gomock"
. "github.com/onsi/gomega"
"go.uber.org/mock/gomock"

mockk8s "github.com/openshift/osdctl/cmd/hive/clusterdeployment/mock/k8s"
"github.com/openshift/osdctl/internal/utils/globalflags"
Expand Down
2 changes: 1 addition & 1 deletion cmd/account/get/secrets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"strings"
"testing"

"github.com/golang/mock/gomock"
. "github.com/onsi/gomega"
"go.uber.org/mock/gomock"

mockk8s "github.com/openshift/osdctl/cmd/hive/clusterdeployment/mock/k8s"
"github.com/openshift/osdctl/internal/utils/globalflags"
Expand Down
2 changes: 1 addition & 1 deletion cmd/account/list/account-claim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"strings"
"testing"

"github.com/golang/mock/gomock"
. "github.com/onsi/gomega"
"go.uber.org/mock/gomock"

mockk8s "github.com/openshift/osdctl/cmd/hive/clusterdeployment/mock/k8s"
"github.com/openshift/osdctl/internal/utils/globalflags"
Expand Down
2 changes: 1 addition & 1 deletion cmd/account/list/account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"strings"
"testing"

"github.com/golang/mock/gomock"
. "github.com/onsi/gomega"
"go.uber.org/mock/gomock"

mockk8s "github.com/openshift/osdctl/cmd/hive/clusterdeployment/mock/k8s"
"github.com/openshift/osdctl/internal/utils/globalflags"
Expand Down
2 changes: 1 addition & 1 deletion cmd/account/mgmt/account-assign_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"github.com/aws/aws-sdk-go-v2/service/organizations"
organizationTypes "github.com/aws/aws-sdk-go-v2/service/organizations/types"
"github.com/aws/aws-sdk-go-v2/service/sts"
"github.com/golang/mock/gomock"
awsprovider "github.com/openshift/osdctl/pkg/provider/aws"
"github.com/openshift/osdctl/pkg/provider/aws/mock"
"go.uber.org/mock/gomock"
)

func TestIsOwned(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/account/mgmt/account-list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
organizationTypes "github.com/aws/aws-sdk-go-v2/service/organizations/types"
"github.com/aws/aws-sdk-go-v2/service/resourcegroupstaggingapi"
resourceGroupsTaggingApiTypes "github.com/aws/aws-sdk-go-v2/service/resourcegroupstaggingapi/types"
"github.com/golang/mock/gomock"
"github.com/openshift/osdctl/pkg/provider/aws/mock"
"go.uber.org/mock/gomock"
)

type mocks struct {
Expand Down
2 changes: 1 addition & 1 deletion cmd/account/mgmt/account-unassign_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import (
resourceGroupsTaggingApiTypes "github.com/aws/aws-sdk-go-v2/service/resourcegroupstaggingapi/types"
"github.com/aws/aws-sdk-go-v2/service/sts"
stsTypes "github.com/aws/aws-sdk-go-v2/service/sts/types"
"github.com/golang/mock/gomock"
"github.com/openshift/osdctl/internal/utils/globalflags"
awsInternal "github.com/openshift/osdctl/pkg/provider/aws"
"github.com/openshift/osdctl/pkg/provider/aws/mock"
"github.com/spf13/viper"
"go.uber.org/mock/gomock"
"k8s.io/cli-runtime/pkg/genericclioptions"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/account/reset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"strings"
"testing"

"github.com/golang/mock/gomock"
. "github.com/onsi/gomega"
"go.uber.org/mock/gomock"

mockk8s "github.com/openshift/osdctl/cmd/hive/clusterdeployment/mock/k8s"
"k8s.io/cli-runtime/pkg/genericclioptions"
Expand Down
2 changes: 1 addition & 1 deletion cmd/account/set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"strings"
"testing"

"github.com/golang/mock/gomock"
. "github.com/onsi/gomega"
"go.uber.org/mock/gomock"

mockk8s "github.com/openshift/osdctl/cmd/hive/clusterdeployment/mock/k8s"
"k8s.io/cli-runtime/pkg/genericclioptions"
Expand Down
2 changes: 1 addition & 1 deletion cmd/account/verify-secrets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"strings"
"testing"

"github.com/golang/mock/gomock"
. "github.com/onsi/gomega"
"go.uber.org/mock/gomock"

mockk8s "github.com/openshift/osdctl/cmd/hive/clusterdeployment/mock/k8s"
"k8s.io/cli-runtime/pkg/genericclioptions"
Expand Down
2 changes: 1 addition & 1 deletion cmd/cost/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"github.com/aws/aws-sdk-go-v2/service/costexplorer"
"github.com/aws/aws-sdk-go-v2/service/organizations"
organizationTypes "github.com/aws/aws-sdk-go-v2/service/organizations/types"
"github.com/golang/mock/gomock"
"github.com/onsi/gomega"
"github.com/openshift/osdctl/pkg/provider/aws/mock"
"go.uber.org/mock/gomock"
)

type mockSuite struct {
Expand Down
2 changes: 1 addition & 1 deletion cmd/cost/reconcile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
costExplorerTypes "github.com/aws/aws-sdk-go-v2/service/costexplorer/types"
"github.com/aws/aws-sdk-go-v2/service/organizations"
organizationTypes "github.com/aws/aws-sdk-go-v2/service/organizations/types"
"github.com/golang/mock/gomock"
"github.com/onsi/gomega"
"github.com/openshift/osdctl/pkg/provider/aws/mock"
"go.uber.org/mock/gomock"
)

func TestReconcileCostCategories(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/hive/clusterdeployment/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package clusterdeployment
import (
"testing"

"github.com/golang/mock/gomock"
. "github.com/onsi/gomega"
"go.uber.org/mock/gomock"

mockk8s "github.com/openshift/osdctl/cmd/hive/clusterdeployment/mock/k8s"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/hive/clusterdeployment/listresources_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package clusterdeployment_test
import (
"testing"

"github.com/golang/mock/gomock"
awsv1alpha1 "github.com/openshift/aws-account-operator/api/v1alpha1"
. "github.com/openshift/osdctl/cmd/hive/clusterdeployment"
mockk8s "github.com/openshift/osdctl/cmd/hive/clusterdeployment/mock/k8s"
mockprinter "github.com/openshift/osdctl/cmd/hive/clusterdeployment/mock/printer"
"github.com/spf13/cobra"
"go.uber.org/mock/gomock"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"

. "github.com/onsi/gomega"
Expand Down
Loading

0 comments on commit 3492862

Please sign in to comment.