Skip to content

Commit

Permalink
Switch from github.com/golang/mock to go.uber.org/mock
Browse files Browse the repository at this point in the history
The Golang version is no longer maintained, and the developers have directed
people to use Uber's fork.
  • Loading branch information
barrettj12 committed Jul 12, 2023
1 parent 643341b commit 68269f6
Show file tree
Hide file tree
Showing 955 changed files with 1,200 additions and 1,184 deletions.
2 changes: 1 addition & 1 deletion agent/addons/addons_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"runtime"
"time"

"github.com/golang/mock/gomock"
"github.com/juju/clock"
"github.com/juju/errors"
"github.com/juju/loggo"
Expand All @@ -17,6 +16,7 @@ import (
"github.com/juju/worker/v3"
"github.com/juju/worker/v3/dependency"
"github.com/prometheus/client_golang/prometheus"
"go.uber.org/mock/gomock"
gc "gopkg.in/check.v1"

"github.com/juju/juju/agent/addons"
Expand Down
2 changes: 1 addition & 1 deletion agent/addons/engine_mock_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions agent/addons/package_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
gc "gopkg.in/check.v1"
)

//go:generate go run github.com/golang/mock/mockgen -package addons_test -destination prometheus_mock_test.go github.com/prometheus/client_golang/prometheus Registerer
//go:generate go run github.com/golang/mock/mockgen -package addons_test -destination engine_mock_test.go github.com/juju/juju/cmd/jujud/agent/engine MetricSink
//go:generate go run go.uber.org/mock/mockgen -package addons_test -destination prometheus_mock_test.go github.com/prometheus/client_golang/prometheus Registerer
//go:generate go run go.uber.org/mock/mockgen -package addons_test -destination engine_mock_test.go github.com/juju/juju/cmd/jujud/agent/engine MetricSink

func Test(t *testing.T) {
gc.TestingT(t)
Expand Down
2 changes: 1 addition & 1 deletion agent/addons/prometheus_mock_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/agent/instancemutater/instancemutater_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ package instancemutater_test
import (
"time"

"github.com/golang/mock/gomock"
"github.com/juju/errors"
"github.com/juju/names/v4"
jc "github.com/juju/testing/checkers"
"go.uber.org/mock/gomock"
gc "gopkg.in/check.v1"

"github.com/juju/juju/api/agent/instancemutater"
Expand Down
2 changes: 1 addition & 1 deletion api/agent/instancemutater/machine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ package instancemutater_test
import (
"time"

"github.com/golang/mock/gomock"
"github.com/juju/errors"
"github.com/juju/names/v4"
jc "github.com/juju/testing/checkers"
"go.uber.org/mock/gomock"
gc "gopkg.in/check.v1"

"github.com/juju/juju/api/agent/instancemutater"
Expand Down
2 changes: 1 addition & 1 deletion api/agent/instancemutater/mocks/caller_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/agent/instancemutater/mocks/machinemutater_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions api/agent/instancemutater/package_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
gc "gopkg.in/check.v1"
)

//go:generate go run github.com/golang/mock/mockgen -package mocks -destination mocks/caller_mock.go github.com/juju/juju/api/base APICaller,FacadeCaller
//go:generate go run github.com/golang/mock/mockgen -package mocks -destination mocks/machinemutater_mock.go github.com/juju/juju/api/agent/instancemutater MutaterMachine
//go:generate go run go.uber.org/mock/mockgen -package mocks -destination mocks/caller_mock.go github.com/juju/juju/api/base APICaller,FacadeCaller
//go:generate go run go.uber.org/mock/mockgen -package mocks -destination mocks/machinemutater_mock.go github.com/juju/juju/api/agent/instancemutater MutaterMachine

func TestAll(t *testing.T) {
gc.TestingT(t)
Expand Down
2 changes: 1 addition & 1 deletion api/agent/provisioner/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"github.com/juju/juju/rpc/params"
)

//go:generate go run github.com/golang/mock/mockgen -package mocks -destination mocks/machine_mock.go github.com/juju/juju/api/agent/provisioner MachineProvisioner
//go:generate go run go.uber.org/mock/mockgen -package mocks -destination mocks/machine_mock.go github.com/juju/juju/api/agent/provisioner MachineProvisioner

// MachineProvisioner defines what provisioner needs to provision a machine.
type MachineProvisioner interface {
Expand Down
2 changes: 1 addition & 1 deletion api/agent/provisioner/mocks/machine_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/agent/provisioner/provisioner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import (
"fmt"
"time"

"github.com/golang/mock/gomock"
"github.com/juju/errors"
"github.com/juju/names/v4"
jc "github.com/juju/testing/checkers"
"github.com/juju/utils/v3"
"github.com/juju/utils/v3/arch"
"go.uber.org/mock/gomock"
gc "gopkg.in/check.v1"

"github.com/juju/juju/api"
Expand Down
2 changes: 1 addition & 1 deletion api/agent/upgradeseries/upgradeseries_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
package upgradeseries_test

import (
"github.com/golang/mock/gomock"
"github.com/juju/errors"
"github.com/juju/names/v4"
"github.com/juju/testing"
jc "github.com/juju/testing/checkers"
"go.uber.org/mock/gomock"
gc "gopkg.in/check.v1"

"github.com/juju/juju/api/agent/upgradeseries"
Expand Down
2 changes: 1 addition & 1 deletion api/agent/upgradesteps/upgradesteps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
package upgradesteps_test

import (
"github.com/golang/mock/gomock"
"github.com/juju/names/v4"
jc "github.com/juju/testing/checkers"
"go.uber.org/mock/gomock"
gc "gopkg.in/check.v1"

"github.com/juju/juju/api/agent/upgradesteps"
Expand Down
2 changes: 1 addition & 1 deletion api/base/caller.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"gopkg.in/macaroon.v2"
)

//go:generate go run github.com/golang/mock/mockgen -package mocks -destination mocks/caller_mock.go github.com/juju/juju/api/base APICaller,FacadeCaller
//go:generate go run go.uber.org/mock/mockgen -package mocks -destination mocks/caller_mock.go github.com/juju/juju/api/base APICaller,FacadeCaller

// APICaller is implemented by the client-facing State object.
// It defines the lowest level of API calls and is used by
Expand Down
2 changes: 1 addition & 1 deletion api/base/clientfacade.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type APICallCloser interface {
// BestAPIVersion() is used to allow for compatibility testing, and Close() is
// used to indicate when we are done with the connection.
//
//go:generate go run github.com/golang/mock/mockgen -package mocks -destination mocks/clientfacade_mock.go github.com/juju/juju/api/base APICallCloser,ClientFacade
//go:generate go run go.uber.org/mock/mockgen -package mocks -destination mocks/clientfacade_mock.go github.com/juju/juju/api/base APICallCloser,ClientFacade
type ClientFacade interface {
// BestAPIVersion returns the API version that we were able to
// determine is supported by both the client and the API Server
Expand Down
2 changes: 1 addition & 1 deletion api/base/mocks/caller_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/base/mocks/clientfacade_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/client/backups/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ package backups
import (
"time"

"github.com/golang/mock/gomock"
"github.com/juju/testing"
"go.uber.org/mock/gomock"
gc "gopkg.in/check.v1"

"github.com/juju/juju/api/base/mocks"
Expand Down
2 changes: 1 addition & 1 deletion api/client/backups/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
package backups

import (
"github.com/golang/mock/gomock"
jc "github.com/juju/testing/checkers"
"go.uber.org/mock/gomock"
gc "gopkg.in/check.v1"

apiserverbackups "github.com/juju/juju/apiserver/facades/client/backups"
Expand Down
2 changes: 1 addition & 1 deletion api/client/charms/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import (
"os"
"strings"

"github.com/golang/mock/gomock"
"github.com/juju/charm/v10"
charmresource "github.com/juju/charm/v10/resource"
"github.com/juju/errors"
jc "github.com/juju/testing/checkers"
"github.com/juju/version/v2"
"go.uber.org/mock/gomock"
gc "gopkg.in/check.v1"
"gopkg.in/httprequest.v1"

Expand Down
2 changes: 1 addition & 1 deletion api/client/charms/downloader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"net/http"
"strings"

"github.com/golang/mock/gomock"
"github.com/juju/charm/v10"
jc "github.com/juju/testing/checkers"
"go.uber.org/mock/gomock"
gc "gopkg.in/check.v1"
"gopkg.in/httprequest.v1"

Expand Down
2 changes: 1 addition & 1 deletion api/client/machinemanager/machinemanagernew_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ The plan is to start moving those old style tests and when finished delete the o
package machinemanager_test

import (
"github.com/golang/mock/gomock"
"github.com/juju/errors"
"github.com/juju/names/v4"
jc "github.com/juju/testing/checkers"
"go.uber.org/mock/gomock"
gc "gopkg.in/check.v1"

"github.com/juju/juju/api/base/mocks"
Expand Down
2 changes: 1 addition & 1 deletion api/client/modelgeneration/modelgeneration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ package modelgeneration_test
import (
"time"

"github.com/golang/mock/gomock"
jc "github.com/juju/testing/checkers"
"go.uber.org/mock/gomock"
gc "gopkg.in/check.v1"

"github.com/juju/juju/api/base/mocks"
Expand Down
2 changes: 1 addition & 1 deletion api/client/modelupgrader/mocks/apibase_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/client/modelupgrader/mocks/context_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/client/modelupgrader/mocks/httprequest_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions api/client/modelupgrader/package_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
gc "gopkg.in/check.v1"
)

//go:generate go run github.com/golang/mock/mockgen -package mocks -destination mocks/apibase_mock.go github.com/juju/juju/api/base APICallCloser
//go:generate go run github.com/golang/mock/mockgen -package mocks -destination mocks/httprequest_mock.go gopkg.in/httprequest.v1 Doer
//go:generate go run github.com/golang/mock/mockgen -package mocks -destination mocks/context_mock.go context Context
//go:generate go run go.uber.org/mock/mockgen -package mocks -destination mocks/apibase_mock.go github.com/juju/juju/api/base APICallCloser
//go:generate go run go.uber.org/mock/mockgen -package mocks -destination mocks/httprequest_mock.go gopkg.in/httprequest.v1 Doer
//go:generate go run go.uber.org/mock/mockgen -package mocks -destination mocks/context_mock.go context Context

func TestAll(t *testing.T) {
gc.TestingT(t)
Expand Down
2 changes: 1 addition & 1 deletion api/client/modelupgrader/upgrader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"net/http"
"strings"

"github.com/golang/mock/gomock"
jc "github.com/juju/testing/checkers"
"github.com/juju/version/v2"
"go.uber.org/mock/gomock"
gc "gopkg.in/check.v1"
"gopkg.in/httprequest.v1"

Expand Down
2 changes: 1 addition & 1 deletion api/client/payloads/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
package payloads_test

import (
"github.com/golang/mock/gomock"
"github.com/juju/charm/v10"
"github.com/juju/names/v4"
"github.com/juju/testing"
jc "github.com/juju/testing/checkers"
"go.uber.org/mock/gomock"
gc "gopkg.in/check.v1"

"github.com/juju/juju/api/base/mocks"
Expand Down
2 changes: 1 addition & 1 deletion api/client/resources/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ package resources_test
import (
"time"

"github.com/golang/mock/gomock"
"github.com/juju/testing"
"go.uber.org/mock/gomock"
gc "gopkg.in/check.v1"

"github.com/juju/juju/api/base/mocks"
Expand Down
2 changes: 1 addition & 1 deletion api/client/resources/client_listresources_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
package resources_test

import (
"github.com/golang/mock/gomock"
"github.com/juju/errors"
jc "github.com/juju/testing/checkers"
"go.uber.org/mock/gomock"
gc "gopkg.in/check.v1"

"github.com/juju/juju/core/resources"
Expand Down
2 changes: 1 addition & 1 deletion api/client/resources/client_upload_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import (
"reflect"
"strings"

"github.com/golang/mock/gomock"
"github.com/juju/charm/v10"
charmresource "github.com/juju/charm/v10/resource"
"github.com/juju/errors"
jc "github.com/juju/testing/checkers"
"github.com/juju/utils/v3"
"github.com/kr/pretty"
"go.uber.org/mock/gomock"
gc "gopkg.in/check.v1"

"github.com/juju/juju/api/client/resources"
Expand Down
2 changes: 1 addition & 1 deletion api/client/spaces/spaces_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"fmt"
"math/rand"

"github.com/golang/mock/gomock"
"github.com/juju/names/v4"
jc "github.com/juju/testing/checkers"
"go.uber.org/mock/gomock"
gc "gopkg.in/check.v1"

"github.com/juju/juju/api/base/mocks"
Expand Down
2 changes: 1 addition & 1 deletion api/common/charms/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
package charms_test

import (
"github.com/golang/mock/gomock"
"github.com/juju/charm/v10"
"github.com/juju/charm/v10/resource"
"github.com/juju/version/v2"
"go.uber.org/mock/gomock"
gc "gopkg.in/check.v1"

basemocks "github.com/juju/juju/api/base/mocks"
Expand Down
2 changes: 1 addition & 1 deletion api/common/leadership_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ package common_test
import (
"errors"

"github.com/golang/mock/gomock"
"github.com/juju/names/v4"
jc "github.com/juju/testing/checkers"
"go.uber.org/mock/gomock"
gc "gopkg.in/check.v1"

"github.com/juju/juju/api/base/mocks"
Expand Down
2 changes: 1 addition & 1 deletion api/common/network_mock_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 68269f6

Please sign in to comment.