Skip to content

Commit

Permalink
chore(mockery): add mockery configuration (#4941)
Browse files Browse the repository at this point in the history
* update mockery config

* update mockery config

* rename mockery config

* update existing mocks

* update mockery config

* update mockery config

* move cmd mocks to cmd pkg

* add hadolint mocks to config

* use moved files

* remove comment
  • Loading branch information
CCFenner authored Jun 4, 2024
1 parent 683ca35 commit 0ca2f72
Show file tree
Hide file tree
Showing 25 changed files with 1,562 additions and 148 deletions.
27 changes: 21 additions & 6 deletions .mockery.yaml → .mockery.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
quiet: false
mockname: "{{.InterfaceName}}"
filename: "{{.InterfaceName}}.go"
dir: "{{.InterfaceDir}}/mocks"
outpkg: mocks
quiet: false
packages:
github.com/SAP/jenkins-library/cmd:
interfaces:
GithubRepoClient:
HadolintPiperFileUtils:
HadolintClient:
github.com/SAP/jenkins-library/pkg/config:
interfaces:
VaultClient:
github.com/SAP/jenkins-library/pkg/jenkins:
interfaces:
Artifact:
Build:
CredentialsManager:
Jenkins:
Job:
Task:
github.com/SAP/jenkins-library/pkg/kubernetes:
interfaces:
HelmExecutor:
github.com/influxdata/influxdb-client-go/v2:
config:
dir: pkg/influx/mocks
Expand All @@ -13,8 +33,3 @@ packages:
dir: pkg/influx/mocks
interfaces:
WriteAPIBlocking:
github.com/SAP/jenkins-library/pkg/config:
config:
dir: pkg/config/mocks
interfaces:
VaultClient:
1 change: 0 additions & 1 deletion cmd/githubPublishRelease.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
piperGithub "github.com/SAP/jenkins-library/pkg/github"
)

// mock generated with: mockery --name GithubRepoClient --dir cmd --output cmd/mocks
type GithubRepoClient interface {
CreateRelease(ctx context.Context, owner string, repo string, release *github.RepositoryRelease) (*github.RepositoryRelease, *github.Response, error)
DeleteReleaseAsset(ctx context.Context, owner string, repo string, id int64) (*github.Response, error)
Expand Down
2 changes: 0 additions & 2 deletions cmd/hadolintExecute.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@ import (
const hadolintCommand = "hadolint"

// HadolintPiperFileUtils abstracts piperutils.Files
// mock generated with: mockery --name HadolintPiperFileUtils --dir cmd --output pkg/hadolint/mocks
type HadolintPiperFileUtils interface {
FileExists(filename string) (bool, error)
FileWrite(filename string, data []byte, perm os.FileMode) error
WriteFile(filename string, data []byte, perm os.FileMode) error
}

// HadolintClient abstracts http.Client
// mock generated with: mockery --name hadolintClient --dir cmd --output pkg/hadolint/mocks
type HadolintClient interface {
SetOptions(options piperhttp.ClientOptions)
DownloadFile(url, filename string, header http.Header, cookies []*http.Cookie) error
Expand Down
2 changes: 1 addition & 1 deletion cmd/hadolintExecute_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package cmd
import (
"testing"

"github.com/SAP/jenkins-library/pkg/hadolint/mocks"
"github.com/SAP/jenkins-library/cmd/mocks"
piperMocks "github.com/SAP/jenkins-library/pkg/mock"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
Expand Down
Loading

0 comments on commit 0ca2f72

Please sign in to comment.