Skip to content

Commit

Permalink
feat: Migrating mock library
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Boutour <[email protected]>
  • Loading branch information
ViBiOh committed Aug 11, 2023
1 parent 61fe851 commit ce27345
Show file tree
Hide file tree
Showing 16 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ dev: format style test build
.PHONY: init
init:
@curl --disable --silent --show-error --location --max-time 30 "https://raw.githubusercontent.com/ViBiOh/scripts/main/bootstrap" | bash -s -- "-c" "git_hooks" "coverage" "release"
go install "github.com/golang/mock/[email protected]"
go install "github.com/golangci/golangci-lint/cmd/golangci-lint@latest"
go install "golang.org/x/tools/cmd/goimports@latest"
go install "golang.org/x/tools/go/analysis/passes/fieldalignment/cmd/fieldalignment@master"
Expand All @@ -77,6 +76,7 @@ style:
## mocks: Generate mocks
.PHONY: mocks
mocks:
go install "go.uber.org/mock/mockgen@latest"
find . -name "mocks" -type d -exec rm -r "{}" \+
go generate -run mockgen $(PACKAGES)
mockgen -destination pkg/mocks/pgx.go -package mocks -mock_names Row=Row,Rows=Rows github.com/jackc/pgx/v5 Row,Rows
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ require (
github.com/jackc/pgx/v5 v5.4.3
github.com/prometheus/client_golang v1.16.0
go.opentelemetry.io/otel/trace v1.16.0
go.uber.org/mock v0.2.0
gopkg.in/yaml.v3 v3.0.1
)

Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lI
go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM=
go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A=
go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4=
go.uber.org/mock v0.2.0 h1:TaP3xedm7JaAgScZO7tlvlKrqT0p7I6OsdGB5YNSMDU=
go.uber.org/mock v0.2.0/go.mod h1:J0y0rp9L3xiff1+ZBfKxlC1fz2+aO16tw0tsDOixfuM=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk=
Expand Down
2 changes: 1 addition & 1 deletion pkg/middleware/middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/ViBiOh/httputils/v4/pkg/request"
"github.com/ViBiOh/ketchup/pkg/mocks"
"github.com/ViBiOh/ketchup/pkg/model"
"github.com/golang/mock/gomock"
"go.uber.org/mock/gomock"
)

func TestMiddleware(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/mocks/database.go

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

2 changes: 1 addition & 1 deletion pkg/mocks/interfaces.go

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

2 changes: 1 addition & 1 deletion pkg/mocks/pgx.go

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

2 changes: 1 addition & 1 deletion pkg/notifier/notifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/ViBiOh/ketchup/pkg/mocks"
"github.com/ViBiOh/ketchup/pkg/model"
"github.com/ViBiOh/ketchup/pkg/semver"
"github.com/golang/mock/gomock"
"go.uber.org/mock/gomock"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion pkg/notifier/releases_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/ViBiOh/ketchup/pkg/mocks"
"github.com/ViBiOh/ketchup/pkg/model"
"github.com/ViBiOh/ketchup/pkg/semver"
"github.com/golang/mock/gomock"
"go.uber.org/mock/gomock"
)

func TestGetNewStandardReleases(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/service/ketchup/ketchup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
httpModel "github.com/ViBiOh/httputils/v4/pkg/model"
"github.com/ViBiOh/ketchup/pkg/mocks"
"github.com/ViBiOh/ketchup/pkg/model"
"github.com/golang/mock/gomock"
"go.uber.org/mock/gomock"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion pkg/service/repository/repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/ViBiOh/ketchup/pkg/mocks"
"github.com/ViBiOh/ketchup/pkg/model"
"github.com/ViBiOh/ketchup/pkg/semver"
"github.com/golang/mock/gomock"
"go.uber.org/mock/gomock"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion pkg/service/user/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
httpModel "github.com/ViBiOh/httputils/v4/pkg/model"
"github.com/ViBiOh/ketchup/pkg/mocks"
"github.com/ViBiOh/ketchup/pkg/model"
"github.com/golang/mock/gomock"
"go.uber.org/mock/gomock"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion pkg/store/ketchup/ketchup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
authModel "github.com/ViBiOh/auth/v2/pkg/model"
"github.com/ViBiOh/ketchup/pkg/mocks"
"github.com/ViBiOh/ketchup/pkg/model"
"github.com/golang/mock/gomock"
"github.com/jackc/pgx/v5"
"go.uber.org/mock/gomock"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion pkg/store/repository/repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (

"github.com/ViBiOh/ketchup/pkg/mocks"
"github.com/ViBiOh/ketchup/pkg/model"
"github.com/golang/mock/gomock"
"github.com/jackc/pgx/v5"
"go.uber.org/mock/gomock"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion pkg/store/repository/repository_version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (

"github.com/ViBiOh/ketchup/pkg/mocks"
"github.com/ViBiOh/ketchup/pkg/model"
"github.com/golang/mock/gomock"
"github.com/jackc/pgx/v5"
"go.uber.org/mock/gomock"
)

var errFailed = errors.New("timeout")
Expand Down
2 changes: 1 addition & 1 deletion pkg/store/user/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
authModel "github.com/ViBiOh/auth/v2/pkg/model"
"github.com/ViBiOh/ketchup/pkg/mocks"
"github.com/ViBiOh/ketchup/pkg/model"
"github.com/golang/mock/gomock"
"github.com/jackc/pgx/v5"
"go.uber.org/mock/gomock"
)

var testEmail = "nobody@localhost"
Expand Down

0 comments on commit ce27345

Please sign in to comment.