mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-22 08:38:03 +01:00
refactor: rename testing/api to testing/controller (#11295)
Signed-off-by: He Weiwei <hweiwei@vmware.com>
This commit is contained in:
parent
96572c3c86
commit
73f3a305ce
@ -27,7 +27,7 @@ import (
|
||||
"github.com/goharbor/harbor/src/lib/q"
|
||||
"github.com/goharbor/harbor/src/pkg/artifact"
|
||||
model_tag "github.com/goharbor/harbor/src/pkg/tag/model/tag"
|
||||
tagtesting "github.com/goharbor/harbor/src/testing/api/tag"
|
||||
tagtesting "github.com/goharbor/harbor/src/testing/controller/tag"
|
||||
ormtesting "github.com/goharbor/harbor/src/testing/lib/orm"
|
||||
arttesting "github.com/goharbor/harbor/src/testing/pkg/artifact"
|
||||
artrashtesting "github.com/goharbor/harbor/src/testing/pkg/artifactrash"
|
||||
|
@ -31,8 +31,8 @@ import (
|
||||
"github.com/goharbor/harbor/src/pkg/scan/dao/scan"
|
||||
"github.com/goharbor/harbor/src/pkg/scan/report"
|
||||
v1 "github.com/goharbor/harbor/src/pkg/scan/rest/v1"
|
||||
artifacttesting "github.com/goharbor/harbor/src/testing/api/artifact"
|
||||
scantesting "github.com/goharbor/harbor/src/testing/api/scan"
|
||||
artifacttesting "github.com/goharbor/harbor/src/testing/controller/artifact"
|
||||
scantesting "github.com/goharbor/harbor/src/testing/controller/scan"
|
||||
"github.com/goharbor/harbor/src/testing/mock"
|
||||
notificationtesting "github.com/goharbor/harbor/src/testing/pkg/notification"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
@ -19,9 +19,9 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/goharbor/harbor/src/pkg/types"
|
||||
artifacttesting "github.com/goharbor/harbor/src/testing/api/artifact"
|
||||
blobtesting "github.com/goharbor/harbor/src/testing/api/blob"
|
||||
charttesting "github.com/goharbor/harbor/src/testing/api/chartmuseum"
|
||||
artifacttesting "github.com/goharbor/harbor/src/testing/controller/artifact"
|
||||
blobtesting "github.com/goharbor/harbor/src/testing/controller/blob"
|
||||
charttesting "github.com/goharbor/harbor/src/testing/controller/chartmuseum"
|
||||
"github.com/goharbor/harbor/src/testing/mock"
|
||||
"github.com/stretchr/testify/suite"
|
||||
)
|
||||
|
@ -26,7 +26,7 @@ import (
|
||||
"github.com/goharbor/harbor/src/pkg/quota"
|
||||
"github.com/goharbor/harbor/src/pkg/quota/driver"
|
||||
"github.com/goharbor/harbor/src/pkg/types"
|
||||
projecttesting "github.com/goharbor/harbor/src/testing/api/project"
|
||||
projecttesting "github.com/goharbor/harbor/src/testing/controller/project"
|
||||
ormtesting "github.com/goharbor/harbor/src/testing/lib/orm"
|
||||
"github.com/goharbor/harbor/src/testing/mock"
|
||||
quotatesting "github.com/goharbor/harbor/src/testing/pkg/quota"
|
||||
|
@ -19,7 +19,7 @@ import (
|
||||
"github.com/goharbor/harbor/src/controller/artifact"
|
||||
ierror "github.com/goharbor/harbor/src/lib/error"
|
||||
"github.com/goharbor/harbor/src/lib/orm"
|
||||
artifacttesting "github.com/goharbor/harbor/src/testing/api/artifact"
|
||||
artifacttesting "github.com/goharbor/harbor/src/testing/controller/artifact"
|
||||
ormtesting "github.com/goharbor/harbor/src/testing/lib/orm"
|
||||
"github.com/goharbor/harbor/src/testing/mock"
|
||||
arttesting "github.com/goharbor/harbor/src/testing/pkg/artifact"
|
||||
|
@ -36,8 +36,8 @@ import (
|
||||
"github.com/goharbor/harbor/src/pkg/scan/dao/scanner"
|
||||
v1 "github.com/goharbor/harbor/src/pkg/scan/rest/v1"
|
||||
"github.com/goharbor/harbor/src/pkg/scan/vuln"
|
||||
artifacttesting "github.com/goharbor/harbor/src/testing/api/artifact"
|
||||
scannertesting "github.com/goharbor/harbor/src/testing/api/scanner"
|
||||
artifacttesting "github.com/goharbor/harbor/src/testing/controller/artifact"
|
||||
scannertesting "github.com/goharbor/harbor/src/testing/controller/scanner"
|
||||
mocktesting "github.com/goharbor/harbor/src/testing/mock"
|
||||
reporttesting "github.com/goharbor/harbor/src/testing/pkg/scan/report"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
@ -21,8 +21,8 @@ import (
|
||||
"github.com/goharbor/harbor/src/controller/artifact"
|
||||
"github.com/goharbor/harbor/src/pkg/scan/dao/scanner"
|
||||
v1 "github.com/goharbor/harbor/src/pkg/scan/rest/v1"
|
||||
artifacttesting "github.com/goharbor/harbor/src/testing/api/artifact"
|
||||
scannertesting "github.com/goharbor/harbor/src/testing/api/scanner"
|
||||
artifacttesting "github.com/goharbor/harbor/src/testing/controller/artifact"
|
||||
scannertesting "github.com/goharbor/harbor/src/testing/controller/scanner"
|
||||
"github.com/goharbor/harbor/src/testing/mock"
|
||||
"github.com/stretchr/testify/suite"
|
||||
)
|
||||
|
@ -22,7 +22,7 @@ import (
|
||||
sc "github.com/goharbor/harbor/src/controller/scanner"
|
||||
"github.com/goharbor/harbor/src/lib/q"
|
||||
"github.com/goharbor/harbor/src/pkg/scan/dao/scanner"
|
||||
scannertesting "github.com/goharbor/harbor/src/testing/api/scanner"
|
||||
scannertesting "github.com/goharbor/harbor/src/testing/controller/scanner"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
@ -22,7 +22,7 @@ import (
|
||||
sc "github.com/goharbor/harbor/src/controller/scanner"
|
||||
"github.com/goharbor/harbor/src/lib/q"
|
||||
"github.com/goharbor/harbor/src/pkg/scan/dao/scanner"
|
||||
scannertesting "github.com/goharbor/harbor/src/testing/api/scanner"
|
||||
scannertesting "github.com/goharbor/harbor/src/testing/controller/scanner"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
@ -26,10 +26,10 @@ import (
|
||||
"github.com/goharbor/harbor/src/controller/project"
|
||||
"github.com/goharbor/harbor/src/controller/quota"
|
||||
"github.com/goharbor/harbor/src/pkg/types"
|
||||
artifacttesting "github.com/goharbor/harbor/src/testing/api/artifact"
|
||||
blobtesting "github.com/goharbor/harbor/src/testing/api/blob"
|
||||
projecttesting "github.com/goharbor/harbor/src/testing/api/project"
|
||||
quotatesting "github.com/goharbor/harbor/src/testing/api/quota"
|
||||
artifacttesting "github.com/goharbor/harbor/src/testing/controller/artifact"
|
||||
blobtesting "github.com/goharbor/harbor/src/testing/controller/blob"
|
||||
projecttesting "github.com/goharbor/harbor/src/testing/controller/project"
|
||||
quotatesting "github.com/goharbor/harbor/src/testing/controller/quota"
|
||||
"github.com/goharbor/harbor/src/testing/mock"
|
||||
"github.com/stretchr/testify/suite"
|
||||
)
|
||||
|
@ -22,7 +22,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/goharbor/harbor/src/common/models"
|
||||
"github.com/goharbor/harbor/src/testing/api/project"
|
||||
"github.com/goharbor/harbor/src/testing/controller/project"
|
||||
"github.com/stretchr/testify/mock"
|
||||
)
|
||||
|
||||
|
@ -29,10 +29,10 @@ import (
|
||||
"github.com/goharbor/harbor/src/lib"
|
||||
v1 "github.com/goharbor/harbor/src/pkg/scan/rest/v1"
|
||||
"github.com/goharbor/harbor/src/pkg/scan/vuln"
|
||||
artifacttesting "github.com/goharbor/harbor/src/testing/api/artifact"
|
||||
projecttesting "github.com/goharbor/harbor/src/testing/api/project"
|
||||
scantesting "github.com/goharbor/harbor/src/testing/api/scan"
|
||||
securitytesting "github.com/goharbor/harbor/src/testing/common/security"
|
||||
artifacttesting "github.com/goharbor/harbor/src/testing/controller/artifact"
|
||||
projecttesting "github.com/goharbor/harbor/src/testing/controller/project"
|
||||
scantesting "github.com/goharbor/harbor/src/testing/controller/scan"
|
||||
"github.com/goharbor/harbor/src/testing/mock"
|
||||
"github.com/stretchr/testify/suite"
|
||||
)
|
||||
|
@ -18,7 +18,7 @@ import (
|
||||
"encoding/json"
|
||||
"github.com/goharbor/harbor/src/common/models"
|
||||
"github.com/goharbor/harbor/src/controller/repository"
|
||||
repotesting "github.com/goharbor/harbor/src/testing/api/repository"
|
||||
repotesting "github.com/goharbor/harbor/src/testing/controller/repository"
|
||||
"github.com/stretchr/testify/suite"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
|
@ -25,8 +25,8 @@ import (
|
||||
"github.com/goharbor/harbor/src/controller/artifact"
|
||||
"github.com/goharbor/harbor/src/controller/repository"
|
||||
ierror "github.com/goharbor/harbor/src/lib/error"
|
||||
arttesting "github.com/goharbor/harbor/src/testing/api/artifact"
|
||||
repotesting "github.com/goharbor/harbor/src/testing/api/repository"
|
||||
arttesting "github.com/goharbor/harbor/src/testing/controller/artifact"
|
||||
repotesting "github.com/goharbor/harbor/src/testing/controller/repository"
|
||||
"github.com/goharbor/harbor/src/testing/mock"
|
||||
"github.com/stretchr/testify/suite"
|
||||
)
|
||||
|
@ -20,8 +20,8 @@ import (
|
||||
"github.com/goharbor/harbor/src/controller/repository"
|
||||
"github.com/goharbor/harbor/src/controller/tag"
|
||||
model_tag "github.com/goharbor/harbor/src/pkg/tag/model/tag"
|
||||
repotesting "github.com/goharbor/harbor/src/testing/api/repository"
|
||||
tagtesting "github.com/goharbor/harbor/src/testing/api/tag"
|
||||
repotesting "github.com/goharbor/harbor/src/testing/controller/repository"
|
||||
tagtesting "github.com/goharbor/harbor/src/testing/controller/tag"
|
||||
"github.com/stretchr/testify/suite"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
|
@ -19,7 +19,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/goharbor/harbor/src/server/v2.0/handler/model"
|
||||
"github.com/goharbor/harbor/src/testing/api/scan"
|
||||
"github.com/goharbor/harbor/src/testing/controller/scan"
|
||||
"github.com/goharbor/harbor/src/testing/mock"
|
||||
"github.com/stretchr/testify/suite"
|
||||
)
|
||||
|
@ -1,24 +0,0 @@
|
||||
// Copyright Project Harbor Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package api
|
||||
|
||||
//go:generate mockery -case snake -dir ../../api/artifact -name Controller -output ./artifact -outpkg artifact
|
||||
//go:generate mockery -case snake -dir ../../api/blob -name Controller -output ./blob -outpkg blob
|
||||
//go:generate mockery -case snake -dir ../../api/chartmuseum -name Controller -output ./chartmuseum -outpkg chartmuseum
|
||||
//go:generate mockery -case snake -dir ../../api/project -name Controller -output ./project -outpkg project
|
||||
//go:generate mockery -case snake -dir ../../api/quota -name Controller -output ./quota -outpkg quota
|
||||
//go:generate mockery -case snake -dir ../../api/scan -name Controller -output ./scan -outpkg scan
|
||||
//go:generate mockery -case snake -dir ../../api/scan -name Checker -output ./scan -outpkg scan
|
||||
//go:generate mockery -case snake -dir ../../api/scanner -name Controller -output ./scanner -outpkg scanner
|
24
src/testing/controller/controller.go
Normal file
24
src/testing/controller/controller.go
Normal file
@ -0,0 +1,24 @@
|
||||
// Copyright Project Harbor Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package controller
|
||||
|
||||
//go:generate mockery -case snake -dir ../../controller/artifact -name Controller -output ./artifact -outpkg artifact
|
||||
//go:generate mockery -case snake -dir ../../controller/blob -name Controller -output ./blob -outpkg blob
|
||||
//go:generate mockery -case snake -dir ../../controller/chartmuseum -name Controller -output ./chartmuseum -outpkg chartmuseum
|
||||
//go:generate mockery -case snake -dir ../../controller/project -name Controller -output ./project -outpkg project
|
||||
//go:generate mockery -case snake -dir ../../controller/quota -name Controller -output ./quota -outpkg quota
|
||||
//go:generate mockery -case snake -dir ../../controller/scan -name Controller -output ./scan -outpkg scan
|
||||
//go:generate mockery -case snake -dir ../../controller/scan -name Checker -output ./scan -outpkg scan
|
||||
//go:generate mockery -case snake -dir ../../controller/scanner -name Controller -output ./scanner -outpkg scanner
|
@ -3,7 +3,7 @@
|
||||
package scanner
|
||||
|
||||
import (
|
||||
apiscanner "github.com/goharbor/harbor/src/controller/scanner"
|
||||
controllerscanner "github.com/goharbor/harbor/src/controller/scanner"
|
||||
mock "github.com/stretchr/testify/mock"
|
||||
|
||||
q "github.com/goharbor/harbor/src/lib/q"
|
||||
@ -109,7 +109,7 @@ func (_m *Controller) GetRegistration(registrationUUID string) (*scanner.Registr
|
||||
}
|
||||
|
||||
// GetRegistrationByProject provides a mock function with given fields: projectID, options
|
||||
func (_m *Controller) GetRegistrationByProject(projectID int64, options ...apiscanner.Option) (*scanner.Registration, error) {
|
||||
func (_m *Controller) GetRegistrationByProject(projectID int64, options ...controllerscanner.Option) (*scanner.Registration, error) {
|
||||
_va := make([]interface{}, len(options))
|
||||
for _i := range options {
|
||||
_va[_i] = options[_i]
|
||||
@ -120,7 +120,7 @@ func (_m *Controller) GetRegistrationByProject(projectID int64, options ...apisc
|
||||
ret := _m.Called(_ca...)
|
||||
|
||||
var r0 *scanner.Registration
|
||||
if rf, ok := ret.Get(0).(func(int64, ...apiscanner.Option) *scanner.Registration); ok {
|
||||
if rf, ok := ret.Get(0).(func(int64, ...controllerscanner.Option) *scanner.Registration); ok {
|
||||
r0 = rf(projectID, options...)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
@ -129,7 +129,7 @@ func (_m *Controller) GetRegistrationByProject(projectID int64, options ...apisc
|
||||
}
|
||||
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func(int64, ...apiscanner.Option) error); ok {
|
||||
if rf, ok := ret.Get(1).(func(int64, ...controllerscanner.Option) error); ok {
|
||||
r1 = rf(projectID, options...)
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
Loading…
Reference in New Issue
Block a user