Skip to content

Commit

Permalink
MG-2193 - Generate mocks for proto interface (absmach#2324)
Browse files Browse the repository at this point in the history
Signed-off-by: JeffMboya <[email protected]>
  • Loading branch information
JeffMboya authored Jul 12, 2024
1 parent 04c3594 commit 468362a
Show file tree
Hide file tree
Showing 23 changed files with 1,330 additions and 191 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/check-generated-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ jobs:
- "twins/states.go"
- "twins/service.go"
- "journal/journal.go"
- "magistrala/auth_grpc.pb.go"
- name: Set up protoc
if: steps.changes.outputs.proto == 'true'
Expand Down Expand Up @@ -160,6 +161,7 @@ jobs:
mv ./twins/mocks/cache.go ./twins/mocks/cache.go.tmp
mv ./journal/mocks/repository.go ./journal/mocks/repository.go.tmp
mv ./journal/mocks/service.go ./journal/mocks/service.go.tmp
mv ./auth/mocks/auth_client.go ./auth/mocks/auth_client.go.tmp
make mocks
Expand Down Expand Up @@ -213,3 +215,4 @@ jobs:
check_mock_changes ./twins/mocks/cache.go "Twins Cache ./twins/mocks/cache.go"
check_mock_changes ./journal/mocks/repository.go "Journal Repository ./journal/mocks/repository.go"
check_mock_changes ./journal/mocks/service.go "Journal Service ./journal/mocks/service.go"
check_mock_changes ./auth/mocks/auth_client.go "Auth Service Client ./auth/mocks/auth_client.go"
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
uses: golangci/golangci-lint-action@v6
with:
version: v1.59.1
args: --config ./tools/config/.golangci.yml

- name: Build all Binaries
run: |
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ FILTERED_SERVICES = $(filter-out $(RUN_ADDON_ARGS), $(SERVICES))

all: $(SERVICES)

.PHONY: all $(SERVICES) dockers dockers_dev latest release run run_addons grpc_mtls_certs check_mtls check_certs test_api
.PHONY: all $(SERVICES) dockers dockers_dev latest release run run_addons grpc_mtls_certs check_mtls check_certs test_api mocks

clean:
rm -rf ${BUILD_DIR}
Expand All @@ -121,6 +121,7 @@ install:
mocks:
@which mockery > /dev/null || go install github.com/vektra/mockery/v2@$(MOCKERY_VERSION)
@unset MOCKERY_VERSION && go generate ./...
mockery --config ./tools/config/mockery.yaml


DIRS = consumers readers postgres internal opcua
Expand Down
2 changes: 1 addition & 1 deletion auth/api/grpc/endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,7 @@ func TestListPermissions(t *testing.T) {
}

func TestDeleteEntityPolicies(t *testing.T) {
conn, err := grpc.Dial(authAddr, grpc.WithTransportCredentials(insecure.NewCredentials()))
conn, err := grpc.NewClient(authAddr, grpc.WithTransportCredentials(insecure.NewCredentials()))
assert.Nil(t, err, fmt.Sprintf("Unexpected error creating client connection %s", err))
client := grpcapi.NewClient(conn, time.Second)

Expand Down
Loading

0 comments on commit 468362a

Please sign in to comment.