Skip to content

Commit

Permalink
MG-2173 - Generate mocks with mockery for Twins service (#2174)
Browse files Browse the repository at this point in the history
Signed-off-by: nyagamunene <[email protected]>
  • Loading branch information
nyagamunene authored Apr 23, 2024
1 parent 07635ad commit 8915b73
Show file tree
Hide file tree
Showing 49 changed files with 1,591 additions and 892 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/check-generated-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ jobs:
- "certs/certs.go"
- "certs/pki/vault.go"
- "certs/service.go"
- "twins/twins.go"
- "twins/states.go"
- "twins/service.go"
- name: Set up protoc
if: steps.changes.outputs.proto == 'true'
Expand Down Expand Up @@ -115,7 +118,7 @@ jobs:
- name: Check Mocks are up to Date
if: steps.changes.outputs.mocks == 'true'
run: |
MOCKERY_VERSION=v2.42.1
MOCKERY_VERSION=v2.42.3
go install github.com/vektra/mockery/v2@$MOCKERY_VERSION
mv ./pkg/sdk/mocks/sdk.go ./pkg/sdk/mocks/sdk.go.tmp
Expand Down Expand Up @@ -150,6 +153,10 @@ jobs:
mv ./certs/mocks/certs.go ./certs/mocks/certs.go.tmp
mv ./certs/mocks/pki.go ./certs/mocks/pki.go.tmp
mv ./certs/mocks/service.go ./certs/mocks/service.go.tmp
mv ./twins/mocks/service.go ./twins/mocks/service.go.tmp
mv ./twins/mocks/states.go ./twins/mocks/states.go.tmp
mv ./twins/mocks/repository.go ./twins/mocks/repository.go.tmp
mv ./twins/mocks/cache.go ./twins/mocks/cache.go.tmp
make mocks
Expand Down Expand Up @@ -197,3 +204,7 @@ jobs:
check_mock_changes ./certs/mocks/certs.go "Certs Repository ./certs/mocks/certs.go"
check_mock_changes ./certs/mocks/pki.go "PKI ./certs/mocks/pki.go"
check_mock_changes ./certs/mocks/service.go "Certs Service ./certs/mocks/service.go"
check_mock_changes ./twins/mocks/service.go "Twins Service ./twins/mocks/service.go"
check_mock_changes ./twins/mocks/states.go "Twins States ./twins/mocks/states.go"
check_mock_changes ./twins/mocks/repository.go "Twins Repository ./twins/mocks/repository.go"
check_mock_changes ./twins/mocks/cache.go "Twins Cache ./twins/mocks/cache.go"
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ DOCKER_PROJECT ?= $(shell echo $(subst $(space),,$(USER_REPO)) | tr -c -s '[:aln
DOCKER_COMPOSE_COMMANDS_SUPPORTED := up down config
DEFAULT_DOCKER_COMPOSE_COMMAND := up
GRPC_MTLS_CERT_FILES_EXISTS = 0
MOCKERY_VERSION=v2.42.1
MOCKERY_VERSION=v2.42.3
ifneq ($(MG_MESSAGE_BROKER_TYPE),)
MG_MESSAGE_BROKER_TYPE := $(MG_MESSAGE_BROKER_TYPE)
else
Expand Down
2 changes: 1 addition & 1 deletion auth/mocks/agent.go

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

2 changes: 1 addition & 1 deletion auth/mocks/authz.go

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

2 changes: 1 addition & 1 deletion auth/mocks/domains.go

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

2 changes: 1 addition & 1 deletion auth/mocks/keys.go

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

2 changes: 1 addition & 1 deletion auth/mocks/service.go

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

2 changes: 1 addition & 1 deletion bootstrap/mocks/configs.go

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

2 changes: 1 addition & 1 deletion bootstrap/mocks/service.go

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

2 changes: 1 addition & 1 deletion certs/mocks/certs.go

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

2 changes: 1 addition & 1 deletion certs/mocks/pki.go

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

2 changes: 1 addition & 1 deletion certs/mocks/service.go

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

2 changes: 1 addition & 1 deletion consumers/notifiers/mocks/notifier.go

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

2 changes: 1 addition & 1 deletion consumers/notifiers/mocks/repository.go

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

2 changes: 1 addition & 1 deletion consumers/notifiers/mocks/service.go

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

2 changes: 1 addition & 1 deletion invitations/mocks/repository.go

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

2 changes: 1 addition & 1 deletion invitations/mocks/service.go

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

2 changes: 0 additions & 2 deletions lora/adapter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,6 @@ func TestPublish(t *testing.T) {
repoCall2 := connsRM.On("Get", context.Background(), mock.Anything).Return("", tc.connectionsErr)
repoCall3 := pub.On("Publish", context.Background(), tc.msg.ApplicationID, mock.Anything).Return(tc.publishErr)
err := svc.Publish(context.Background(), &tc.msg)
fmt.Println(err)
fmt.Println(tc.err)
assert.True(t, errors.Contains(err, tc.err), fmt.Sprintf("%s: expected %s got %s\n", tc.desc, tc.err, err))
repoCall.Unset()
repoCall1.Unset()
Expand Down
2 changes: 1 addition & 1 deletion lora/mocks/routes.go

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

2 changes: 1 addition & 1 deletion mqtt/mocks/events.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/events/mocks/publisher.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/events/mocks/subscriber.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/groups/mocks/repository.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/groups/mocks/service.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/messaging/mocks/pubsub.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/oauth2/mocks/provider.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/sdk/mocks/sdk.go

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

2 changes: 1 addition & 1 deletion provision/mocks/service.go

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

2 changes: 1 addition & 1 deletion readers/mocks/messages.go

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

2 changes: 1 addition & 1 deletion things/mocks/cache.go

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

2 changes: 1 addition & 1 deletion things/mocks/repository.go

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

2 changes: 1 addition & 1 deletion things/mocks/service.go

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

Loading

0 comments on commit 8915b73

Please sign in to comment.