Skip to content

Commit

Permalink
Fix relevant components discovery hannes (#9)
Browse files Browse the repository at this point in the history
* mocks: use go run to reduce dependency

Using go run will automatically install the tool and run it if it is not
installed already.

* argocd: fix import path

The import path for the mocks package is incorrect causing errors.

The mocks package should be imported from internal/pkg/mocks instead of
mocks/argocd.

This also removes the aliased import and uses the package as named,
which aligns with the directory name.

---------

Co-authored-by: Hannes Gustafsson <[email protected]>
  • Loading branch information
Oded-B and hnnsgstfssn authored May 30, 2024
1 parent 2b76230 commit 8a157ff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions internal/pkg/argocd/argocd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

argoappv1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
"github.com/golang/mock/gomock"
argo_app_mock "github.com/wayfair-incubator/telefonistka/mocks/argocd"
"github.com/wayfair-incubator/telefonistka/internal/pkg/mocks"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand All @@ -21,7 +21,7 @@ func TestFindArgocdAppBySHA1Label(t *testing.T) {
ctx := context.Background()
ctrl := gomock.NewController(t)
defer ctrl.Finish()
mockApplicationClient := argo_app_mock.NewMockApplicationServiceClient(ctrl)
mockApplicationClient := mocks.NewMockApplicationServiceClient(ctrl)

Check failure on line 24 in internal/pkg/argocd/argocd_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

undefined: mocks.NewMockApplicationServiceClient
expectedResponse := &argoappv1.ApplicationList{
Items: []argoappv1.Application{
{
Expand Down Expand Up @@ -51,7 +51,7 @@ func TestFindArgocdAppByPathAnnotation(t *testing.T) {
ctx := context.Background()
ctrl := gomock.NewController(t)
defer ctrl.Finish()
mockApplicationClient := argo_app_mock.NewMockApplicationServiceClient(ctrl)
mockApplicationClient := mocks.NewMockApplicationServiceClient(ctrl)

Check failure on line 54 in internal/pkg/argocd/argocd_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

undefined: mocks.NewMockApplicationServiceClient
expectedResponse := &argoappv1.ApplicationList{
Items: []argoappv1.Application{
{
Expand Down Expand Up @@ -89,7 +89,7 @@ func TestFindArgocdAppByPathAnnotationSemiColon(t *testing.T) {
ctx := context.Background()
ctrl := gomock.NewController(t)
defer ctrl.Finish()
mockApplicationClient := argo_app_mock.NewMockApplicationServiceClient(ctrl)
mockApplicationClient := mocks.NewMockApplicationServiceClient(ctrl)

Check failure on line 92 in internal/pkg/argocd/argocd_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

undefined: mocks.NewMockApplicationServiceClient
expectedResponse := &argoappv1.ApplicationList{
Items: []argoappv1.Application{
{
Expand Down Expand Up @@ -129,7 +129,7 @@ func TestFindArgocdAppByPathAnnotationRelative(t *testing.T) {
ctx := context.Background()
ctrl := gomock.NewController(t)
defer ctrl.Finish()
mockApplicationClient := argo_app_mock.NewMockApplicationServiceClient(ctrl)
mockApplicationClient := mocks.NewMockApplicationServiceClient(ctrl)

Check failure on line 132 in internal/pkg/argocd/argocd_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

undefined: mocks.NewMockApplicationServiceClient
expectedResponse := &argoappv1.ApplicationList{
Items: []argoappv1.Application{
{
Expand Down Expand Up @@ -165,7 +165,7 @@ func TestFindArgocdAppByPathAnnotationRelative2(t *testing.T) {
ctx := context.Background()
ctrl := gomock.NewController(t)
defer ctrl.Finish()
mockApplicationClient := argo_app_mock.NewMockApplicationServiceClient(ctrl)
mockApplicationClient := mocks.NewMockApplicationServiceClient(ctrl)

Check failure on line 168 in internal/pkg/argocd/argocd_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

undefined: mocks.NewMockApplicationServiceClient (typecheck)
expectedResponse := &argoappv1.ApplicationList{
Items: []argoappv1.Application{
{
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/mocks/mocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ package mocks

// mockgen -package=mocks -destination authenticator.go k8s.io/apiserver/pkg/authentication/authenticator Token
// mockgen -source=../../../vendor/github.com/argoproj/argo-cd/v2/pkg/apiclient/application/application.pb.go -destination=mock_argocd_application.go -package=mocks
//go:generate mockgen -destination=argocd_application.go -package=mocks github.com/argoproj/argo-cd/v2/pkg/apiclient/application ApplicationServiceClient
//go:generate go run github.com/golang/mock/mockgen@v1.6.0 -destination=argocd_application.go -package=mocks github.com/argoproj/argo-cd/v2/pkg/apiclient/application ApplicationServiceClient

0 comments on commit 8a157ff

Please sign in to comment.