Skip to content

Commit

Permalink
Merge pull request #171 from appuio/fix/replace-gomock
Browse files Browse the repository at this point in the history
Replace github.com/golang/mock with go.uber.org/mock
  • Loading branch information
HappyTetrahedron authored Nov 29, 2023
2 parents 0573991 + 3a58c65 commit f585de6
Show file tree
Hide file tree
Showing 25 changed files with 81 additions and 61 deletions.
2 changes: 1 addition & 1 deletion apiserver/authwrapper/authorizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"k8s.io/apiserver/pkg/endpoints/filters"
)

//go:generate go run github.com/golang/mock/mockgen -destination=./mock/$GOFILE -package mock k8s.io/apiserver/pkg/authorization/authorizer Authorizer
//go:generate go run go.uber.org/mock/mockgen -destination=./mock/$GOFILE -package mock k8s.io/apiserver/pkg/authorization/authorizer Authorizer

// Authorizer processes authorization requests for `{rbacID.Resource}` and checks them based on rbac rules for `{rbacID}`
type Authorizer struct {
Expand Down
10 changes: 7 additions & 3 deletions apiserver/authwrapper/mock/authorizer.go

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

28 changes: 16 additions & 12 deletions apiserver/authwrapper/mock/storage.go

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

2 changes: 1 addition & 1 deletion apiserver/authwrapper/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"k8s.io/apiserver/pkg/registry/rest"
)

//go:generate go run github.com/golang/mock/mockgen -destination=./mock/$GOFILE -package mock k8s.io/apiserver/pkg/registry/rest StandardStorage,Storage,Responder
//go:generate go run go.uber.org/mock/mockgen -destination=./mock/$GOFILE -package mock k8s.io/apiserver/pkg/registry/rest StandardStorage,Storage,Responder

var _ StandardStorage = &authorizedStorageWithLister{}

Expand Down
2 changes: 1 addition & 1 deletion apiserver/authwrapper/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"strings"
"testing"

"github.com/golang/mock/gomock"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/watch"
Expand Down

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

2 changes: 1 addition & 1 deletion apiserver/billing/odoostorage/odoo/odoo8/client/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var (
ErrInvalidCredentials = errors.New("invalid credentials")
)

//go:generate go run github.com/golang/mock/mockgen -destination=./clientmock/$GOFILE -package clientmock . QueryExecutor
//go:generate go run go.uber.org/mock/mockgen -destination=./clientmock/$GOFILE -package clientmock . QueryExecutor

// QueryExecutor runs queries against Odoo API.
type QueryExecutor interface {
Expand Down
2 changes: 1 addition & 1 deletion apiserver/billing/odoostorage/odoo/odoo8/odoo8_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"testing"
"time"

"github.com/golang/mock/gomock"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

billingv1 "github.com/appuio/control-api/apis/billing/v1"
Expand Down
2 changes: 1 addition & 1 deletion apiserver/billing/rbac_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"context"
"testing"

"github.com/golang/mock/gomock"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"
rbacv1 "k8s.io/api/rbac/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down
2 changes: 1 addition & 1 deletion apiserver/organization/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"fmt"
"testing"

"github.com/golang/mock/gomock"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"

orgv1 "github.com/appuio/control-api/apis/organization/v1"
controlv1 "github.com/appuio/control-api/apis/v1"
Expand Down
2 changes: 1 addition & 1 deletion apiserver/organization/delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"errors"
"testing"

"github.com/golang/mock/gomock"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"

orgv1 "github.com/appuio/control-api/apis/organization/v1"

Expand Down
2 changes: 1 addition & 1 deletion apiserver/organization/get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"errors"
"testing"

"github.com/golang/mock/gomock"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"

orgv1 "github.com/appuio/control-api/apis/organization/v1"

Expand Down
2 changes: 1 addition & 1 deletion apiserver/organization/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"errors"
"testing"

"github.com/golang/mock/gomock"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"

orgv1 "github.com/appuio/control-api/apis/organization/v1"

Expand Down
2 changes: 1 addition & 1 deletion apiserver/organization/members.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

// memberProvider is an abstraction for interacting with the OrganizationMembers Object
//
//go:generate go run github.com/golang/mock/mockgen -source=$GOFILE -destination=./mock/$GOFILE
//go:generate go run go.uber.org/mock/mockgen -source=$GOFILE -destination=./mock/$GOFILE
type memberProvider interface {
CreateMembers(ctx context.Context, members *controlv1.OrganizationMembers) error
}
Expand Down
10 changes: 7 additions & 3 deletions apiserver/organization/mock/members.go

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

Loading

0 comments on commit f585de6

Please sign in to comment.