refactor(service): move service mocks into per-domain mocks subpackages

Move every pkg/service/<domain>/*_mocks.go into pkg/service/<domain>/mocks/
(package mocks) so generated mocks are no longer part of the packages under
test and stop depressing their coverage. Update the //go:generate directives
and the tests that referenced the mocks.
This commit is contained in:
Tosone committed 2026-09-27 12:37:00 +08:00
1 parent fe9b072a11
commit fb7f20e8c4
74 files changed
+295 -292

No files matched your search

@@ -29,7 +29,7 @@ import (
"github.com/go-sigma/sigma/pkg/authz"
"github.com/go-sigma/sigma/pkg/consts"
"github.com/go-sigma/sigma/pkg/dal/models"
svcanalytics "github.com/go-sigma/sigma/pkg/service/analytics"
analyticsmocks "github.com/go-sigma/sigma/pkg/service/analytics/mocks"
)
func TestGetUserPushHeatmap(t *testing.T) {
@@ -50,7 +50,7 @@ func TestGetUserPushHeatmap(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
ctrl := gomock.NewController(t)
service := svcanalytics.NewMockService(ctrl)
service := analyticsmocks.NewMockService(ctrl)
if tt.expectMock {
service.EXPECT().GetUserPushHeatmap(gomock.Any(), tt.userID, 30).Return([]api.DailyCount{}, nil)
}
@@ -84,7 +84,7 @@ func TestGetNamespaceTrends(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
ctrl := gomock.NewController(t)
service := svcanalytics.NewMockService(ctrl)
service := analyticsmocks.NewMockService(ctrl)
if tt.expectMock {
service.EXPECT().GetNamespaceTrends(gomock.Any(), "namespace-1", 7).Return([]api.NamespaceHourlyMetric{}, nil)
}
@@ -23,12 +23,12 @@ import (
"go.uber.org/mock/gomock"
"github.com/go-sigma/sigma/pkg/api"
svcartifact "github.com/go-sigma/sigma/pkg/service/artifacts"
artifactsmocks "github.com/go-sigma/sigma/pkg/service/artifacts/mocks"
)
func TestDeleteArtifact(t *testing.T) {
ctrl := gomock.NewController(t)
service := svcartifact.NewMockArtifactService(ctrl)
service := artifactsmocks.NewMockArtifactService(ctrl)
service.EXPECT().DeleteArtifact(gomock.Any(), "library/alpine", "sha256:abc").Return(nil)
recorder, c := newArtifactContext()
@@ -43,7 +43,7 @@ func TestDeleteArtifact(t *testing.T) {
func TestDeleteServiceError(t *testing.T) {
ctrl := gomock.NewController(t)
service := svcartifact.NewMockArtifactService(ctrl)
service := artifactsmocks.NewMockArtifactService(ctrl)
service.EXPECT().DeleteArtifact(gomock.Any(), "library/alpine", "sha256:abc").Return(errors.New("failed"))
recorder, c := newArtifactContext()
@@ -26,12 +26,12 @@ import (
"github.com/go-sigma/sigma/pkg/api"
"github.com/go-sigma/sigma/pkg/dal/models"
svcartifact "github.com/go-sigma/sigma/pkg/service/artifacts"
artifactsmocks "github.com/go-sigma/sigma/pkg/service/artifacts/mocks"
)
func TestGetArtifact(t *testing.T) {
ctrl := gomock.NewController(t)
service := svcartifact.NewMockArtifactService(ctrl)
service := artifactsmocks.NewMockArtifactService(ctrl)
service.EXPECT().GetArtifact(gomock.Any(), "library/alpine", "sha256:abc").Return(&models.Artifact{
ID: "artifact-1",
Digest: "sha256:abc",
@@ -52,7 +52,7 @@ func TestGetArtifact(t *testing.T) {
func TestGetServiceError(t *testing.T) {
ctrl := gomock.NewController(t)
service := svcartifact.NewMockArtifactService(ctrl)
service := artifactsmocks.NewMockArtifactService(ctrl)
service.EXPECT().GetArtifact(gomock.Any(), "library/alpine", "sha256:abc").Return(nil, errors.New("failed"))
recorder, c := newArtifactContext()
@@ -24,12 +24,12 @@ import (
"github.com/go-sigma/sigma/pkg/api"
"github.com/go-sigma/sigma/pkg/dal/models"
svcartifact "github.com/go-sigma/sigma/pkg/service/artifacts"
artifactsmocks "github.com/go-sigma/sigma/pkg/service/artifacts/mocks"
)
func TestListArtifact(t *testing.T) {
ctrl := gomock.NewController(t)
service := svcartifact.NewMockArtifactService(ctrl)
service := artifactsmocks.NewMockArtifactService(ctrl)
request := api.ListArtifactRequest{Namespace: "library", Repository: "library/alpine"}
service.EXPECT().ListArtifacts(gomock.Any(), request).Return([]*models.Artifact{{
ID: "artifact-1",
@@ -48,7 +48,7 @@ func TestListArtifact(t *testing.T) {
func TestListServiceError(t *testing.T) {
ctrl := gomock.NewController(t)
service := svcartifact.NewMockArtifactService(ctrl)
service := artifactsmocks.NewMockArtifactService(ctrl)
request := api.ListArtifactRequest{Namespace: "library", Repository: "library/alpine"}
service.EXPECT().ListArtifacts(gomock.Any(), request).Return(nil, int64(0), errors.New("failed"))
recorder, c := newArtifactContext()
+19 -19
View File
@@ -30,12 +30,12 @@ import (
"github.com/go-sigma/sigma/pkg/consts"
"github.com/go-sigma/sigma/pkg/dal/models"
"github.com/go-sigma/sigma/pkg/server/errcode"
svcbuilder "github.com/go-sigma/sigma/pkg/service/builders"
buildersmocks "github.com/go-sigma/sigma/pkg/service/builders/mocks"
)
func TestCreateBuilder(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcbuilder.NewMockBuilderService(ctrl)
serviceObj := buildersmocks.NewMockBuilderService(ctrl)
serviceObj.EXPECT().
CreateBuilder(gomock.Any(), "10", gomock.Any()).
Return(nil)
@@ -49,7 +49,7 @@ func TestCreateBuilder(t *testing.T) {
func TestCreateBuilderReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcbuilder.NewMockBuilderService(ctrl)
serviceObj := buildersmocks.NewMockBuilderService(ctrl)
serviceObj.EXPECT().
CreateBuilder(gomock.Any(), "10", gomock.Any()).
Return(errors.New("create failed"))
@@ -63,7 +63,7 @@ func TestCreateBuilderReturnsInternalError(t *testing.T) {
func TestCreateBuilderReturnsErrCode(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcbuilder.NewMockBuilderService(ctrl)
serviceObj := buildersmocks.NewMockBuilderService(ctrl)
serviceObj.EXPECT().
CreateBuilder(gomock.Any(), "10", gomock.Any()).
Return(errcode.HTTPErrCodeBadRequest.Detail("parameter 'dockerfile' is invalid"))
@@ -77,7 +77,7 @@ func TestCreateBuilderReturnsErrCode(t *testing.T) {
func TestUpdateBuilder(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcbuilder.NewMockBuilderService(ctrl)
serviceObj := buildersmocks.NewMockBuilderService(ctrl)
serviceObj.EXPECT().
UpdateBuilder(gomock.Any(), "10", "1", gomock.Any()).
Return(nil)
@@ -91,7 +91,7 @@ func TestUpdateBuilder(t *testing.T) {
func TestUpdateBuilderReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcbuilder.NewMockBuilderService(ctrl)
serviceObj := buildersmocks.NewMockBuilderService(ctrl)
serviceObj.EXPECT().
UpdateBuilder(gomock.Any(), "10", "1", gomock.Any()).
Return(errors.New("update failed"))
@@ -105,7 +105,7 @@ func TestUpdateBuilderReturnsInternalError(t *testing.T) {
func TestListRunners(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcbuilder.NewMockBuilderService(ctrl)
serviceObj := buildersmocks.NewMockBuilderService(ctrl)
serviceObj.EXPECT().
ListRunners(gomock.Any(), "1", gomock.Any(), gomock.Any()).
DoAndReturn(func(_ context.Context, builderID string, pagination api.Pagination, sort api.Sortable) ([]*models.BuilderRunner, int64, error) {
@@ -142,7 +142,7 @@ func TestListRunners(t *testing.T) {
func TestListRunnersReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcbuilder.NewMockBuilderService(ctrl)
serviceObj := buildersmocks.NewMockBuilderService(ctrl)
serviceObj.EXPECT().
ListRunners(gomock.Any(), "1", gomock.Any(), gomock.Any()).
Return(nil, int64(0), errors.New("list failed"))
@@ -156,7 +156,7 @@ func TestListRunnersReturnsInternalError(t *testing.T) {
func TestGetRunner(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcbuilder.NewMockBuilderService(ctrl)
serviceObj := buildersmocks.NewMockBuilderService(ctrl)
serviceObj.EXPECT().
GetRunner(gomock.Any(), "2").
Return(&models.BuilderRunner{
@@ -187,7 +187,7 @@ func TestGetRunner(t *testing.T) {
func TestGetRunnerReturnsForbiddenOnBuilderMismatch(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcbuilder.NewMockBuilderService(ctrl)
serviceObj := buildersmocks.NewMockBuilderService(ctrl)
serviceObj.EXPECT().
GetRunner(gomock.Any(), "2").
Return(&models.BuilderRunner{
@@ -208,7 +208,7 @@ func TestGetRunnerReturnsForbiddenOnBuilderMismatch(t *testing.T) {
func TestGetRunnerReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcbuilder.NewMockBuilderService(ctrl)
serviceObj := buildersmocks.NewMockBuilderService(ctrl)
serviceObj.EXPECT().
GetRunner(gomock.Any(), "2").
Return(nil, errors.New("get failed"))
@@ -222,7 +222,7 @@ func TestGetRunnerReturnsInternalError(t *testing.T) {
func TestPostRunnerRun(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcbuilder.NewMockBuilderService(ctrl)
serviceObj := buildersmocks.NewMockBuilderService(ctrl)
serviceObj.EXPECT().
RunRunner(gomock.Any(), gomock.Any()).
DoAndReturn(func(_ context.Context, req api.PostRunnerRun) (string, error) {
@@ -240,7 +240,7 @@ func TestPostRunnerRun(t *testing.T) {
func TestPostRunnerRunReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcbuilder.NewMockBuilderService(ctrl)
serviceObj := buildersmocks.NewMockBuilderService(ctrl)
serviceObj.EXPECT().
RunRunner(gomock.Any(), gomock.Any()).
Return("", errors.New("run failed"))
@@ -254,7 +254,7 @@ func TestPostRunnerRunReturnsInternalError(t *testing.T) {
func TestGetRunnerRerun(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcbuilder.NewMockBuilderService(ctrl)
serviceObj := buildersmocks.NewMockBuilderService(ctrl)
serviceObj.EXPECT().
RerunRunner(gomock.Any(), gomock.Any()).
DoAndReturn(func(_ context.Context, req api.GetRunnerStop) (string, error) {
@@ -272,7 +272,7 @@ func TestGetRunnerRerun(t *testing.T) {
func TestGetRunnerStop(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcbuilder.NewMockBuilderService(ctrl)
serviceObj := buildersmocks.NewMockBuilderService(ctrl)
serviceObj.EXPECT().
StopRunner(gomock.Any(), gomock.Any()).
Return(nil)
@@ -286,7 +286,7 @@ func TestGetRunnerStop(t *testing.T) {
func TestGetRunnerStopReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcbuilder.NewMockBuilderService(ctrl)
serviceObj := buildersmocks.NewMockBuilderService(ctrl)
serviceObj.EXPECT().
StopRunner(gomock.Any(), gomock.Any()).
Return(errors.New("stop failed"))
@@ -300,7 +300,7 @@ func TestGetRunnerStopReturnsInternalError(t *testing.T) {
func TestGetRunnerLogReturnsInternalErrorWhenBuilderLookupFails(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcbuilder.NewMockBuilderService(ctrl)
serviceObj := buildersmocks.NewMockBuilderService(ctrl)
serviceObj.EXPECT().
GetBuilderByRepositoryID(gomock.Any(), "1").
Return(nil, errors.New("get builder failed"))
@@ -314,7 +314,7 @@ func TestGetRunnerLogReturnsInternalErrorWhenBuilderLookupFails(t *testing.T) {
func TestGetRunnerLogReturnsInternalErrorOnBuilderMismatch(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcbuilder.NewMockBuilderService(ctrl)
serviceObj := buildersmocks.NewMockBuilderService(ctrl)
serviceObj.EXPECT().
GetBuilderByRepositoryID(gomock.Any(), "1").
Return(&models.Builder{ID: "other"}, nil)
@@ -328,7 +328,7 @@ func TestGetRunnerLogReturnsInternalErrorOnBuilderMismatch(t *testing.T) {
func TestGetRunnerLogReturnsInternalErrorWhenRunnerLookupFails(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcbuilder.NewMockBuilderService(ctrl)
serviceObj := buildersmocks.NewMockBuilderService(ctrl)
serviceObj.EXPECT().
GetBuilderByRepositoryID(gomock.Any(), "1").
Return(&models.Builder{ID: "1"}, nil)
+15 -15
View File
@@ -30,12 +30,12 @@ import (
"github.com/go-sigma/sigma/pkg/consts"
"github.com/go-sigma/sigma/pkg/dal/models"
"github.com/go-sigma/sigma/pkg/server/errcode"
svccoderepo "github.com/go-sigma/sigma/pkg/service/coderepos"
codereposmocks "github.com/go-sigma/sigma/pkg/service/coderepos/mocks"
)
func TestList(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svccoderepo.NewMockCodeRepositoryService(ctrl)
serviceObj := codereposmocks.NewMockCodeRepositoryService(ctrl)
serviceObj.EXPECT().
ListCodeRepositories(gomock.Any(), "10", enums.ProviderGithub, nil, nil, gomock.Any(), gomock.Any()).
DoAndReturn(func(_ context.Context, userID string, provider enums.Provider, owner, name *string, pagination api.Pagination, sort api.Sortable) ([]*models.CodeRepository, []*models.CodeRepositoryOwner, int64, error) {
@@ -74,7 +74,7 @@ func TestList(t *testing.T) {
func TestListReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svccoderepo.NewMockCodeRepositoryService(ctrl)
serviceObj := codereposmocks.NewMockCodeRepositoryService(ctrl)
serviceObj.EXPECT().
ListCodeRepositories(gomock.Any(), "10", enums.ProviderGithub, nil, nil, gomock.Any(), gomock.Any()).
Return(nil, nil, int64(0), errors.New("list failed"))
@@ -88,7 +88,7 @@ func TestListReturnsInternalError(t *testing.T) {
func TestListReturnsErrCode(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svccoderepo.NewMockCodeRepositoryService(ctrl)
serviceObj := codereposmocks.NewMockCodeRepositoryService(ctrl)
serviceObj.EXPECT().
ListCodeRepositories(gomock.Any(), "10", enums.ProviderGithub, nil, nil, gomock.Any(), gomock.Any()).
Return(nil, nil, int64(0), errcode.HTTPErrCodeBadRequest.Detail("not a valid Provider"))
@@ -102,7 +102,7 @@ func TestListReturnsErrCode(t *testing.T) {
func TestGet(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svccoderepo.NewMockCodeRepositoryService(ctrl)
serviceObj := codereposmocks.NewMockCodeRepositoryService(ctrl)
serviceObj.EXPECT().
GetCodeRepository(gomock.Any(), "10", enums.ProviderGithub, "1").
DoAndReturn(func(_ context.Context, userID string, provider enums.Provider, id string) (*models.CodeRepository, []*models.CodeRepositoryOwner, error) {
@@ -134,7 +134,7 @@ func TestGet(t *testing.T) {
func TestGetReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svccoderepo.NewMockCodeRepositoryService(ctrl)
serviceObj := codereposmocks.NewMockCodeRepositoryService(ctrl)
serviceObj.EXPECT().
GetCodeRepository(gomock.Any(), "10", enums.ProviderGithub, "1").
Return(nil, nil, errors.New("get failed"))
@@ -148,7 +148,7 @@ func TestGetReturnsInternalError(t *testing.T) {
func TestListOwners(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svccoderepo.NewMockCodeRepositoryService(ctrl)
serviceObj := codereposmocks.NewMockCodeRepositoryService(ctrl)
serviceObj.EXPECT().
ListCodeRepositoryOwners(gomock.Any(), "10", enums.ProviderGithub, nil).
DoAndReturn(func(_ context.Context, userID string, provider enums.Provider, name *string) ([]*models.CodeRepositoryOwner, int64, error) {
@@ -174,7 +174,7 @@ func TestListOwners(t *testing.T) {
func TestListBranches(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svccoderepo.NewMockCodeRepositoryService(ctrl)
serviceObj := codereposmocks.NewMockCodeRepositoryService(ctrl)
serviceObj.EXPECT().
ListCodeRepositoryBranches(gomock.Any(), "1").
DoAndReturn(func(_ context.Context, codeRepositoryID string) ([]*models.CodeRepositoryBranch, int64, error) {
@@ -198,7 +198,7 @@ func TestListBranches(t *testing.T) {
func TestListBranchesReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svccoderepo.NewMockCodeRepositoryService(ctrl)
serviceObj := codereposmocks.NewMockCodeRepositoryService(ctrl)
serviceObj.EXPECT().
ListCodeRepositoryBranches(gomock.Any(), "1").
Return(nil, int64(0), errors.New("list failed"))
@@ -212,7 +212,7 @@ func TestListBranchesReturnsInternalError(t *testing.T) {
func TestGetBranch(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svccoderepo.NewMockCodeRepositoryService(ctrl)
serviceObj := codereposmocks.NewMockCodeRepositoryService(ctrl)
serviceObj.EXPECT().
GetCodeRepositoryBranch(gomock.Any(), "1", "main").
Return(&models.CodeRepositoryBranch{
@@ -232,7 +232,7 @@ func TestGetBranch(t *testing.T) {
func TestResync(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svccoderepo.NewMockCodeRepositoryService(ctrl)
serviceObj := codereposmocks.NewMockCodeRepositoryService(ctrl)
serviceObj.EXPECT().
ResyncCodeRepositories(gomock.Any(), "10", enums.ProviderGithub).
Return(nil)
@@ -246,7 +246,7 @@ func TestResync(t *testing.T) {
func TestResyncReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svccoderepo.NewMockCodeRepositoryService(ctrl)
serviceObj := codereposmocks.NewMockCodeRepositoryService(ctrl)
serviceObj.EXPECT().
ResyncCodeRepositories(gomock.Any(), "10", enums.ProviderGithub).
Return(errors.New("resync failed"))
@@ -260,7 +260,7 @@ func TestResyncReturnsInternalError(t *testing.T) {
func TestProviders(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svccoderepo.NewMockCodeRepositoryService(ctrl)
serviceObj := codereposmocks.NewMockCodeRepositoryService(ctrl)
serviceObj.EXPECT().
ListCodeRepositoryProviders(gomock.Any(), "10").
DoAndReturn(func(_ context.Context, userID string) ([]*models.User3rdParty, error) {
@@ -284,7 +284,7 @@ func TestProviders(t *testing.T) {
func TestUser3rdParty(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svccoderepo.NewMockCodeRepositoryService(ctrl)
serviceObj := codereposmocks.NewMockCodeRepositoryService(ctrl)
serviceObj.EXPECT().
GetCodeRepositoryUser3rdParty(gomock.Any(), "10", enums.ProviderGithub).
Return(&models.User3rdParty{
@@ -310,7 +310,7 @@ func TestUser3rdParty(t *testing.T) {
func TestUser3rdPartyReturnsNotFound(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svccoderepo.NewMockCodeRepositoryService(ctrl)
serviceObj := codereposmocks.NewMockCodeRepositoryService(ctrl)
serviceObj.EXPECT().
GetCodeRepositoryUser3rdParty(gomock.Any(), "10", enums.ProviderGithub).
Return(nil, errors.New("not found"))
@@ -26,12 +26,12 @@ import (
"github.com/go-sigma/sigma/pkg/api"
"github.com/go-sigma/sigma/pkg/api/enums"
"github.com/go-sigma/sigma/pkg/dal/models"
svcdaemons "github.com/go-sigma/sigma/pkg/service/daemons"
daemonsmocks "github.com/go-sigma/sigma/pkg/service/daemons/mocks"
)
func TestUpdateGcArtifactRule(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
UpdateGcArtifactRule(gomock.Any(), gomock.Any()).
Return(nil)
@@ -45,7 +45,7 @@ func TestUpdateGcArtifactRule(t *testing.T) {
func TestUpdateGcArtifactRuleReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
UpdateGcArtifactRule(gomock.Any(), gomock.Any()).
Return(errors.New("update failed"))
@@ -59,7 +59,7 @@ func TestUpdateGcArtifactRuleReturnsInternalError(t *testing.T) {
func TestGetGcArtifactRule(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
GetGcArtifactRule(gomock.Any(), "1").
Return(&models.DaemonGcRule{
@@ -84,7 +84,7 @@ func TestGetGcArtifactRule(t *testing.T) {
func TestGetGcArtifactRuleReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
GetGcArtifactRule(gomock.Any(), "1").
Return(nil, errors.New("get failed"))
@@ -98,7 +98,7 @@ func TestGetGcArtifactRuleReturnsInternalError(t *testing.T) {
func TestGetGcArtifactLatestRunner(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
GetGcArtifactLatestRunner(gomock.Any(), "1").
Return(&models.DaemonGcRunner{
@@ -125,7 +125,7 @@ func TestGetGcArtifactLatestRunner(t *testing.T) {
func TestGetGcArtifactLatestRunnerReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
GetGcArtifactLatestRunner(gomock.Any(), "1").
Return(nil, errors.New("get failed"))
@@ -139,7 +139,7 @@ func TestGetGcArtifactLatestRunnerReturnsInternalError(t *testing.T) {
func TestCreateGcArtifactRunner(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
CreateGcArtifactRunner(gomock.Any(), gomock.Any()).
Return(nil)
@@ -153,7 +153,7 @@ func TestCreateGcArtifactRunner(t *testing.T) {
func TestCreateGcArtifactRunnerReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
CreateGcArtifactRunner(gomock.Any(), gomock.Any()).
Return(errors.New("create failed"))
@@ -167,7 +167,7 @@ func TestCreateGcArtifactRunnerReturnsInternalError(t *testing.T) {
func TestListGcArtifactRunners(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
ListGcArtifactRunners(gomock.Any(), "1", gomock.Any(), gomock.Any()).
DoAndReturn(func(_ context.Context, namespaceID string, pagination api.Pagination, sort api.Sortable) ([]*models.DaemonGcRunner, int64, error) {
@@ -194,7 +194,7 @@ func TestListGcArtifactRunners(t *testing.T) {
func TestListGcArtifactRunnersReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
ListGcArtifactRunners(gomock.Any(), "1", gomock.Any(), gomock.Any()).
Return(nil, int64(0), errors.New("list failed"))
@@ -208,7 +208,7 @@ func TestListGcArtifactRunnersReturnsInternalError(t *testing.T) {
func TestGetGcArtifactRunner(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
GetGcArtifactRunner(gomock.Any(), "1", "2").
Return(&models.DaemonGcRunner{
@@ -229,7 +229,7 @@ func TestGetGcArtifactRunner(t *testing.T) {
func TestGetGcArtifactRunnerReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
GetGcArtifactRunner(gomock.Any(), "1", "2").
Return(nil, errors.New("get failed"))
@@ -243,7 +243,7 @@ func TestGetGcArtifactRunnerReturnsInternalError(t *testing.T) {
func TestListGcArtifactRecords(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
ListGcArtifactRecords(gomock.Any(), "2", gomock.Any(), gomock.Any()).
DoAndReturn(func(_ context.Context, runnerID string, pagination api.Pagination, sort api.Sortable) ([]*models.DaemonGcRecord, int64, error) {
@@ -270,7 +270,7 @@ func TestListGcArtifactRecords(t *testing.T) {
func TestListGcArtifactRecordsReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
ListGcArtifactRecords(gomock.Any(), "2", gomock.Any(), gomock.Any()).
Return(nil, int64(0), errors.New("list failed"))
@@ -284,7 +284,7 @@ func TestListGcArtifactRecordsReturnsInternalError(t *testing.T) {
func TestGetGcArtifactRecord(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
GetGcArtifactRecord(gomock.Any(), "1", "2", "3").
Return(&models.DaemonGcRecord{
@@ -307,7 +307,7 @@ func TestGetGcArtifactRecord(t *testing.T) {
func TestGetGcArtifactRecordReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
GetGcArtifactRecord(gomock.Any(), "1", "2", "3").
Return(nil, errors.New("get failed"))
@@ -29,12 +29,12 @@ import (
"github.com/go-sigma/sigma/pkg/api/enums"
"github.com/go-sigma/sigma/pkg/consts"
"github.com/go-sigma/sigma/pkg/dal/models"
svcdaemons "github.com/go-sigma/sigma/pkg/service/daemons"
daemonsmocks "github.com/go-sigma/sigma/pkg/service/daemons/mocks"
)
func TestUpdateGcBlobRule(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
UpdateGcBlobRule(gomock.Any(), gomock.Any()).
Return(nil)
@@ -48,7 +48,7 @@ func TestUpdateGcBlobRule(t *testing.T) {
func TestUpdateGcBlobRuleReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
UpdateGcBlobRule(gomock.Any(), gomock.Any()).
Return(errors.New("update failed"))
@@ -62,7 +62,7 @@ func TestUpdateGcBlobRuleReturnsInternalError(t *testing.T) {
func TestGetGcBlobRule(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
GetGcBlobRule(gomock.Any()).
Return(&models.DaemonGcRule{
@@ -87,7 +87,7 @@ func TestGetGcBlobRule(t *testing.T) {
func TestGetGcBlobRuleReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
GetGcBlobRule(gomock.Any()).
Return(nil, errors.New("get failed"))
@@ -101,7 +101,7 @@ func TestGetGcBlobRuleReturnsInternalError(t *testing.T) {
func TestGetGcBlobLatestRunner(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
GetGcBlobLatestRunner(gomock.Any(), "1").
Return(&models.DaemonGcRunner{
@@ -128,7 +128,7 @@ func TestGetGcBlobLatestRunner(t *testing.T) {
func TestGetGcBlobLatestRunnerReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
GetGcBlobLatestRunner(gomock.Any(), "1").
Return(nil, errors.New("get failed"))
@@ -142,7 +142,7 @@ func TestGetGcBlobLatestRunnerReturnsInternalError(t *testing.T) {
func TestCreateGcBlobRunner(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
CreateGcBlobRunner(gomock.Any(), "10", gomock.Any()).
Return(nil)
@@ -156,7 +156,7 @@ func TestCreateGcBlobRunner(t *testing.T) {
func TestCreateGcBlobRunnerReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
CreateGcBlobRunner(gomock.Any(), "10", gomock.Any()).
Return(errors.New("create failed"))
@@ -170,7 +170,7 @@ func TestCreateGcBlobRunnerReturnsInternalError(t *testing.T) {
func TestListGcBlobRunners(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
ListGcBlobRunners(gomock.Any(), gomock.Any(), gomock.Any()).
DoAndReturn(func(_ context.Context, pagination api.Pagination, sort api.Sortable) ([]*models.DaemonGcRunner, int64, error) {
@@ -196,7 +196,7 @@ func TestListGcBlobRunners(t *testing.T) {
func TestListGcBlobRunnersReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
ListGcBlobRunners(gomock.Any(), gomock.Any(), gomock.Any()).
Return(nil, int64(0), errors.New("list failed"))
@@ -210,7 +210,7 @@ func TestListGcBlobRunnersReturnsInternalError(t *testing.T) {
func TestGetGcBlobRunner(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
GetGcBlobRunner(gomock.Any(), "2").
Return(&models.DaemonGcRunner{
@@ -231,7 +231,7 @@ func TestGetGcBlobRunner(t *testing.T) {
func TestGetGcBlobRunnerReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
GetGcBlobRunner(gomock.Any(), "2").
Return(nil, errors.New("get failed"))
@@ -245,7 +245,7 @@ func TestGetGcBlobRunnerReturnsInternalError(t *testing.T) {
func TestListGcBlobRecords(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
ListGcBlobRecords(gomock.Any(), "2", gomock.Any(), gomock.Any()).
DoAndReturn(func(_ context.Context, runnerID string, pagination api.Pagination, sort api.Sortable) ([]*models.DaemonGcRecord, int64, error) {
@@ -272,7 +272,7 @@ func TestListGcBlobRecords(t *testing.T) {
func TestListGcBlobRecordsReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
ListGcBlobRecords(gomock.Any(), "2", gomock.Any(), gomock.Any()).
Return(nil, int64(0), errors.New("list failed"))
@@ -286,7 +286,7 @@ func TestListGcBlobRecordsReturnsInternalError(t *testing.T) {
func TestGetGcBlobRecord(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
GetGcBlobRecord(gomock.Any(), "2", "3").
Return(&models.DaemonGcRecord{
@@ -309,7 +309,7 @@ func TestGetGcBlobRecord(t *testing.T) {
func TestGetGcBlobRecordReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
GetGcBlobRecord(gomock.Any(), "2", "3").
Return(nil, errors.New("get failed"))
@@ -26,12 +26,12 @@ import (
"github.com/go-sigma/sigma/pkg/api"
"github.com/go-sigma/sigma/pkg/api/enums"
"github.com/go-sigma/sigma/pkg/dal/models"
svcdaemons "github.com/go-sigma/sigma/pkg/service/daemons"
daemonsmocks "github.com/go-sigma/sigma/pkg/service/daemons/mocks"
)
func TestUpdateGcRepositoryRule(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
UpdateGcRepositoryRule(gomock.Any(), gomock.Any()).
Return(nil)
@@ -45,7 +45,7 @@ func TestUpdateGcRepositoryRule(t *testing.T) {
func TestUpdateGcRepositoryRuleReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
UpdateGcRepositoryRule(gomock.Any(), gomock.Any()).
Return(errors.New("update failed"))
@@ -59,7 +59,7 @@ func TestUpdateGcRepositoryRuleReturnsInternalError(t *testing.T) {
func TestGetGcRepositoryRule(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
GetGcRepositoryRule(gomock.Any(), "1").
Return(&models.DaemonGcRule{
@@ -84,7 +84,7 @@ func TestGetGcRepositoryRule(t *testing.T) {
func TestGetGcRepositoryRuleReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
GetGcRepositoryRule(gomock.Any(), "1").
Return(nil, errors.New("get failed"))
@@ -98,7 +98,7 @@ func TestGetGcRepositoryRuleReturnsInternalError(t *testing.T) {
func TestGetGcRepositoryLatestRunner(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
GetGcRepositoryLatestRunner(gomock.Any(), "1").
Return(&models.DaemonGcRunner{
@@ -125,7 +125,7 @@ func TestGetGcRepositoryLatestRunner(t *testing.T) {
func TestGetGcRepositoryLatestRunnerReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
GetGcRepositoryLatestRunner(gomock.Any(), "1").
Return(nil, errors.New("get failed"))
@@ -139,7 +139,7 @@ func TestGetGcRepositoryLatestRunnerReturnsInternalError(t *testing.T) {
func TestCreateGcRepositoryRunner(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
CreateGcRepositoryRunner(gomock.Any(), gomock.Any()).
Return(nil)
@@ -153,7 +153,7 @@ func TestCreateGcRepositoryRunner(t *testing.T) {
func TestCreateGcRepositoryRunnerReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
CreateGcRepositoryRunner(gomock.Any(), gomock.Any()).
Return(errors.New("create failed"))
@@ -167,7 +167,7 @@ func TestCreateGcRepositoryRunnerReturnsInternalError(t *testing.T) {
func TestListGcRepositoryRunners(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
ListGcRepositoryRunners(gomock.Any(), "1", gomock.Any(), gomock.Any()).
DoAndReturn(func(_ context.Context, namespaceID string, pagination api.Pagination, sort api.Sortable) ([]*models.DaemonGcRunner, int64, error) {
@@ -194,7 +194,7 @@ func TestListGcRepositoryRunners(t *testing.T) {
func TestListGcRepositoryRunnersReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
ListGcRepositoryRunners(gomock.Any(), "1", gomock.Any(), gomock.Any()).
Return(nil, int64(0), errors.New("list failed"))
@@ -208,7 +208,7 @@ func TestListGcRepositoryRunnersReturnsInternalError(t *testing.T) {
func TestGetGcRepositoryRunner(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
GetGcRepositoryRunner(gomock.Any(), "1", "2").
Return(&models.DaemonGcRunner{
@@ -229,7 +229,7 @@ func TestGetGcRepositoryRunner(t *testing.T) {
func TestGetGcRepositoryRunnerReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
GetGcRepositoryRunner(gomock.Any(), "1", "2").
Return(nil, errors.New("get failed"))
@@ -243,7 +243,7 @@ func TestGetGcRepositoryRunnerReturnsInternalError(t *testing.T) {
func TestListGcRepositoryRecords(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
ListGcRepositoryRecords(gomock.Any(), "2", gomock.Any(), gomock.Any()).
DoAndReturn(func(_ context.Context, runnerID string, pagination api.Pagination, sort api.Sortable) ([]*models.DaemonGcRecord, int64, error) {
@@ -270,7 +270,7 @@ func TestListGcRepositoryRecords(t *testing.T) {
func TestListGcRepositoryRecordsReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
ListGcRepositoryRecords(gomock.Any(), "2", gomock.Any(), gomock.Any()).
Return(nil, int64(0), errors.New("list failed"))
@@ -284,7 +284,7 @@ func TestListGcRepositoryRecordsReturnsInternalError(t *testing.T) {
func TestGetGcRepositoryRecord(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
GetGcRepositoryRecord(gomock.Any(), "1", "2", "3").
Return(&models.DaemonGcRecord{
@@ -307,7 +307,7 @@ func TestGetGcRepositoryRecord(t *testing.T) {
func TestGetGcRepositoryRecordReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
GetGcRepositoryRecord(gomock.Any(), "1", "2", "3").
Return(nil, errors.New("get failed"))
@@ -26,12 +26,12 @@ import (
"github.com/go-sigma/sigma/pkg/api"
"github.com/go-sigma/sigma/pkg/api/enums"
"github.com/go-sigma/sigma/pkg/dal/models"
svcdaemons "github.com/go-sigma/sigma/pkg/service/daemons"
daemonsmocks "github.com/go-sigma/sigma/pkg/service/daemons/mocks"
)
func TestUpdateGcTagRule(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
UpdateGcTagRule(gomock.Any(), gomock.Any()).
Return(nil)
@@ -45,7 +45,7 @@ func TestUpdateGcTagRule(t *testing.T) {
func TestUpdateGcTagRuleReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
UpdateGcTagRule(gomock.Any(), gomock.Any()).
Return(errors.New("update failed"))
@@ -59,7 +59,7 @@ func TestUpdateGcTagRuleReturnsInternalError(t *testing.T) {
func TestGetGcTagRule(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
GetGcTagRule(gomock.Any(), "1").
Return(&models.DaemonGcRule{
@@ -85,7 +85,7 @@ func TestGetGcTagRule(t *testing.T) {
func TestGetGcTagRuleReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
GetGcTagRule(gomock.Any(), "1").
Return(nil, errors.New("get failed"))
@@ -99,7 +99,7 @@ func TestGetGcTagRuleReturnsInternalError(t *testing.T) {
func TestGetGcTagLatestRunner(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
GetGcTagLatestRunner(gomock.Any(), "1").
Return(&models.DaemonGcRunner{
@@ -126,7 +126,7 @@ func TestGetGcTagLatestRunner(t *testing.T) {
func TestGetGcTagLatestRunnerReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
GetGcTagLatestRunner(gomock.Any(), "1").
Return(nil, errors.New("get failed"))
@@ -140,7 +140,7 @@ func TestGetGcTagLatestRunnerReturnsInternalError(t *testing.T) {
func TestCreateGcTagRunner(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
CreateGcTagRunner(gomock.Any(), gomock.Any()).
Return(nil)
@@ -154,7 +154,7 @@ func TestCreateGcTagRunner(t *testing.T) {
func TestCreateGcTagRunnerReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
CreateGcTagRunner(gomock.Any(), gomock.Any()).
Return(errors.New("create failed"))
@@ -168,7 +168,7 @@ func TestCreateGcTagRunnerReturnsInternalError(t *testing.T) {
func TestListGcTagRunners(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
ListGcTagRunners(gomock.Any(), "1", gomock.Any(), gomock.Any()).
DoAndReturn(func(_ context.Context, namespaceID string, pagination api.Pagination, sort api.Sortable) ([]*models.DaemonGcRunner, int64, error) {
@@ -195,7 +195,7 @@ func TestListGcTagRunners(t *testing.T) {
func TestListGcTagRunnersReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
ListGcTagRunners(gomock.Any(), "1", gomock.Any(), gomock.Any()).
Return(nil, int64(0), errors.New("list failed"))
@@ -209,7 +209,7 @@ func TestListGcTagRunnersReturnsInternalError(t *testing.T) {
func TestGetGcTagRunner(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
GetGcTagRunner(gomock.Any(), "1", "2").
Return(&models.DaemonGcRunner{
@@ -230,7 +230,7 @@ func TestGetGcTagRunner(t *testing.T) {
func TestGetGcTagRunnerReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
GetGcTagRunner(gomock.Any(), "1", "2").
Return(nil, errors.New("get failed"))
@@ -244,7 +244,7 @@ func TestGetGcTagRunnerReturnsInternalError(t *testing.T) {
func TestListGcTagRecords(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
ListGcTagRecords(gomock.Any(), "2", gomock.Any(), gomock.Any()).
DoAndReturn(func(_ context.Context, runnerID string, pagination api.Pagination, sort api.Sortable) ([]*models.DaemonGcRecord, int64, error) {
@@ -271,7 +271,7 @@ func TestListGcTagRecords(t *testing.T) {
func TestListGcTagRecordsReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
ListGcTagRecords(gomock.Any(), "2", gomock.Any(), gomock.Any()).
Return(nil, int64(0), errors.New("list failed"))
@@ -285,7 +285,7 @@ func TestListGcTagRecordsReturnsInternalError(t *testing.T) {
func TestGetGcTagRecord(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
GetGcTagRecord(gomock.Any(), "1", "2", "3").
Return(&models.DaemonGcRecord{
@@ -308,7 +308,7 @@ func TestGetGcTagRecord(t *testing.T) {
func TestGetGcTagRecordReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcdaemons.NewMockDaemonService(ctrl)
serviceObj := daemonsmocks.NewMockDaemonService(ctrl)
serviceObj.EXPECT().
GetGcTagRecord(gomock.Any(), "1", "2", "3").
Return(nil, errors.New("get failed"))
@@ -26,12 +26,12 @@ import (
"github.com/go-sigma/sigma/pkg/consts"
"github.com/go-sigma/sigma/pkg/dal/models"
svcrepository "github.com/go-sigma/sigma/pkg/service/repositories"
repositoriesmocks "github.com/go-sigma/sigma/pkg/service/repositories/mocks"
)
func TestListRepositories(t *testing.T) {
ctrl := gomock.NewController(t)
svc := svcrepository.NewMockRepositoryService(ctrl)
svc := repositoriesmocks.NewMockRepositoryService(ctrl)
svc.EXPECT().ListRepositories(gomock.Any(), "user-1", "", nil, gomock.Any(), gomock.Any()).
Return([]*models.Repository{{Name: "library/alpine"}, {Name: "library/busybox"}}, nil, int64(2), nil)
recorder, c := newDistributionContext("/v2/_catalog?n=200")
@@ -58,7 +58,7 @@ func TestListRepositoriesInvalidLimit(t *testing.T) {
func TestListRepositoriesServiceError(t *testing.T) {
ctrl := gomock.NewController(t)
svc := svcrepository.NewMockRepositoryService(ctrl)
svc := repositoriesmocks.NewMockRepositoryService(ctrl)
svc.EXPECT().ListRepositories(gomock.Any(), "user-1", "", nil, gomock.Any(), gomock.Any()).Return(nil, nil, int64(0), errors.New("list failed"))
recorder, c := newDistributionContext("/v2/_catalog")
c.Set(consts.ContextUser, &models.User{ID: "user-1"})
@@ -25,14 +25,14 @@ import (
"github.com/go-sigma/sigma/pkg/authz"
"github.com/go-sigma/sigma/pkg/consts"
"github.com/go-sigma/sigma/pkg/dal/models"
svcrepository "github.com/go-sigma/sigma/pkg/service/repositories"
svctag "github.com/go-sigma/sigma/pkg/service/tags"
repositoriesmocks "github.com/go-sigma/sigma/pkg/service/repositories/mocks"
tagsmocks "github.com/go-sigma/sigma/pkg/service/tags/mocks"
)
func TestListTags(t *testing.T) {
ctrl := gomock.NewController(t)
repoSvc := svcrepository.NewMockRepositoryService(ctrl)
tagSvc := svctag.NewMockTagService(ctrl)
repoSvc := repositoriesmocks.NewMockRepositoryService(ctrl)
tagSvc := tagsmocks.NewMockTagService(ctrl)
authorizer := authz.NewMockAuthorizer(ctrl)
repoSvc.EXPECT().GetRepositoryByName(gomock.Any(), "library/alpine").Return(&models.Repository{ID: "repository-1", NamespaceID: "namespace-1"}, nil)
authorizer.EXPECT().Repository(gomock.Any(), gomock.Any(), "repository-1", enums.AuthRead).Return(true, nil)
@@ -29,14 +29,14 @@ import (
"github.com/go-sigma/sigma/pkg/authz"
"github.com/go-sigma/sigma/pkg/consts"
"github.com/go-sigma/sigma/pkg/dal/models"
svcblob "github.com/go-sigma/sigma/pkg/service/distribution/blob"
blobmocks "github.com/go-sigma/sigma/pkg/service/distribution/blob/mocks"
)
const blobDigest = "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
func TestGetBlob(t *testing.T) {
ctrl := gomock.NewController(t)
svc := svcblob.NewMockDistributionBlobService(ctrl)
svc := blobmocks.NewMockDistributionBlobService(ctrl)
authorizer := authz.NewMockAuthorizer(ctrl)
svc.EXPECT().GetNamespaceByName(gomock.Any(), "library").Return(&models.Namespace{ID: "namespace-1"}, nil)
authorizer.EXPECT().Namespace(gomock.Any(), gomock.Any(), "namespace-1", enums.AuthRead).Return(true, nil)
@@ -58,7 +58,7 @@ func TestGetBlob(t *testing.T) {
func TestGetBlobRedirect(t *testing.T) {
ctrl := gomock.NewController(t)
svc := svcblob.NewMockDistributionBlobService(ctrl)
svc := blobmocks.NewMockDistributionBlobService(ctrl)
authorizer := authz.NewMockAuthorizer(ctrl)
svc.EXPECT().GetNamespaceByName(gomock.Any(), "library").Return(&models.Namespace{ID: "namespace-1"}, nil)
authorizer.EXPECT().Namespace(gomock.Any(), gomock.Any(), "namespace-1", enums.AuthRead).Return(true, nil)
@@ -24,14 +24,14 @@ import (
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"
svcmanifest "github.com/go-sigma/sigma/pkg/service/distribution/manifest"
manifestmocks "github.com/go-sigma/sigma/pkg/service/distribution/manifest/mocks"
)
const referrerDigest = "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
func TestGetReferrer(t *testing.T) {
ctrl := gomock.NewController(t)
svc := svcmanifest.NewMockDistributionManifestService(ctrl)
svc := manifestmocks.NewMockDistributionManifestService(ctrl)
svc.EXPECT().GetReferrer(gomock.Any(), "library/alpine", referrerDigest, []string{"application/example", "application/other"}).Return([]byte(`{"manifests":[]}`), nil)
recorder := httptest.NewRecorder()
c, _ := gin.CreateTestContext(recorder)
@@ -22,7 +22,7 @@ import (
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"
svcupload "github.com/go-sigma/sigma/pkg/service/distribution/upload"
uploadmocks "github.com/go-sigma/sigma/pkg/service/distribution/upload/mocks"
)
func TestDeleteUpload(t *testing.T) {
@@ -38,7 +38,7 @@ func TestDeleteUpload(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
ctrl := gomock.NewController(t)
svc := svcupload.NewMockDistributionUploadService(ctrl)
svc := uploadmocks.NewMockDistributionUploadService(ctrl)
svc.EXPECT().DeleteUpload(gomock.Any(), "upload-1").Return(tt.serviceErr)
recorder, c := newUploadContext(t, http.MethodDelete, "/v2/library/alpine/blobs/uploads/upload-1", nil)
@@ -23,7 +23,7 @@ import (
"go.uber.org/mock/gomock"
"github.com/go-sigma/sigma/pkg/consts"
svcupload "github.com/go-sigma/sigma/pkg/service/distribution/upload"
uploadmocks "github.com/go-sigma/sigma/pkg/service/distribution/upload/mocks"
)
func TestGetUpload(t *testing.T) {
@@ -39,7 +39,7 @@ func TestGetUpload(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
ctrl := gomock.NewController(t)
svc := svcupload.NewMockDistributionUploadService(ctrl)
svc := uploadmocks.NewMockDistributionUploadService(ctrl)
svc.EXPECT().GetUpload(gomock.Any(), "upload-1").Return(nil, tt.serviceErr)
path := "/v2/library/alpine/blobs/uploads/upload-1"
recorder, c := newUploadContext(t, http.MethodGet, path, nil)
@@ -26,12 +26,12 @@ import (
"github.com/go-sigma/sigma/pkg/authz"
"github.com/go-sigma/sigma/pkg/consts"
"github.com/go-sigma/sigma/pkg/dal/models"
svcupload "github.com/go-sigma/sigma/pkg/service/distribution/upload"
uploadmocks "github.com/go-sigma/sigma/pkg/service/distribution/upload/mocks"
)
func TestPatchUpload(t *testing.T) {
ctrl := gomock.NewController(t)
svc := svcupload.NewMockDistributionUploadService(ctrl)
svc := uploadmocks.NewMockDistributionUploadService(ctrl)
authorizer := authz.NewMockAuthorizer(ctrl)
svc.EXPECT().GetNamespaceByName(gomock.Any(), "library").Return(&models.Namespace{ID: "namespace-1"}, nil)
authorizer.EXPECT().Namespace(gomock.Any(), gomock.Any(), "namespace-1", enums.AuthManage).Return(true, nil)
@@ -26,12 +26,12 @@ import (
"github.com/go-sigma/sigma/pkg/authz"
"github.com/go-sigma/sigma/pkg/consts"
"github.com/go-sigma/sigma/pkg/dal/models"
svcupload "github.com/go-sigma/sigma/pkg/service/distribution/upload"
uploadmocks "github.com/go-sigma/sigma/pkg/service/distribution/upload/mocks"
)
func TestPostUpload(t *testing.T) {
ctrl := gomock.NewController(t)
svc := svcupload.NewMockDistributionUploadService(ctrl)
svc := uploadmocks.NewMockDistributionUploadService(ctrl)
authorizer := authz.NewMockAuthorizer(ctrl)
svc.EXPECT().GetNamespaceByName(gomock.Any(), "library").Return(&models.Namespace{ID: "namespace-1"}, nil)
authorizer.EXPECT().Namespace(gomock.Any(), gomock.Any(), "namespace-1", enums.AuthManage).Return(true, nil)
@@ -52,7 +52,7 @@ func TestPostUpload(t *testing.T) {
func TestPostUploadInvalidDigest(t *testing.T) {
ctrl := gomock.NewController(t)
svc := svcupload.NewMockDistributionUploadService(ctrl)
svc := uploadmocks.NewMockDistributionUploadService(ctrl)
authorizer := authz.NewMockAuthorizer(ctrl)
svc.EXPECT().GetNamespaceByName(gomock.Any(), "library").Return(&models.Namespace{ID: "namespace-1"}, nil)
authorizer.EXPECT().Namespace(gomock.Any(), gomock.Any(), "namespace-1", enums.AuthManage).Return(true, nil)
@@ -26,14 +26,14 @@ import (
"github.com/go-sigma/sigma/pkg/authz"
"github.com/go-sigma/sigma/pkg/consts"
"github.com/go-sigma/sigma/pkg/dal/models"
svcupload "github.com/go-sigma/sigma/pkg/service/distribution/upload"
uploadmocks "github.com/go-sigma/sigma/pkg/service/distribution/upload/mocks"
)
const uploadDigest = "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
func TestPutUpload(t *testing.T) {
ctrl := gomock.NewController(t)
svc := svcupload.NewMockDistributionUploadService(ctrl)
svc := uploadmocks.NewMockDistributionUploadService(ctrl)
authorizer := authz.NewMockAuthorizer(ctrl)
svc.EXPECT().GetNamespaceByName(gomock.Any(), "library").Return(&models.Namespace{ID: "namespace-1"}, nil)
authorizer.EXPECT().Namespace(gomock.Any(), gomock.Any(), "namespace-1", enums.AuthManage).Return(true, nil)
@@ -56,7 +56,7 @@ func TestPutUpload(t *testing.T) {
func TestPutUploadInvalidDigest(t *testing.T) {
ctrl := gomock.NewController(t)
svc := svcupload.NewMockDistributionUploadService(ctrl)
svc := uploadmocks.NewMockDistributionUploadService(ctrl)
authorizer := authz.NewMockAuthorizer(ctrl)
svc.EXPECT().GetNamespaceByName(gomock.Any(), "library").Return(&models.Namespace{ID: "namespace-1"}, nil)
authorizer.EXPECT().Namespace(gomock.Any(), gomock.Any(), "namespace-1", enums.AuthManage).Return(true, nil)
@@ -30,7 +30,7 @@ import (
"github.com/go-sigma/sigma/pkg/consts"
"github.com/go-sigma/sigma/pkg/dal/models"
"github.com/go-sigma/sigma/pkg/server/errcode"
svcnamespace "github.com/go-sigma/sigma/pkg/service/namespaces"
namespacesmocks "github.com/go-sigma/sigma/pkg/service/namespaces/mocks"
"github.com/go-sigma/sigma/pkg/validators"
)
@@ -40,7 +40,7 @@ func TestPostNamespace(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
serviceObj := svcnamespace.NewMockNamespaceService(ctrl)
serviceObj := namespacesmocks.NewMockNamespaceService(ctrl)
serviceObj.EXPECT().
CreateNamespace(gomock.Any(), "10", api.PostNamespaceRequest{Name: "test"}).
DoAndReturn(func(_ context.Context, userID string, req api.PostNamespaceRequest) (*models.Namespace, error) {
@@ -94,7 +94,7 @@ func TestPostNamespaceReturnsServiceError(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
serviceObj := svcnamespace.NewMockNamespaceService(ctrl)
serviceObj := namespacesmocks.NewMockNamespaceService(ctrl)
serviceObj.EXPECT().
CreateNamespace(gomock.Any(), "10", gomock.Any()).
Return(nil, errors.New("create failed"))
@@ -29,7 +29,7 @@ import (
"github.com/go-sigma/sigma/pkg/consts"
"github.com/go-sigma/sigma/pkg/dal/models"
"github.com/go-sigma/sigma/pkg/server/errcode"
svcnamespace "github.com/go-sigma/sigma/pkg/service/namespaces"
namespacesmocks "github.com/go-sigma/sigma/pkg/service/namespaces/mocks"
"github.com/go-sigma/sigma/pkg/validators"
)
@@ -39,7 +39,7 @@ func TestDeleteNamespace(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
serviceObj := svcnamespace.NewMockNamespaceService(ctrl)
serviceObj := namespacesmocks.NewMockNamespaceService(ctrl)
serviceObj.EXPECT().
DeleteNamespace(gomock.Any(), "10", "1").
DoAndReturn(func(_ context.Context, userID, id string) error {
@@ -89,7 +89,7 @@ func TestDeleteNamespaceReturnsServiceError(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
serviceObj := svcnamespace.NewMockNamespaceService(ctrl)
serviceObj := namespacesmocks.NewMockNamespaceService(ctrl)
serviceObj.EXPECT().
DeleteNamespace(gomock.Any(), "10", "1").
Return(errors.New("delete failed"))
@@ -29,7 +29,7 @@ import (
"github.com/go-sigma/sigma/pkg/consts"
"github.com/go-sigma/sigma/pkg/dal/models"
"github.com/go-sigma/sigma/pkg/server/errcode"
svcnamespace "github.com/go-sigma/sigma/pkg/service/namespaces"
namespacesmocks "github.com/go-sigma/sigma/pkg/service/namespaces/mocks"
"github.com/go-sigma/sigma/pkg/validators"
)
@@ -39,7 +39,7 @@ func TestGetNamespace(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
serviceObj := svcnamespace.NewMockNamespaceService(ctrl)
serviceObj := namespacesmocks.NewMockNamespaceService(ctrl)
serviceObj.EXPECT().
GetNamespace(gomock.Any(), "1").
DoAndReturn(func(_ context.Context, id string) (*models.Namespace, int64, int64, error) {
@@ -75,7 +75,7 @@ func TestGetNamespaceReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
serviceObj := svcnamespace.NewMockNamespaceService(ctrl)
serviceObj := namespacesmocks.NewMockNamespaceService(ctrl)
serviceObj.EXPECT().
GetNamespace(gomock.Any(), "1").
Return(nil, int64(0), int64(0), errors.New("get failed"))
@@ -29,7 +29,7 @@ import (
"github.com/go-sigma/sigma/pkg/consts"
"github.com/go-sigma/sigma/pkg/dal/models"
"github.com/go-sigma/sigma/pkg/server/errcode"
svcnamespace "github.com/go-sigma/sigma/pkg/service/namespaces"
namespacesmocks "github.com/go-sigma/sigma/pkg/service/namespaces/mocks"
"github.com/go-sigma/sigma/pkg/validators"
)
@@ -39,7 +39,7 @@ func TestHotNamespace(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
serviceObj := svcnamespace.NewMockNamespaceService(ctrl)
serviceObj := namespacesmocks.NewMockNamespaceService(ctrl)
serviceObj.EXPECT().
HotNamespaces(gomock.Any(), "10").
DoAndReturn(func(_ context.Context, userID string) ([]*models.Namespace, error) {
@@ -87,7 +87,7 @@ func TestHotNamespaceReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
serviceObj := svcnamespace.NewMockNamespaceService(ctrl)
serviceObj := namespacesmocks.NewMockNamespaceService(ctrl)
serviceObj.EXPECT().
HotNamespaces(gomock.Any(), "10").
Return(nil, errors.New("hot failed"))
@@ -30,7 +30,7 @@ import (
"github.com/go-sigma/sigma/pkg/consts"
"github.com/go-sigma/sigma/pkg/dal/models"
"github.com/go-sigma/sigma/pkg/server/errcode"
svcnamespace "github.com/go-sigma/sigma/pkg/service/namespaces"
namespacesmocks "github.com/go-sigma/sigma/pkg/service/namespaces/mocks"
"github.com/go-sigma/sigma/pkg/validators"
)
@@ -40,7 +40,7 @@ func TestListNamespace(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
serviceObj := svcnamespace.NewMockNamespaceService(ctrl)
serviceObj := namespacesmocks.NewMockNamespaceService(ctrl)
serviceObj.EXPECT().
ListNamespaces(gomock.Any(), "10", gomock.Any(), gomock.Any(), gomock.Any()).
DoAndReturn(func(_ context.Context, userID string, name *string, pagination api.Pagination, sort api.Sortable) ([]*models.Namespace, int64, error) {
@@ -86,7 +86,7 @@ func TestListNamespaceReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
serviceObj := svcnamespace.NewMockNamespaceService(ctrl)
serviceObj := namespacesmocks.NewMockNamespaceService(ctrl)
serviceObj.EXPECT().
ListNamespaces(gomock.Any(), "", gomock.Any(), gomock.Any(), gomock.Any()).
Return(nil, int64(0), errors.New("list failed"))
@@ -31,7 +31,7 @@ import (
"github.com/go-sigma/sigma/pkg/consts"
"github.com/go-sigma/sigma/pkg/dal/models"
"github.com/go-sigma/sigma/pkg/server/errcode"
svcnamespace "github.com/go-sigma/sigma/pkg/service/namespaces"
namespacesmocks "github.com/go-sigma/sigma/pkg/service/namespaces/mocks"
"github.com/go-sigma/sigma/pkg/validators"
)
@@ -41,7 +41,7 @@ func TestPutNamespace(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
serviceObj := svcnamespace.NewMockNamespaceService(ctrl)
serviceObj := namespacesmocks.NewMockNamespaceService(ctrl)
serviceObj.EXPECT().
UpdateNamespace(gomock.Any(), "10", "1", gomock.Any()).
DoAndReturn(func(_ context.Context, userID, id string, req api.UpdateNamespaceRequest) error {
@@ -95,7 +95,7 @@ func TestPutNamespaceReturnsServiceError(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
serviceObj := svcnamespace.NewMockNamespaceService(ctrl)
serviceObj := namespacesmocks.NewMockNamespaceService(ctrl)
serviceObj.EXPECT().
UpdateNamespace(gomock.Any(), "10", "1", gomock.Any()).
Return(errors.New("update failed"))
@@ -29,7 +29,7 @@ import (
"github.com/go-sigma/sigma/pkg/api/enums"
"github.com/go-sigma/sigma/pkg/dal/models"
"github.com/go-sigma/sigma/pkg/server/errcode"
svcrepository "github.com/go-sigma/sigma/pkg/service/repositories"
repositoriesmocks "github.com/go-sigma/sigma/pkg/service/repositories/mocks"
"github.com/go-sigma/sigma/pkg/validators"
)
@@ -39,7 +39,7 @@ func TestDeleteRepository(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
serviceObj := svcrepository.NewMockRepositoryService(ctrl)
serviceObj := repositoriesmocks.NewMockRepositoryService(ctrl)
serviceObj.EXPECT().
DeleteRepository(gomock.Any(), "123", "10", "20").
DoAndReturn(func(_ context.Context, userID, namespaceID, repositoryID string) error {
@@ -125,7 +125,7 @@ func TestDeleteRepositoryReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
serviceObj := svcrepository.NewMockRepositoryService(ctrl)
serviceObj := repositoriesmocks.NewMockRepositoryService(ctrl)
serviceObj.EXPECT().
DeleteRepository(gomock.Any(), "123", "10", "20").
Return(errors.New("delete failed"))
@@ -33,7 +33,7 @@ import (
"github.com/go-sigma/sigma/pkg/dal/models"
"github.com/go-sigma/sigma/pkg/server"
"github.com/go-sigma/sigma/pkg/server/errcode"
svcrepository "github.com/go-sigma/sigma/pkg/service/repositories"
repositoriesmocks "github.com/go-sigma/sigma/pkg/service/repositories/mocks"
"github.com/go-sigma/sigma/pkg/testkit"
"github.com/go-sigma/sigma/pkg/validators"
)
@@ -44,7 +44,7 @@ func TestListRepositories(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
serviceObj := svcrepository.NewMockRepositoryService(ctrl)
serviceObj := repositoriesmocks.NewMockRepositoryService(ctrl)
serviceObj.EXPECT().
ListRepositories(gomock.Any(), "123", "10", gomock.Any(), gomock.Any(), gomock.Any()).
DoAndReturn(func(_ context.Context, userID string, namespaceID string, name *string, pagination api.Pagination, sort api.Sortable) ([]*models.Repository, map[string]*models.Builder, int64, error) {
@@ -89,7 +89,7 @@ func TestListRepositoriesReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
serviceObj := svcrepository.NewMockRepositoryService(ctrl)
serviceObj := repositoriesmocks.NewMockRepositoryService(ctrl)
serviceObj.EXPECT().
ListRepositories(gomock.Any(), "", "10", gomock.Any(), gomock.Any(), gomock.Any()).
Return(nil, nil, int64(0), errors.New("list failed"))
+2 -2
View File
@@ -22,12 +22,12 @@ import (
"go.uber.org/mock/gomock"
"github.com/go-sigma/sigma/pkg/api"
svctag "github.com/go-sigma/sigma/pkg/service/tags"
tagsmocks "github.com/go-sigma/sigma/pkg/service/tags/mocks"
)
func TestDeleteTag(t *testing.T) {
ctrl := gomock.NewController(t)
tagSvc := svctag.NewMockTagService(ctrl)
tagSvc := tagsmocks.NewMockTagService(ctrl)
tagSvc.EXPECT().DeleteTag(gomock.Any(), "namespace-1", "repository-1", "tag-1").Return(nil)
recorder, c := newTagContext(t)
+2 -2
View File
@@ -29,12 +29,12 @@ import (
"github.com/go-sigma/sigma/pkg/authz"
"github.com/go-sigma/sigma/pkg/consts"
"github.com/go-sigma/sigma/pkg/dal/models"
svctag "github.com/go-sigma/sigma/pkg/service/tags"
tagsmocks "github.com/go-sigma/sigma/pkg/service/tags/mocks"
)
func TestGetTag(t *testing.T) {
ctrl := gomock.NewController(t)
tagSvc := svctag.NewMockTagService(ctrl)
tagSvc := tagsmocks.NewMockTagService(ctrl)
tagSvc.EXPECT().GetTag(gomock.Any(), "tag-1").Return(&models.Tag{
ID: "tag-1",
Name: "latest",
+2 -2
View File
@@ -23,12 +23,12 @@ import (
"github.com/go-sigma/sigma/pkg/api"
"github.com/go-sigma/sigma/pkg/dal/models"
svctag "github.com/go-sigma/sigma/pkg/service/tags"
tagsmocks "github.com/go-sigma/sigma/pkg/service/tags/mocks"
)
func TestListTag(t *testing.T) {
ctrl := gomock.NewController(t)
tagSvc := svctag.NewMockTagService(ctrl)
tagSvc := tagsmocks.NewMockTagService(ctrl)
tagSvc.EXPECT().ListTags(
gomock.Any(), "namespace-1", "repository-1", nil, nil, api.Pagination{}, api.Sortable{},
).Return([]*models.Tag{{
+2 -1
View File
@@ -35,6 +35,7 @@ import (
"github.com/go-sigma/sigma/pkg/dal/models"
"github.com/go-sigma/sigma/pkg/logger"
"github.com/go-sigma/sigma/pkg/service/token"
tokenmocks "github.com/go-sigma/sigma/pkg/service/token/mocks"
"github.com/go-sigma/sigma/pkg/testkit"
)
@@ -71,7 +72,7 @@ func TestToken(t *testing.T) {
require.NoError(t, err)
const tokenStr = "mock-token-string" // nolint: gosec
tokenSvc := token.NewMockService(ctrl)
tokenSvc := tokenmocks.NewMockService(ctrl)
tokenSvc.EXPECT().New(gomock.Any(), gomock.Any()).DoAndReturn(func(id string, expire time.Duration) (string, error) {
return tokenStr, nil
})
@@ -27,12 +27,12 @@ import (
"github.com/go-sigma/sigma/pkg/config"
"github.com/go-sigma/sigma/pkg/consts"
"github.com/go-sigma/sigma/pkg/dal/models"
svcuser "github.com/go-sigma/sigma/pkg/service/users"
usersmocks "github.com/go-sigma/sigma/pkg/service/users/mocks"
)
func TestLogin(t *testing.T) {
ctrl := gomock.NewController(t)
service := svcuser.NewMockUserService(ctrl)
service := usersmocks.NewMockUserService(ctrl)
service.EXPECT().Login(gomock.Any(), "user-1", time.Minute, time.Hour).
Return("access-token", "refresh-token", nil)
recorder, c := newUserContext()
@@ -23,12 +23,12 @@ import (
"github.com/go-sigma/sigma/pkg/api"
"github.com/go-sigma/sigma/pkg/consts"
svcuser "github.com/go-sigma/sigma/pkg/service/users"
usersmocks "github.com/go-sigma/sigma/pkg/service/users/mocks"
)
func TestLogout(t *testing.T) {
ctrl := gomock.NewController(t)
service := svcuser.NewMockUserService(ctrl)
service := usersmocks.NewMockUserService(ctrl)
service.EXPECT().Logout(gomock.Any(), []string{"access-token", "refresh-token"}, "jti-1").Return(nil)
recorder, c := newUserContext()
c.Set(consts.ContextJti, "jti-1")
@@ -26,12 +26,12 @@ import (
"github.com/go-sigma/sigma/pkg/api"
"github.com/go-sigma/sigma/pkg/config"
"github.com/go-sigma/sigma/pkg/dal/models"
svcuser "github.com/go-sigma/sigma/pkg/service/users"
usersmocks "github.com/go-sigma/sigma/pkg/service/users/mocks"
)
func TestSignup(t *testing.T) {
ctrl := gomock.NewController(t)
service := svcuser.NewMockUserService(ctrl)
service := usersmocks.NewMockUserService(ctrl)
request := api.PostUserSignupRequest{
Username: "sigma",
Password: "Admin@123",
@@ -57,7 +57,7 @@ func TestSignup(t *testing.T) {
func TestSignupServiceError(t *testing.T) {
ctrl := gomock.NewController(t)
service := svcuser.NewMockUserService(ctrl)
service := usersmocks.NewMockUserService(ctrl)
request := api.PostUserSignupRequest{
Username: "sigma",
Password: "Admin@123",
+20 -20
View File
@@ -32,12 +32,12 @@ import (
"github.com/go-sigma/sigma/pkg/consts"
"github.com/go-sigma/sigma/pkg/dal/models"
"github.com/go-sigma/sigma/pkg/server/errcode"
svcwebhook "github.com/go-sigma/sigma/pkg/service/webhooks"
webhooksmocks "github.com/go-sigma/sigma/pkg/service/webhooks/mocks"
)
func TestPostWebhook(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcwebhook.NewMockWebhookService(ctrl)
serviceObj := webhooksmocks.NewMockWebhookService(ctrl)
serviceObj.EXPECT().
CreateWebhook(gomock.Any(), "10", gomock.Any()).
DoAndReturn(func(_ context.Context, userID string, req api.PostWebhookRequest) error {
@@ -59,7 +59,7 @@ func TestPostWebhook(t *testing.T) {
func TestPostWebhookWithNamespace(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcwebhook.NewMockWebhookService(ctrl)
serviceObj := webhooksmocks.NewMockWebhookService(ctrl)
serviceObj.EXPECT().
CreateWebhook(gomock.Any(), "10", gomock.Any()).
Return(nil)
@@ -140,7 +140,7 @@ func TestPostWebhookReturnsInternalErrorWhenAuthCheckFails(t *testing.T) {
func TestPostWebhookReturnsErrCode(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcwebhook.NewMockWebhookService(ctrl)
serviceObj := webhooksmocks.NewMockWebhookService(ctrl)
serviceObj.EXPECT().
CreateWebhook(gomock.Any(), "10", gomock.Any()).
Return(errcode.HTTPErrCodeBadRequest.Detail("URL is invalid, should start with 'http://' or 'https://'"))
@@ -154,7 +154,7 @@ func TestPostWebhookReturnsErrCode(t *testing.T) {
func TestPostWebhookReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcwebhook.NewMockWebhookService(ctrl)
serviceObj := webhooksmocks.NewMockWebhookService(ctrl)
serviceObj.EXPECT().
CreateWebhook(gomock.Any(), "10", gomock.Any()).
Return(errors.New("create failed"))
@@ -168,7 +168,7 @@ func TestPostWebhookReturnsInternalError(t *testing.T) {
func TestListWebhook(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcwebhook.NewMockWebhookService(ctrl)
serviceObj := webhooksmocks.NewMockWebhookService(ctrl)
serviceObj.EXPECT().
ListWebhooks(gomock.Any(), nil, gomock.Any(), gomock.Any()).
DoAndReturn(func(_ context.Context, namespaceID *string, pagination api.Pagination, sort api.Sortable) ([]*models.Webhook, int64, error) {
@@ -204,7 +204,7 @@ func TestListWebhook(t *testing.T) {
func TestListWebhookWithNamespace(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcwebhook.NewMockWebhookService(ctrl)
serviceObj := webhooksmocks.NewMockWebhookService(ctrl)
serviceObj.EXPECT().
ListWebhooks(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).
DoAndReturn(func(_ context.Context, namespaceID *string, pagination api.Pagination, sort api.Sortable) ([]*models.Webhook, int64, error) {
@@ -231,7 +231,7 @@ func TestListWebhookWithNamespace(t *testing.T) {
func TestListWebhookReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcwebhook.NewMockWebhookService(ctrl)
serviceObj := webhooksmocks.NewMockWebhookService(ctrl)
serviceObj.EXPECT().
ListWebhooks(gomock.Any(), nil, gomock.Any(), gomock.Any()).
Return(nil, int64(0), errors.New("list failed"))
@@ -245,7 +245,7 @@ func TestListWebhookReturnsInternalError(t *testing.T) {
func TestGetWebhook(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcwebhook.NewMockWebhookService(ctrl)
serviceObj := webhooksmocks.NewMockWebhookService(ctrl)
serviceObj.EXPECT().
GetWebhook(gomock.Any(), "1").
Return(&models.Webhook{
@@ -278,7 +278,7 @@ func TestGetWebhook(t *testing.T) {
func TestGetWebhookReturnsUnauthorizedForNonAdmin(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcwebhook.NewMockWebhookService(ctrl)
serviceObj := webhooksmocks.NewMockWebhookService(ctrl)
serviceObj.EXPECT().
GetWebhook(gomock.Any(), "1").
Return(&models.Webhook{
@@ -303,7 +303,7 @@ func TestGetWebhookReturnsUnauthorizedForNonAdmin(t *testing.T) {
func TestGetWebhookReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcwebhook.NewMockWebhookService(ctrl)
serviceObj := webhooksmocks.NewMockWebhookService(ctrl)
serviceObj.EXPECT().
GetWebhook(gomock.Any(), "1").
Return(nil, errors.New("get failed"))
@@ -317,7 +317,7 @@ func TestGetWebhookReturnsInternalError(t *testing.T) {
func TestPutWebhook(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcwebhook.NewMockWebhookService(ctrl)
serviceObj := webhooksmocks.NewMockWebhookService(ctrl)
serviceObj.EXPECT().
GetWebhook(gomock.Any(), "1").
Return(&models.Webhook{
@@ -340,7 +340,7 @@ func TestPutWebhook(t *testing.T) {
func TestPutWebhookReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcwebhook.NewMockWebhookService(ctrl)
serviceObj := webhooksmocks.NewMockWebhookService(ctrl)
serviceObj.EXPECT().
GetWebhook(gomock.Any(), "1").
Return(&models.Webhook{
@@ -363,7 +363,7 @@ func TestPutWebhookReturnsInternalError(t *testing.T) {
func TestDeleteWebhook(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcwebhook.NewMockWebhookService(ctrl)
serviceObj := webhooksmocks.NewMockWebhookService(ctrl)
serviceObj.EXPECT().
GetWebhook(gomock.Any(), "1").
Return(&models.Webhook{
@@ -386,7 +386,7 @@ func TestDeleteWebhook(t *testing.T) {
func TestGetWebhookPing(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcwebhook.NewMockWebhookService(ctrl)
serviceObj := webhooksmocks.NewMockWebhookService(ctrl)
serviceObj.EXPECT().
GetWebhook(gomock.Any(), "1").
Return(&models.Webhook{
@@ -409,7 +409,7 @@ func TestGetWebhookPing(t *testing.T) {
func TestGetWebhookLog(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcwebhook.NewMockWebhookService(ctrl)
serviceObj := webhooksmocks.NewMockWebhookService(ctrl)
serviceObj.EXPECT().
GetWebhook(gomock.Any(), "1").
Return(&models.Webhook{
@@ -447,7 +447,7 @@ func TestGetWebhookLog(t *testing.T) {
func TestListWebhookLogs(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcwebhook.NewMockWebhookService(ctrl)
serviceObj := webhooksmocks.NewMockWebhookService(ctrl)
serviceObj.EXPECT().
GetWebhook(gomock.Any(), "1").
Return(&models.Webhook{
@@ -484,7 +484,7 @@ func TestListWebhookLogs(t *testing.T) {
func TestDeleteWebhookLog(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcwebhook.NewMockWebhookService(ctrl)
serviceObj := webhooksmocks.NewMockWebhookService(ctrl)
serviceObj.EXPECT().
GetWebhook(gomock.Any(), "1").
Return(&models.Webhook{
@@ -507,7 +507,7 @@ func TestDeleteWebhookLog(t *testing.T) {
func TestGetWebhookLogResend(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcwebhook.NewMockWebhookService(ctrl)
serviceObj := webhooksmocks.NewMockWebhookService(ctrl)
serviceObj.EXPECT().
GetWebhook(gomock.Any(), "1").
Return(&models.Webhook{
@@ -530,7 +530,7 @@ func TestGetWebhookLogResend(t *testing.T) {
func TestGetWebhookLogResendReturnsInternalError(t *testing.T) {
ctrl := gomock.NewController(t)
serviceObj := svcwebhook.NewMockWebhookService(ctrl)
serviceObj := webhooksmocks.NewMockWebhookService(ctrl)
serviceObj.EXPECT().
GetWebhook(gomock.Any(), "1").
Return(&models.Webhook{
+9 -9
View File
@@ -23,15 +23,15 @@ import (
"github.com/go-sigma/sigma/pkg/api"
"github.com/go-sigma/sigma/pkg/dal/models"
svcartifacts "github.com/go-sigma/sigma/pkg/service/artifacts"
svcnamespaces "github.com/go-sigma/sigma/pkg/service/namespaces"
svcrepositories "github.com/go-sigma/sigma/pkg/service/repositories"
svctags "github.com/go-sigma/sigma/pkg/service/tags"
artifactsmocks "github.com/go-sigma/sigma/pkg/service/artifacts/mocks"
namespacesmocks "github.com/go-sigma/sigma/pkg/service/namespaces/mocks"
repositoriesmocks "github.com/go-sigma/sigma/pkg/service/repositories/mocks"
tagsmocks "github.com/go-sigma/sigma/pkg/service/tags/mocks"
)
func TestNamespaceTools(t *testing.T) {
ctrl := gomock.NewController(t)
namespaceSvc := svcnamespaces.NewMockNamespaceService(ctrl)
namespaceSvc := namespacesmocks.NewMockNamespaceService(ctrl)
server := &Server{
authorizer: fakeAuthorizer{namespaceAllowed: true},
namespaceSvc: namespaceSvc,
@@ -63,7 +63,7 @@ func TestNamespaceTools(t *testing.T) {
func TestRepositoryTools(t *testing.T) {
ctrl := gomock.NewController(t)
repositorySvc := svcrepositories.NewMockRepositoryService(ctrl)
repositorySvc := repositoriesmocks.NewMockRepositoryService(ctrl)
server := &Server{
authorizer: fakeAuthorizer{namespaceAllowed: true, repositoryAllowed: true},
repositorySvc: repositorySvc,
@@ -91,7 +91,7 @@ func TestRepositoryTools(t *testing.T) {
func TestTagManifestRawGet(t *testing.T) {
ctrl := gomock.NewController(t)
tagSvc := svctags.NewMockTagService(ctrl)
tagSvc := tagsmocks.NewMockTagService(ctrl)
server := &Server{
authorizer: fakeAuthorizer{repositoryAllowed: true},
tagSvc: tagSvc,
@@ -111,8 +111,8 @@ func TestTagManifestRawGet(t *testing.T) {
func TestArtifactTools(t *testing.T) {
ctrl := gomock.NewController(t)
repositorySvc := svcrepositories.NewMockRepositoryService(ctrl)
artifactSvc := svcartifacts.NewMockArtifactService(ctrl)
repositorySvc := repositoriesmocks.NewMockRepositoryService(ctrl)
artifactSvc := artifactsmocks.NewMockArtifactService(ctrl)
server := &Server{
authorizer: fakeAuthorizer{repositoryAllowed: true},
repositorySvc: repositorySvc,
+3 -3
View File
@@ -29,7 +29,7 @@ import (
"github.com/go-sigma/sigma/pkg/config"
"github.com/go-sigma/sigma/pkg/dal/models"
"github.com/go-sigma/sigma/pkg/server/errcode"
svcsystems "github.com/go-sigma/sigma/pkg/service/systems"
systemsmocks "github.com/go-sigma/sigma/pkg/service/systems/mocks"
)
func TestWrapTool(t *testing.T) {
@@ -99,7 +99,7 @@ func TestNewHTTPHandler(t *testing.T) {
func TestSystemTools(t *testing.T) {
ctrl := gomock.NewController(t)
service := svcsystems.NewMockSystemsService(ctrl)
service := systemsmocks.NewMockSystemsService(ctrl)
service.EXPECT().GetVersion(gomock.Any()).Return(api.GetSystemVersionResponse{Version: "1.0.0"}, nil)
service.EXPECT().GetEndpoint(gomock.Any()).Return("https://sigma.example.test", nil)
server := &Server{
@@ -137,7 +137,7 @@ func TestSystemTools(t *testing.T) {
func TestSystemEndpointGetError(t *testing.T) {
ctrl := gomock.NewController(t)
service := svcsystems.NewMockSystemsService(ctrl)
service := systemsmocks.NewMockSystemsService(ctrl)
expectedErr := errors.New("failed")
service.EXPECT().GetEndpoint(gomock.Any()).Return("", expectedErr)
+1 -1
View File
@@ -41,7 +41,7 @@ const (
analyticsLockWaitTimeout = 100 * time.Millisecond
)
//go:generate go tool mockgen -destination=analytics_mocks.go -package=analytics github.com/go-sigma/sigma/pkg/service/analytics Service
//go:generate go tool mockgen -destination=mocks/analytics_mocks.go -package=mocks github.com/go-sigma/sigma/pkg/service/analytics Service
// PushEvent describes a successful manifest push.
type PushEvent struct {
@@ -3,17 +3,18 @@
//
// Generated by this command:
//
// mockgen -destination=analytics_mocks.go -package=analytics github.com/go-sigma/sigma/pkg/service/analytics Service
// mockgen -destination=mocks/analytics_mocks.go -package=mocks github.com/go-sigma/sigma/pkg/service/analytics Service
//
// Package analytics is a generated GoMock package.
package analytics
// Package mocks is a generated GoMock package.
package mocks
import (
context "context"
reflect "reflect"
api "github.com/go-sigma/sigma/pkg/api"
analytics "github.com/go-sigma/sigma/pkg/service/analytics"
gomock "go.uber.org/mock/gomock"
)
@@ -114,7 +115,7 @@ func (mr *MockServiceMockRecorder) RecordNamespaceTagDelta(ctx, namespaceID, del
}
// RecordPull mocks base method.
func (m *MockService) RecordPull(ctx context.Context, event PullEvent) error {
func (m *MockService) RecordPull(ctx context.Context, event analytics.PullEvent) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "RecordPull", ctx, event)
ret0, _ := ret[0].(error)
@@ -128,7 +129,7 @@ func (mr *MockServiceMockRecorder) RecordPull(ctx, event any) *gomock.Call {
}
// RecordPush mocks base method.
func (m *MockService) RecordPush(ctx context.Context, event PushEvent) error {
func (m *MockService) RecordPush(ctx context.Context, event analytics.PushEvent) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "RecordPush", ctx, event)
ret0, _ := ret[0].(error)
+1 -1
View File
@@ -28,7 +28,7 @@ import (
"github.com/go-sigma/sigma/pkg/server/errcode"
)
//go:generate go tool mockgen -mock_names Service=MockArtifactService -destination=artifacts_mocks.go -package=artifacts github.com/go-sigma/sigma/pkg/service/artifacts Service
//go:generate go tool mockgen -mock_names Service=MockArtifactService -destination=mocks/artifacts_mocks.go -package=mocks github.com/go-sigma/sigma/pkg/service/artifacts Service
// Service encapsulates artifact-related business logic.
type Service interface {
@@ -3,11 +3,11 @@
//
// Generated by this command:
//
// mockgen -mock_names Service=MockArtifactService -destination=artifacts_mocks.go -package=artifacts github.com/go-sigma/sigma/pkg/service/artifacts Service
// mockgen -mock_names Service=MockArtifactService -destination=mocks/artifacts_mocks.go -package=mocks github.com/go-sigma/sigma/pkg/service/artifacts Service
//
// Package artifacts is a generated GoMock package.
package artifacts
// Package mocks is a generated GoMock package.
package mocks
import (
context "context"
+1 -1
View File
@@ -43,7 +43,7 @@ import (
"github.com/go-sigma/sigma/pkg/utils/uuid"
)
//go:generate go tool mockgen -mock_names Service=MockBuilderService -destination=builders_mocks.go -package=builders github.com/go-sigma/sigma/pkg/service/builders Service
//go:generate go tool mockgen -mock_names Service=MockBuilderService -destination=mocks/builders_mocks.go -package=mocks github.com/go-sigma/sigma/pkg/service/builders Service
// Service encapsulates builder-related business logic.
type Service interface {
@@ -3,11 +3,11 @@
//
// Generated by this command:
//
// mockgen -mock_names Service=MockBuilderService -destination=builders_mocks.go -package=builders github.com/go-sigma/sigma/pkg/service/builders Service
// mockgen -mock_names Service=MockBuilderService -destination=mocks/builders_mocks.go -package=mocks github.com/go-sigma/sigma/pkg/service/builders Service
//
// Package builders is a generated GoMock package.
package builders
// Package mocks is a generated GoMock package.
package mocks
import (
context "context"
+1 -1
View File
@@ -35,7 +35,7 @@ import (
"github.com/go-sigma/sigma/pkg/utils"
)
//go:generate go tool mockgen -mock_names Service=MockCodeRepositoryService -destination=coderepos_mocks.go -package=coderepos github.com/go-sigma/sigma/pkg/service/coderepos Service
//go:generate go tool mockgen -mock_names Service=MockCodeRepositoryService -destination=mocks/coderepos_mocks.go -package=mocks github.com/go-sigma/sigma/pkg/service/coderepos Service
// Service encapsulates code repository related business logic.
type Service interface {
@@ -3,11 +3,11 @@
//
// Generated by this command:
//
// mockgen -mock_names Service=MockCodeRepositoryService -destination=coderepos_mocks.go -package=coderepos github.com/go-sigma/sigma/pkg/service/coderepos Service
// mockgen -mock_names Service=MockCodeRepositoryService -destination=mocks/coderepos_mocks.go -package=mocks github.com/go-sigma/sigma/pkg/service/coderepos Service
//
// Package coderepos is a generated GoMock package.
package coderepos
// Package mocks is a generated GoMock package.
package mocks
import (
context "context"
+1 -1
View File
@@ -37,7 +37,7 @@ import (
"github.com/go-sigma/sigma/pkg/utils/uuid"
)
//go:generate go tool mockgen -mock_names Service=MockDaemonService -destination=daemons_mocks.go -package=daemons github.com/go-sigma/sigma/pkg/service/daemons Service
//go:generate go tool mockgen -mock_names Service=MockDaemonService -destination=mocks/daemons_mocks.go -package=mocks github.com/go-sigma/sigma/pkg/service/daemons Service
// Service encapsulates daemon GC runner related business logic
type Service interface {
@@ -3,11 +3,11 @@
//
// Generated by this command:
//
// mockgen -mock_names Service=MockDaemonService -destination=daemons_mocks.go -package=daemons github.com/go-sigma/sigma/pkg/service/daemons Service
// mockgen -mock_names Service=MockDaemonService -destination=mocks/daemons_mocks.go -package=mocks github.com/go-sigma/sigma/pkg/service/daemons Service
//
// Package daemons is a generated GoMock package.
package daemons
// Package mocks is a generated GoMock package.
package mocks
import (
context "context"
+1 -1
View File
@@ -40,7 +40,7 @@ import (
"github.com/go-sigma/sigma/pkg/utils/uuid"
)
//go:generate go tool mockgen -mock_names Service=MockDistributionBlobService -destination=blob_mocks.go -package=blob github.com/go-sigma/sigma/pkg/service/distribution/blob Service
//go:generate go tool mockgen -mock_names Service=MockDistributionBlobService -destination=mocks/blob_mocks.go -package=mocks github.com/go-sigma/sigma/pkg/service/distribution/blob Service
// Service encapsulates distribution blob business logic.
type Service interface {
@@ -3,11 +3,11 @@
//
// Generated by this command:
//
// mockgen -mock_names Service=MockDistributionBlobService -destination=blob_mocks.go -package=blob github.com/go-sigma/sigma/pkg/service/distribution/blob Service
// mockgen -mock_names Service=MockDistributionBlobService -destination=mocks/blob_mocks.go -package=mocks github.com/go-sigma/sigma/pkg/service/distribution/blob Service
//
// Package blob is a generated GoMock package.
package blob
// Package mocks is a generated GoMock package.
package mocks
import (
context "context"
@@ -61,7 +61,7 @@ const (
cosignSimpleSigningMediaType = "application/vnd.dev.cosign.simplesigning.v1+json"
)
//go:generate go tool mockgen -mock_names Service=MockDistributionManifestService -destination=manifest_mocks.go -package=manifest github.com/go-sigma/sigma/pkg/service/distribution/manifest Service
//go:generate go tool mockgen -mock_names Service=MockDistributionManifestService -destination=mocks/manifest_mocks.go -package=mocks github.com/go-sigma/sigma/pkg/service/distribution/manifest Service
// Service encapsulates the OCI registry manifest business logic.
type Service interface {
@@ -37,6 +37,7 @@ import (
reporegistrymocks "github.com/go-sigma/sigma/pkg/dal/repository/registry/mocks"
"github.com/go-sigma/sigma/pkg/server/errcode"
svcanalytics "github.com/go-sigma/sigma/pkg/service/analytics"
analyticsmocks "github.com/go-sigma/sigma/pkg/service/analytics/mocks"
mockstorage "github.com/go-sigma/sigma/pkg/storage"
"github.com/go-sigma/sigma/pkg/utils"
)
@@ -106,7 +107,7 @@ func TestGetManifestByTagRecordsPull(t *testing.T) {
repoTag := reporegistrymocks.NewMockTagRepository(ctrl)
repoArtifact := reporegistrymocks.NewMockArtifactRepository(ctrl)
storageDriver := mockstorage.NewMockStorageDriver(ctrl)
analyticsSvc := svcanalytics.NewMockService(ctrl)
analyticsSvc := analyticsmocks.NewMockService(ctrl)
repoRegistry.EXPECT().GetByName(ctx, repository.Name).Return(repository, nil)
repoTag.EXPECT().GetByName(ctx, repository.ID, tag.Name).Return(tag, nil)
@@ -3,11 +3,11 @@
//
// Generated by this command:
//
// mockgen -mock_names Service=MockDistributionManifestService -destination=manifest_mocks.go -package=manifest github.com/go-sigma/sigma/pkg/service/distribution/manifest Service
// mockgen -mock_names Service=MockDistributionManifestService -destination=mocks/manifest_mocks.go -package=mocks github.com/go-sigma/sigma/pkg/service/distribution/manifest Service
//
// Package manifest is a generated GoMock package.
package manifest
// Package mocks is a generated GoMock package.
package mocks
import (
context "context"
@@ -3,11 +3,11 @@
//
// Generated by this command:
//
// mockgen -mock_names Service=MockDistributionUploadService -destination=upload_mocks.go -package=upload github.com/go-sigma/sigma/pkg/service/distribution/upload Service
// mockgen -mock_names Service=MockDistributionUploadService -destination=mocks/upload_mocks.go -package=mocks github.com/go-sigma/sigma/pkg/service/distribution/upload Service
//
// Package upload is a generated GoMock package.
package upload
// Package mocks is a generated GoMock package.
package mocks
import (
context "context"
+1 -1
View File
@@ -40,7 +40,7 @@ import (
"github.com/go-sigma/sigma/pkg/utils/uuid"
)
//go:generate go tool mockgen -mock_names Service=MockDistributionUploadService -destination=upload_mocks.go -package=upload github.com/go-sigma/sigma/pkg/service/distribution/upload Service
//go:generate go tool mockgen -mock_names Service=MockDistributionUploadService -destination=mocks/upload_mocks.go -package=mocks github.com/go-sigma/sigma/pkg/service/distribution/upload Service
// Service encapsulates distribution blob upload business logic.
type Service interface {
@@ -3,11 +3,11 @@
//
// Generated by this command:
//
// mockgen -mock_names Service=MockNamespaceService -destination=namespace_mocks.go -package=namespaces github.com/go-sigma/sigma/pkg/service/namespaces Service
// mockgen -mock_names Service=MockNamespaceService -destination=mocks/namespace_mocks.go -package=mocks github.com/go-sigma/sigma/pkg/service/namespaces Service
//
// Package namespaces is a generated GoMock package.
package namespaces
// Package mocks is a generated GoMock package.
package mocks
import (
context "context"
+1 -1
View File
@@ -37,7 +37,7 @@ import (
"github.com/go-sigma/sigma/pkg/utils/uuid"
)
//go:generate go tool mockgen -mock_names Service=MockNamespaceService -destination=namespace_mocks.go -package=namespaces github.com/go-sigma/sigma/pkg/service/namespaces Service
//go:generate go tool mockgen -mock_names Service=MockNamespaceService -destination=mocks/namespace_mocks.go -package=mocks github.com/go-sigma/sigma/pkg/service/namespaces Service
// Service encapsulates namespace-related business logic.
type Service interface {
@@ -3,11 +3,11 @@
//
// Generated by this command:
//
// mockgen -mock_names Service=MockOAuth2Service -destination=oauth2_mocks.go -package=oauth2 github.com/go-sigma/sigma/pkg/service/oauth2 Service
// mockgen -mock_names Service=MockOAuth2Service -destination=mocks/oauth2_mocks.go -package=mocks github.com/go-sigma/sigma/pkg/service/oauth2 Service
//
// Package oauth2 is a generated GoMock package.
package oauth2
// Package mocks is a generated GoMock package.
package mocks
import (
context "context"
+1 -1
View File
@@ -45,7 +45,7 @@ import (
"github.com/go-sigma/sigma/pkg/utils/uuid"
)
//go:generate go tool mockgen -mock_names Service=MockOAuth2Service -destination=oauth2_mocks.go -package=oauth2 github.com/go-sigma/sigma/pkg/service/oauth2 Service
//go:generate go tool mockgen -mock_names Service=MockOAuth2Service -destination=mocks/oauth2_mocks.go -package=mocks github.com/go-sigma/sigma/pkg/service/oauth2 Service
// Service encapsulates oauth2-related business logic.
type Service interface {
+8 -8
View File
@@ -27,8 +27,8 @@ import (
"github.com/go-sigma/sigma/pkg/dal/models"
repousermocks "github.com/go-sigma/sigma/pkg/dal/repository/user/mocks"
"github.com/go-sigma/sigma/pkg/server/errcode"
"github.com/go-sigma/sigma/pkg/service/password"
"github.com/go-sigma/sigma/pkg/service/token"
passwordmocks "github.com/go-sigma/sigma/pkg/service/password/mocks"
tokenmocks "github.com/go-sigma/sigma/pkg/service/token/mocks"
)
func TestGetClientID(t *testing.T) {
@@ -101,7 +101,7 @@ func TestTryGetUser(t *testing.T) {
authorization: sigmaBasicAuth,
setup: func(ctrl *gomock.Controller) *service {
userRepo := repousermocks.NewMockUserRepository(ctrl)
passwordSvc := password.NewMockService(ctrl)
passwordSvc := passwordmocks.NewMockService(ctrl)
user := &models.User{ID: "user-1", Username: "sigma", Password: &hashedPassword}
userRepo.EXPECT().GetByUsername(gomock.Any(), "sigma").Return(user, nil)
passwordSvc.EXPECT().Verify("password", "hashed").Return(true)
@@ -132,7 +132,7 @@ func TestTryGetUser(t *testing.T) {
authorization: sigmaBasicAuth,
setup: func(ctrl *gomock.Controller) *service {
userRepo := repousermocks.NewMockUserRepository(ctrl)
passwordSvc := password.NewMockService(ctrl)
passwordSvc := passwordmocks.NewMockService(ctrl)
user := &models.User{ID: "user-1", Password: &hashedPassword}
userRepo.EXPECT().GetByUsername(gomock.Any(), "sigma").Return(user, nil)
passwordSvc.EXPECT().Verify("password", "hashed").Return(false)
@@ -145,7 +145,7 @@ func TestTryGetUser(t *testing.T) {
authorization: sigmaBasicAuth,
setup: func(ctrl *gomock.Controller) *service {
userRepo := repousermocks.NewMockUserRepository(ctrl)
passwordSvc := password.NewMockService(ctrl)
passwordSvc := passwordmocks.NewMockService(ctrl)
user := &models.User{ID: "user-1", Password: &hashedPassword}
userRepo.EXPECT().GetByUsername(gomock.Any(), "sigma").Return(user, nil)
passwordSvc.EXPECT().Verify("password", "hashed").Return(true)
@@ -159,7 +159,7 @@ func TestTryGetUser(t *testing.T) {
authorization: "Bearer token-123",
setup: func(ctrl *gomock.Controller) *service {
userRepo := repousermocks.NewMockUserRepository(ctrl)
tokenSvc := token.NewMockService(ctrl)
tokenSvc := tokenmocks.NewMockService(ctrl)
user := &models.User{ID: "user-1", Username: "sigma"}
tokenSvc.EXPECT().Validate(gomock.Any(), "token-123").Return("jti", "user-1", nil)
userRepo.EXPECT().Get(gomock.Any(), "user-1").Return(user, nil)
@@ -171,7 +171,7 @@ func TestTryGetUser(t *testing.T) {
name: "bearer_validate_error",
authorization: "Bearer token-123",
setup: func(ctrl *gomock.Controller) *service {
tokenSvc := token.NewMockService(ctrl)
tokenSvc := tokenmocks.NewMockService(ctrl)
tokenSvc.EXPECT().Validate(gomock.Any(), "token-123").Return("", "", errors.New("invalid token"))
return &service{SvcToken: tokenSvc}
},
@@ -182,7 +182,7 @@ func TestTryGetUser(t *testing.T) {
authorization: "Bearer token-123",
setup: func(ctrl *gomock.Controller) *service {
userRepo := repousermocks.NewMockUserRepository(ctrl)
tokenSvc := token.NewMockService(ctrl)
tokenSvc := tokenmocks.NewMockService(ctrl)
tokenSvc.EXPECT().Validate(gomock.Any(), "token-123").Return("jti", "user-1", nil)
userRepo.EXPECT().Get(gomock.Any(), "user-1").Return(nil, errors.New("db error"))
return &service{RepoUser: userRepo, SvcToken: tokenSvc}
@@ -3,11 +3,11 @@
//
// Generated by this command:
//
// mockgen -destination=password_mocks.go -package=password github.com/go-sigma/sigma/pkg/service/password Service
// mockgen -destination=mocks/password_mocks.go -package=mocks github.com/go-sigma/sigma/pkg/service/password Service
//
// Package password is a generated GoMock package.
package password
// Package mocks is a generated GoMock package.
package mocks
import (
reflect "reflect"
+1 -1
View File
@@ -18,7 +18,7 @@ import (
"golang.org/x/crypto/bcrypt"
)
//go:generate go tool mockgen -destination=password_mocks.go -package=password github.com/go-sigma/sigma/pkg/service/password Service
//go:generate go tool mockgen -destination=mocks/password_mocks.go -package=mocks github.com/go-sigma/sigma/pkg/service/password Service
// Service is an interface for password hashing
type Service interface {
@@ -3,11 +3,11 @@
//
// Generated by this command:
//
// mockgen -mock_names Service=MockRepositoryService -destination=repositories_mocks.go -package=repositories github.com/go-sigma/sigma/pkg/service/repositories Service
// mockgen -mock_names Service=MockRepositoryService -destination=mocks/repositories_mocks.go -package=mocks github.com/go-sigma/sigma/pkg/service/repositories Service
//
// Package repositories is a generated GoMock package.
package repositories
// Package mocks is a generated GoMock package.
package mocks
import (
context "context"
+1 -1
View File
@@ -39,7 +39,7 @@ import (
"github.com/go-sigma/sigma/pkg/utils/uuid"
)
//go:generate go tool mockgen -mock_names Service=MockRepositoryService -destination=repositories_mocks.go -package=repositories github.com/go-sigma/sigma/pkg/service/repositories Service
//go:generate go tool mockgen -mock_names Service=MockRepositoryService -destination=mocks/repositories_mocks.go -package=mocks github.com/go-sigma/sigma/pkg/service/repositories Service
// Service encapsulates repository-related business logic.
type Service interface {
@@ -3,11 +3,11 @@
//
// Generated by this command:
//
// mockgen -mock_names Service=MockSystemsService -destination=systems_mocks.go -package=systems github.com/go-sigma/sigma/pkg/service/systems Service
// mockgen -mock_names Service=MockSystemsService -destination=mocks/systems_mocks.go -package=mocks github.com/go-sigma/sigma/pkg/service/systems Service
//
// Package systems is a generated GoMock package.
package systems
// Package mocks is a generated GoMock package.
package mocks
import (
context "context"
+1 -1
View File
@@ -24,7 +24,7 @@ import (
"github.com/go-sigma/sigma/pkg/version"
)
//go:generate go tool mockgen -mock_names Service=MockSystemsService -destination=systems_mocks.go -package=systems github.com/go-sigma/sigma/pkg/service/systems Service
//go:generate go tool mockgen -mock_names Service=MockSystemsService -destination=mocks/systems_mocks.go -package=mocks github.com/go-sigma/sigma/pkg/service/systems Service
// Service encapsulates system-related business logic.
type Service interface {
@@ -3,11 +3,11 @@
//
// Generated by this command:
//
// mockgen -mock_names Service=MockTagService -destination=tags_mocks.go -package=tags github.com/go-sigma/sigma/pkg/service/tags Service
// mockgen -mock_names Service=MockTagService -destination=mocks/tags_mocks.go -package=mocks github.com/go-sigma/sigma/pkg/service/tags Service
//
// Package tags is a generated GoMock package.
package tags
// Package mocks is a generated GoMock package.
package mocks
import (
context "context"
+1 -1
View File
@@ -35,7 +35,7 @@ import (
"github.com/go-sigma/sigma/pkg/utils"
)
//go:generate go tool mockgen -mock_names Service=MockTagService -destination=tags_mocks.go -package=tags github.com/go-sigma/sigma/pkg/service/tags Service
//go:generate go tool mockgen -mock_names Service=MockTagService -destination=mocks/tags_mocks.go -package=mocks github.com/go-sigma/sigma/pkg/service/tags Service
// Service encapsulates tag-related business logic.
type Service interface {
@@ -3,11 +3,11 @@
//
// Generated by this command:
//
// mockgen -destination=token_mocks.go -package=token github.com/go-sigma/sigma/pkg/service/token Service
// mockgen -destination=mocks/token_mocks.go -package=mocks github.com/go-sigma/sigma/pkg/service/token Service
//
// Package token is a generated GoMock package.
package token
// Package mocks is a generated GoMock package.
package mocks
import (
context "context"
+1 -1
View File
@@ -33,7 +33,7 @@ import (
"github.com/go-sigma/sigma/pkg/utils/uuid"
)
//go:generate go tool mockgen -destination=token_mocks.go -package=token github.com/go-sigma/sigma/pkg/service/token Service
//go:generate go tool mockgen -destination=mocks/token_mocks.go -package=mocks github.com/go-sigma/sigma/pkg/service/token Service
const (
expireVal = "1"
@@ -3,11 +3,11 @@
//
// Generated by this command:
//
// mockgen -mock_names Service=MockUserService -destination=users_mocks.go -package=users github.com/go-sigma/sigma/pkg/service/users Service
// mockgen -mock_names Service=MockUserService -destination=mocks/users_mocks.go -package=mocks github.com/go-sigma/sigma/pkg/service/users Service
//
// Package users is a generated GoMock package.
package users
// Package mocks is a generated GoMock package.
package mocks
import (
context "context"
+1 -1
View File
@@ -38,7 +38,7 @@ import (
"github.com/go-sigma/sigma/pkg/utils/uuid"
)
//go:generate go tool mockgen -mock_names Service=MockUserService -destination=users_mocks.go -package=users github.com/go-sigma/sigma/pkg/service/users Service
//go:generate go tool mockgen -mock_names Service=MockUserService -destination=mocks/users_mocks.go -package=mocks github.com/go-sigma/sigma/pkg/service/users Service
// Service encapsulates user-related business logic.
type Service interface {
+5 -5
View File
@@ -28,8 +28,8 @@ import (
"github.com/go-sigma/sigma/pkg/dal/models"
repousermocks "github.com/go-sigma/sigma/pkg/dal/repository/user/mocks"
"github.com/go-sigma/sigma/pkg/server/errcode"
passwordmocks "github.com/go-sigma/sigma/pkg/service/password"
"github.com/go-sigma/sigma/pkg/service/token"
passwordmocks "github.com/go-sigma/sigma/pkg/service/password/mocks"
tokenmocks "github.com/go-sigma/sigma/pkg/service/token/mocks"
)
func TestListUsers(t *testing.T) {
@@ -50,7 +50,7 @@ func TestListUsers(t *testing.T) {
func TestLogoutSkipsExpiredTokensAndRevokesUniqueIDs(t *testing.T) {
ctrl := gomock.NewController(t)
tokenSvc := token.NewMockService(ctrl)
tokenSvc := tokenmocks.NewMockService(ctrl)
service := &service{SvcToken: tokenSvc}
tokenSvc.EXPECT().Validate(gomock.Any(), "expired").Return("", "", jwt.ErrTokenExpired)
@@ -66,7 +66,7 @@ func TestLogoutSkipsExpiredTokensAndRevokesUniqueIDs(t *testing.T) {
func TestLogoutRequiresJTIAndMapsValidationFailure(t *testing.T) {
ctrl := gomock.NewController(t)
tokenSvc := token.NewMockService(ctrl)
tokenSvc := tokenmocks.NewMockService(ctrl)
service := &service{SvcToken: tokenSvc}
err := service.Logout(t.Context(), nil, "")
@@ -85,7 +85,7 @@ func TestSignupUsesAccessAndRefreshTTL(t *testing.T) {
ctrl := gomock.NewController(t)
userRepository := repousermocks.NewMockUserRepository(ctrl)
passwordSvc := passwordmocks.NewMockService(ctrl)
tokenSvc := token.NewMockService(ctrl)
tokenSvc := tokenmocks.NewMockService(ctrl)
service := &service{
RepoUser: userRepository,
SvcPassword: passwordSvc,
@@ -3,11 +3,11 @@
//
// Generated by this command:
//
// mockgen -mock_names Service=MockWebhookService -destination=webhooks_mocks.go -package=webhooks github.com/go-sigma/sigma/pkg/service/webhooks Service
// mockgen -mock_names Service=MockWebhookService -destination=mocks/webhooks_mocks.go -package=mocks github.com/go-sigma/sigma/pkg/service/webhooks Service
//
// Package webhooks is a generated GoMock package.
package webhooks
// Package mocks is a generated GoMock package.
package mocks
import (
context "context"
+1 -1
View File
@@ -36,7 +36,7 @@ import (
"github.com/go-sigma/sigma/pkg/utils/uuid"
)
//go:generate go tool mockgen -mock_names Service=MockWebhookService -destination=webhooks_mocks.go -package=webhooks github.com/go-sigma/sigma/pkg/service/webhooks Service
//go:generate go tool mockgen -mock_names Service=MockWebhookService -destination=mocks/webhooks_mocks.go -package=mocks github.com/go-sigma/sigma/pkg/service/webhooks Service
// Service encapsulates webhook-related business logic.
type Service interface {