lint: sort imports (#17131)

* lint: add goimports

Signed-off-by: Loong Dai <loong.dai@intel.com>
This commit is contained in:
Loong Dai 2022-07-20 11:33:08 +08:00 committed by GitHub
parent f3edb03b49
commit 09371b48e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
785 changed files with 2175 additions and 1525 deletions

View File

@ -5,6 +5,8 @@ linters-settings:
simplify: false
misspell:
locale: US,UK
goimports:
local-prefixes: github.com/goharbor/harbor
linters:
disable-all: true
@ -32,6 +34,7 @@ linters:
- errcheck
# - gosec
- gosimple
- goimports
- govet
# - noctx
# - rowserrcheck
@ -54,3 +57,17 @@ run:
issue:
max-same-issues: 0
max-per-linter: 0
issues:
# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules:
# Exclude some linters from running on tests files.
- path: _test\.go
linters:
- goimports
- path: src/testing/*.go
linters:
- goimports
- path: src/jobservice/mgt/mock_manager.go
linters:
- goimports

View File

@ -7,10 +7,10 @@ import (
"time"
beego_cache "github.com/beego/beego/cache"
hlog "github.com/goharbor/harbor/src/lib/log"
// Enable redis cache adaptor
_ "github.com/beego/beego/cache/redis"
hlog "github.com/goharbor/harbor/src/lib/log"
)
const (

View File

@ -10,13 +10,13 @@ import (
"time"
"github.com/Masterminds/semver"
"github.com/goharbor/harbor/src/pkg/label/model"
hlog "github.com/goharbor/harbor/src/lib/log"
"helm.sh/helm/v3/pkg/chart"
"helm.sh/helm/v3/pkg/chart/loader"
"helm.sh/helm/v3/pkg/chartutil"
helm_repo "helm.sh/helm/v3/pkg/repo"
hlog "github.com/goharbor/harbor/src/lib/log"
"github.com/goharbor/harbor/src/pkg/label/model"
)
const (

View File

@ -9,13 +9,14 @@ import (
"strings"
"github.com/ghodss/yaml"
helm_repo "helm.sh/helm/v3/pkg/repo"
commonhttp "github.com/goharbor/harbor/src/common/http"
rep_event "github.com/goharbor/harbor/src/controller/event/handler/replication/event"
"github.com/goharbor/harbor/src/lib/errors"
"github.com/goharbor/harbor/src/lib/log"
"github.com/goharbor/harbor/src/lib/orm"
"github.com/goharbor/harbor/src/pkg/reg/model"
helm_repo "helm.sh/helm/v3/pkg/repo"
)
// ListCharts gets the chart list under the namespace

View File

@ -10,8 +10,9 @@ import (
"testing"
"github.com/ghodss/yaml"
htesting "github.com/goharbor/harbor/src/testing"
helm_repo "helm.sh/helm/v3/pkg/repo"
htesting "github.com/goharbor/harbor/src/testing"
)
// The frontend server

View File

@ -2,14 +2,14 @@ package chartserver
import (
"fmt"
"github.com/goharbor/harbor/src/lib/config"
"path"
"strings"
"sync"
"github.com/goharbor/harbor/src/lib/errors"
"helm.sh/helm/v3/cmd/helm/search"
"github.com/goharbor/harbor/src/lib/config"
"github.com/goharbor/harbor/src/lib/errors"
hlog "github.com/goharbor/harbor/src/lib/log"
)

View File

@ -5,15 +5,12 @@ import (
"errors"
"fmt"
"strconv"
"strings"
"time"
"github.com/FZambia/sentinel"
"github.com/gomodule/redigo/redis"
"strings"
"github.com/beego/beego/cache"
"github.com/gomodule/redigo/redis"
)
var (

View File

@ -5,14 +5,15 @@ import (
"os"
"strings"
_ "github.com/jackc/pgx/v4/stdlib" // registry pgx driver
"github.com/prometheus/client_golang/prometheus"
"github.com/spf13/viper"
"github.com/goharbor/harbor/src/common/dao"
commonthttp "github.com/goharbor/harbor/src/common/http"
"github.com/goharbor/harbor/src/common/models"
"github.com/goharbor/harbor/src/lib/log"
"github.com/goharbor/harbor/src/pkg/exporter"
_ "github.com/jackc/pgx/v4/stdlib" // registry pgx driver
"github.com/prometheus/client_golang/prometheus"
"github.com/spf13/viper"
)
func main() {

View File

@ -1,11 +1,11 @@
package main
import (
"github.com/goharbor/harbor/src/common/models"
"os"
"strconv"
"github.com/goharbor/harbor/src/common/dao"
"github.com/goharbor/harbor/src/common/models"
"github.com/goharbor/harbor/src/lib/log"
"github.com/goharbor/harbor/src/migration"
)

View File

@ -15,9 +15,10 @@
package main
import (
"github.com/goharbor/harbor/src/lib/config/metadata"
"os"
"text/template"
"github.com/goharbor/harbor/src/lib/config/metadata"
)
const cfgTemplate = ` Configurations:

View File

@ -24,6 +24,7 @@ import (
"github.com/beego/beego"
"github.com/beego/beego/validation"
commonhttp "github.com/goharbor/harbor/src/common/http"
lib_http "github.com/goharbor/harbor/src/lib/http"
"github.com/goharbor/harbor/src/lib/log"

View File

@ -20,12 +20,12 @@ import (
"strconv"
"sync"
proModels "github.com/goharbor/harbor/src/pkg/project/models"
userModels "github.com/goharbor/harbor/src/pkg/user/models"
"github.com/beego/beego/orm"
"github.com/goharbor/harbor/src/common/models"
"github.com/goharbor/harbor/src/lib/log"
proModels "github.com/goharbor/harbor/src/pkg/project/models"
userModels "github.com/goharbor/harbor/src/pkg/user/models"
)
const (

View File

@ -3,8 +3,9 @@ package dao
import (
"testing"
"github.com/goharbor/harbor/src/lib/log"
"github.com/stretchr/testify/assert"
"github.com/goharbor/harbor/src/lib/log"
)
func TestMLogger_Verbose(t *testing.T) {

View File

@ -20,6 +20,7 @@ import (
"testing"
"github.com/beego/beego/orm"
"github.com/goharbor/harbor/src/common/models"
"github.com/goharbor/harbor/src/lib/log"
libOrm "github.com/goharbor/harbor/src/lib/orm"

View File

@ -20,6 +20,7 @@ import (
"github.com/beego/beego/orm"
_ "github.com/go-sql-driver/mysql" // register mysql driver
"github.com/goharbor/harbor/src/common/utils"
)

View File

@ -23,13 +23,14 @@ import (
"time"
"github.com/beego/beego/orm"
"github.com/goharbor/harbor/src/common/models"
"github.com/goharbor/harbor/src/common/utils"
"github.com/goharbor/harbor/src/lib/log"
migrate "github.com/golang-migrate/migrate/v4"
_ "github.com/golang-migrate/migrate/v4/database/pgx" // import pgx driver for migrator
_ "github.com/golang-migrate/migrate/v4/source/file" // import local file driver for migrator
_ "github.com/jackc/pgx/v4/stdlib" // registry pgx driver
"github.com/goharbor/harbor/src/common/models"
"github.com/goharbor/harbor/src/common/utils"
"github.com/goharbor/harbor/src/lib/log"
)
const defaultMigrationPath = "migrations/postgresql/"

View File

@ -17,9 +17,9 @@ package dao
import (
"time"
"github.com/goharbor/harbor/src/common/models"
"github.com/beego/beego/orm"
"github.com/goharbor/harbor/src/common/models"
"github.com/goharbor/harbor/src/pkg/label/model"
)

View File

@ -15,15 +15,16 @@
package dao
import (
"github.com/goharbor/harbor/src/lib/orm"
"github.com/goharbor/harbor/src/pkg/label/dao"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/goharbor/harbor/src/common"
"github.com/goharbor/harbor/src/common/models"
"github.com/goharbor/harbor/src/lib/orm"
"github.com/goharbor/harbor/src/pkg/label/dao"
"github.com/goharbor/harbor/src/pkg/label/model"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestMethodsOfResourceLabel(t *testing.T) {

View File

@ -16,10 +16,10 @@ package dao
import (
"fmt"
"github.com/goharbor/harbor/src/common/models"
"os"
"strconv"
"github.com/goharbor/harbor/src/common/models"
"github.com/goharbor/harbor/src/lib/log"
)

View File

@ -1,8 +1,9 @@
package http
import (
"github.com/stretchr/testify/assert"
"testing"
"github.com/stretchr/testify/assert"
)
// Test case for error wrapping function.

View File

@ -17,9 +17,10 @@ import (
"net/http"
"testing"
commonsecret "github.com/goharbor/harbor/src/common/secret"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
commonsecret "github.com/goharbor/harbor/src/common/secret"
)
func TestAuthorizeOfSecretAuthorizer(t *testing.T) {

View File

@ -16,12 +16,13 @@ package http
import (
"crypto/tls"
"github.com/goharbor/harbor/src/lib/trace"
"net"
"net/http"
"time"
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
"github.com/goharbor/harbor/src/lib/trace"
)
const (

View File

@ -10,12 +10,11 @@ import (
"regexp"
"strings"
"github.com/goharbor/harbor/src/lib/config"
commonhttp "github.com/goharbor/harbor/src/common/http"
"github.com/goharbor/harbor/src/common/http/modifier/auth"
"github.com/goharbor/harbor/src/common/job/models"
"github.com/goharbor/harbor/src/jobservice/job"
"github.com/goharbor/harbor/src/lib/config"
)
var (

View File

@ -5,9 +5,10 @@ import (
"os"
"testing"
"github.com/stretchr/testify/assert"
"github.com/goharbor/harbor/src/common/job/models"
"github.com/goharbor/harbor/src/common/job/test"
"github.com/stretchr/testify/assert"
)
var (

View File

@ -13,7 +13,6 @@ import (
"github.com/goharbor/harbor/src/common/job/models"
"github.com/goharbor/harbor/src/jobservice/job"
job_models "github.com/goharbor/harbor/src/jobservice/job"
"github.com/goharbor/harbor/src/lib/log"
)
@ -55,8 +54,8 @@ func NewJobServiceServer() *httptest.Server {
return
}
var stats []job.Stats
stat := job_models.Stats{
Info: &job_models.StatsInfo{
stat := job.Stats{
Info: &job.StatsInfo{
JobID: jobUUID + "@123123",
Status: "Pending",
RunAt: time.Now().Unix(),

View File

@ -17,8 +17,9 @@ package models
import (
"testing"
"github.com/goharbor/harbor/src/pkg/label/model"
"github.com/stretchr/testify/assert"
"github.com/goharbor/harbor/src/pkg/label/model"
)
func TestValidOfLabel(t *testing.T) {

View File

@ -16,15 +16,16 @@ package project
import (
"context"
"github.com/goharbor/harbor/src/common/rbac"
"testing"
"github.com/stretchr/testify/assert"
"github.com/goharbor/harbor/src/common"
"github.com/goharbor/harbor/src/common/models"
"github.com/goharbor/harbor/src/common/rbac"
proModels "github.com/goharbor/harbor/src/pkg/project/models"
projecttesting "github.com/goharbor/harbor/src/testing/controller/project"
"github.com/goharbor/harbor/src/testing/mock"
"github.com/stretchr/testify/assert"
)
var (

View File

@ -2,6 +2,7 @@ package system
import (
"context"
"github.com/goharbor/harbor/src/pkg/permission/evaluator"
"github.com/goharbor/harbor/src/pkg/permission/evaluator/namespace"
"github.com/goharbor/harbor/src/pkg/permission/evaluator/rbac"

View File

@ -1,8 +1,9 @@
package system
import (
"github.com/goharbor/harbor/src/pkg/permission/types"
"strings"
"github.com/goharbor/harbor/src/pkg/permission/types"
)
const (

View File

@ -16,10 +16,10 @@ package local
import (
"context"
rbac_project "github.com/goharbor/harbor/src/common/rbac/project"
"sync"
"github.com/goharbor/harbor/src/common/models"
rbac_project "github.com/goharbor/harbor/src/common/rbac/project"
"github.com/goharbor/harbor/src/controller/project"
"github.com/goharbor/harbor/src/pkg/permission/evaluator"
"github.com/goharbor/harbor/src/pkg/permission/evaluator/admin"

View File

@ -16,6 +16,10 @@ package local
import (
"context"
"testing"
"github.com/stretchr/testify/assert"
"github.com/goharbor/harbor/src/common"
"github.com/goharbor/harbor/src/common/models"
"github.com/goharbor/harbor/src/common/rbac"
@ -23,8 +27,6 @@ import (
proModels "github.com/goharbor/harbor/src/pkg/project/models"
projecttesting "github.com/goharbor/harbor/src/testing/controller/project"
"github.com/goharbor/harbor/src/testing/mock"
"github.com/stretchr/testify/assert"
"testing"
)
var (

View File

@ -16,9 +16,9 @@ package proxycachesecret
import (
"context"
rbac_project "github.com/goharbor/harbor/src/common/rbac/project"
"github.com/goharbor/harbor/src/common/rbac"
rbac_project "github.com/goharbor/harbor/src/common/rbac/project"
"github.com/goharbor/harbor/src/common/utils"
"github.com/goharbor/harbor/src/controller/project"
"github.com/goharbor/harbor/src/lib/log"

View File

@ -17,14 +17,15 @@ package proxycachesecret
import (
"context"
"errors"
"github.com/goharbor/harbor/src/common/rbac/project"
"testing"
"github.com/stretchr/testify/suite"
"github.com/goharbor/harbor/src/common/rbac"
"github.com/goharbor/harbor/src/common/rbac/project"
proModels "github.com/goharbor/harbor/src/pkg/project/models"
projecttesting "github.com/goharbor/harbor/src/testing/controller/project"
"github.com/goharbor/harbor/src/testing/mock"
"github.com/stretchr/testify/suite"
)
type proxyCacheSecretTestSuite struct {

View File

@ -17,14 +17,14 @@ package robot
import (
"context"
"fmt"
rbac_project "github.com/goharbor/harbor/src/common/rbac/project"
"github.com/goharbor/harbor/src/common/rbac/system"
"github.com/goharbor/harbor/src/controller/robot"
"strings"
"sync"
"github.com/goharbor/harbor/src/common/rbac"
rbac_project "github.com/goharbor/harbor/src/common/rbac/project"
"github.com/goharbor/harbor/src/common/rbac/system"
"github.com/goharbor/harbor/src/controller/project"
"github.com/goharbor/harbor/src/controller/robot"
"github.com/goharbor/harbor/src/pkg/permission/evaluator"
"github.com/goharbor/harbor/src/pkg/permission/types"
"github.com/goharbor/harbor/src/pkg/project/models"

View File

@ -17,18 +17,19 @@ package robot
import (
"context"
"fmt"
"github.com/goharbor/harbor/src/common/rbac/project"
"github.com/goharbor/harbor/src/controller/robot"
"reflect"
"testing"
"github.com/stretchr/testify/assert"
"github.com/goharbor/harbor/src/common/rbac"
"github.com/goharbor/harbor/src/common/rbac/project"
"github.com/goharbor/harbor/src/controller/robot"
"github.com/goharbor/harbor/src/pkg/permission/types"
proModels "github.com/goharbor/harbor/src/pkg/project/models"
"github.com/goharbor/harbor/src/pkg/robot/model"
projecttesting "github.com/goharbor/harbor/src/testing/controller/project"
"github.com/goharbor/harbor/src/testing/mock"
"github.com/stretchr/testify/assert"
)
var (

View File

@ -18,9 +18,10 @@ import (
libctx "context"
"testing"
"github.com/stretchr/testify/assert"
"github.com/goharbor/harbor/src/common/rbac"
"github.com/goharbor/harbor/src/common/secret"
"github.com/stretchr/testify/assert"
)
func TestIsAuthenticated(t *testing.T) {

View File

@ -2,11 +2,12 @@ package v2token
import (
"context"
rbac_project "github.com/goharbor/harbor/src/common/rbac/project"
"strings"
registry_token "github.com/docker/distribution/registry/auth/token"
"github.com/goharbor/harbor/src/common/rbac"
rbac_project "github.com/goharbor/harbor/src/common/rbac/project"
"github.com/goharbor/harbor/src/common/security"
"github.com/goharbor/harbor/src/controller/project"
"github.com/goharbor/harbor/src/lib/log"

View File

@ -16,15 +16,16 @@ package v2token
import (
"context"
rbac_project "github.com/goharbor/harbor/src/common/rbac/project"
"testing"
"github.com/docker/distribution/registry/auth/token"
"github.com/stretchr/testify/assert"
"github.com/goharbor/harbor/src/common/rbac"
rbac_project "github.com/goharbor/harbor/src/common/rbac/project"
"github.com/goharbor/harbor/src/pkg/permission/types"
"github.com/goharbor/harbor/src/pkg/project/models"
"github.com/goharbor/harbor/src/testing/controller/project"
"github.com/stretchr/testify/assert"
)
func TestAll(t *testing.T) {

View File

@ -16,17 +16,17 @@ package test
import (
"bytes"
"fmt"
"io"
"net/http"
"net/http/httptest"
"strings"
"fmt"
"os"
"sort"
"strings"
"github.com/gorilla/mux"
"github.com/goharbor/harbor/src/common"
"github.com/gorilla/mux"
)
// RequestHandlerMapping is a mapping between request and its handler

View File

@ -25,9 +25,10 @@ import (
"os"
"strings"
"github.com/goharbor/harbor/src/lib/log"
"golang.org/x/oauth2"
"golang.org/x/oauth2/clientcredentials"
"github.com/goharbor/harbor/src/lib/log"
)
const (

View File

@ -2,8 +2,6 @@ package uaa
import (
"fmt"
"github.com/goharbor/harbor/src/common/utils/uaa/test"
"github.com/stretchr/testify/assert"
"io/ioutil"
"net/http/httptest"
"os"
@ -11,6 +9,10 @@ import (
"runtime"
"strings"
"testing"
"github.com/stretchr/testify/assert"
"github.com/goharbor/harbor/src/common/utils/uaa/test"
)
var mockUAAServer *httptest.Server

View File

@ -16,6 +16,7 @@ package uaa
import (
"fmt"
"golang.org/x/oauth2"
)

View File

@ -18,20 +18,20 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/goharbor/harbor/src/controller/artifact/processor/wasm"
"github.com/goharbor/harbor/src/lib/q"
"github.com/goharbor/harbor/src/pkg"
"github.com/docker/distribution/manifest/manifestlist"
"github.com/docker/distribution/manifest/schema1"
"github.com/docker/distribution/manifest/schema2"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/goharbor/harbor/src/controller/artifact/processor"
"github.com/goharbor/harbor/src/controller/artifact/processor/wasm"
"github.com/goharbor/harbor/src/lib/log"
"github.com/goharbor/harbor/src/lib/q"
"github.com/goharbor/harbor/src/pkg"
"github.com/goharbor/harbor/src/pkg/artifact"
"github.com/goharbor/harbor/src/pkg/blob"
"github.com/goharbor/harbor/src/pkg/registry"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
)
// Abstractor abstracts the metadata of artifact

View File

@ -17,6 +17,12 @@ package artifact
import (
"testing"
"github.com/docker/distribution"
"github.com/docker/distribution/manifest/schema1"
"github.com/docker/distribution/manifest/schema2"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/stretchr/testify/suite"
"github.com/goharbor/harbor/src/controller/artifact/processor"
"github.com/goharbor/harbor/src/pkg/artifact"
"github.com/goharbor/harbor/src/pkg/blob"
@ -25,12 +31,6 @@ import (
tblob "github.com/goharbor/harbor/src/testing/pkg/blob"
tpro "github.com/goharbor/harbor/src/testing/pkg/processor"
"github.com/goharbor/harbor/src/testing/pkg/registry"
"github.com/docker/distribution"
"github.com/docker/distribution/manifest/schema1"
"github.com/docker/distribution/manifest/schema2"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/stretchr/testify/suite"
)
var (

View File

@ -3,9 +3,9 @@ package annotation
import (
"testing"
fp "github.com/goharbor/harbor/src/testing/pkg/parser"
"github.com/stretchr/testify/suite"
fp "github.com/goharbor/harbor/src/testing/pkg/parser"
)
type parserTestSuite struct {

View File

@ -9,12 +9,12 @@ import (
"net/http"
"strings"
"github.com/docker/distribution/manifest/schema2"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/goharbor/harbor/src/lib/errors"
"github.com/goharbor/harbor/src/pkg/artifact"
reg "github.com/goharbor/harbor/src/pkg/registry"
"github.com/docker/distribution/manifest/schema2"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
)
const (

View File

@ -21,12 +21,12 @@ import (
"strings"
"testing"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/stretchr/testify/suite"
"github.com/goharbor/harbor/src/pkg/artifact"
"github.com/goharbor/harbor/src/pkg/distribution"
reg "github.com/goharbor/harbor/src/testing/pkg/registry"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/stretchr/testify/suite"
)
var (

View File

@ -22,24 +22,24 @@ import (
"strings"
"time"
"github.com/goharbor/harbor/src/pkg"
accessorymodel "github.com/goharbor/harbor/src/pkg/accessory/model"
"github.com/opencontainers/go-digest"
"github.com/goharbor/harbor/src/controller/artifact/processor"
"github.com/goharbor/harbor/src/controller/artifact/processor/chart"
"github.com/goharbor/harbor/src/controller/artifact/processor/cnab"
"github.com/goharbor/harbor/src/controller/artifact/processor/image"
"github.com/goharbor/harbor/src/controller/artifact/processor/wasm"
"github.com/goharbor/harbor/src/lib/icon"
"github.com/goharbor/harbor/src/controller/artifact/processor"
"github.com/goharbor/harbor/src/controller/event/metadata"
"github.com/goharbor/harbor/src/controller/tag"
"github.com/goharbor/harbor/src/lib"
"github.com/goharbor/harbor/src/lib/errors"
"github.com/goharbor/harbor/src/lib/icon"
"github.com/goharbor/harbor/src/lib/log"
"github.com/goharbor/harbor/src/lib/orm"
"github.com/goharbor/harbor/src/lib/q"
"github.com/goharbor/harbor/src/pkg"
"github.com/goharbor/harbor/src/pkg/accessory"
accessorymodel "github.com/goharbor/harbor/src/pkg/accessory/model"
"github.com/goharbor/harbor/src/pkg/artifact"
"github.com/goharbor/harbor/src/pkg/artifactrash"
"github.com/goharbor/harbor/src/pkg/artifactrash/model"
@ -53,7 +53,6 @@ import (
"github.com/goharbor/harbor/src/pkg/repository"
"github.com/goharbor/harbor/src/pkg/signature"
model_tag "github.com/goharbor/harbor/src/pkg/tag/model/tag"
"github.com/opencontainers/go-digest"
)
var (

View File

@ -19,6 +19,10 @@ import (
"testing"
"time"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/suite"
"github.com/goharbor/harbor/src/controller/artifact/processor/chart"
"github.com/goharbor/harbor/src/controller/artifact/processor/cnab"
"github.com/goharbor/harbor/src/controller/artifact/processor/image"
@ -36,8 +40,8 @@ import (
model_tag "github.com/goharbor/harbor/src/pkg/tag/model/tag"
tagtesting "github.com/goharbor/harbor/src/testing/controller/tag"
ormtesting "github.com/goharbor/harbor/src/testing/lib/orm"
"github.com/goharbor/harbor/src/testing/pkg/accessory"
accessorytesting "github.com/goharbor/harbor/src/testing/pkg/accessory"
"github.com/goharbor/harbor/src/testing/pkg/accessory"
arttesting "github.com/goharbor/harbor/src/testing/pkg/artifact"
artrashtesting "github.com/goharbor/harbor/src/testing/pkg/artifactrash"
"github.com/goharbor/harbor/src/testing/pkg/blob"
@ -45,9 +49,6 @@ import (
"github.com/goharbor/harbor/src/testing/pkg/label"
"github.com/goharbor/harbor/src/testing/pkg/registry"
repotesting "github.com/goharbor/harbor/src/testing/pkg/repository"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/suite"
)
// TODO find another way to test artifact controller, it's hard to maintain currently

View File

@ -16,16 +16,17 @@ package artifact
import (
"context"
accessorymodel "github.com/goharbor/harbor/src/pkg/accessory/model"
"testing"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/suite"
"github.com/goharbor/harbor/src/lib/q"
accessorymodel "github.com/goharbor/harbor/src/pkg/accessory/model"
"github.com/goharbor/harbor/src/pkg/artifact"
"github.com/goharbor/harbor/src/testing/pkg/accessory"
accessorytesting "github.com/goharbor/harbor/src/testing/pkg/accessory"
artifacttesting "github.com/goharbor/harbor/src/testing/pkg/artifact"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/suite"
)
type IteratorTestSuite struct {

View File

@ -17,6 +17,7 @@ package artifact
import (
"encoding/json"
"fmt"
"github.com/goharbor/harbor/src/common/utils"
"github.com/goharbor/harbor/src/controller/tag"
"github.com/goharbor/harbor/src/lib/encode/repository"

View File

@ -2,9 +2,11 @@ package artifact
import (
"encoding/json"
"github.com/goharbor/harbor/src/pkg/accessory/model/cosign"
"github.com/stretchr/testify/assert"
"testing"
"github.com/stretchr/testify/assert"
"github.com/goharbor/harbor/src/pkg/accessory/model/cosign"
)
func TestUnmarshalJSONWithACC(t *testing.T) {

View File

@ -16,6 +16,7 @@ package base
import (
"context"
"github.com/goharbor/harbor/src/controller/artifact/processor"
"github.com/goharbor/harbor/src/lib/errors"
"github.com/goharbor/harbor/src/pkg/artifact"

View File

@ -17,11 +17,13 @@ package base
import (
"context"
"encoding/json"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/goharbor/harbor/src/controller/artifact/processor"
"github.com/goharbor/harbor/src/lib/errors"
"github.com/goharbor/harbor/src/pkg/artifact"
"github.com/goharbor/harbor/src/pkg/registry"
"github.com/opencontainers/image-spec/specs-go/v1"
)
// NewManifestProcessor creates a new base manifest processor.

View File

@ -19,10 +19,11 @@ import (
"strings"
"testing"
"github.com/goharbor/harbor/src/pkg/artifact"
"github.com/goharbor/harbor/src/testing/pkg/registry"
"github.com/opencontainers/image-spec/specs-go/v1"
"github.com/stretchr/testify/suite"
"github.com/goharbor/harbor/src/pkg/artifact"
"github.com/goharbor/harbor/src/testing/pkg/registry"
)
const (

View File

@ -19,13 +19,14 @@ import (
"encoding/json"
"io/ioutil"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
ps "github.com/goharbor/harbor/src/controller/artifact/processor"
"github.com/goharbor/harbor/src/controller/artifact/processor/base"
"github.com/goharbor/harbor/src/lib/errors"
"github.com/goharbor/harbor/src/lib/log"
"github.com/goharbor/harbor/src/pkg/artifact"
"github.com/goharbor/harbor/src/pkg/chart"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
)
// const definitions

View File

@ -20,15 +20,16 @@ import (
"testing"
"github.com/docker/distribution"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/stretchr/testify/suite"
helm_chart "helm.sh/helm/v3/pkg/chart"
"github.com/goharbor/harbor/src/controller/artifact/processor/base"
"github.com/goharbor/harbor/src/lib/errors"
"github.com/goharbor/harbor/src/pkg/artifact"
chartserver "github.com/goharbor/harbor/src/pkg/chart"
"github.com/goharbor/harbor/src/testing/pkg/chart"
"github.com/goharbor/harbor/src/testing/pkg/registry"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/stretchr/testify/suite"
helm_chart "helm.sh/helm/v3/pkg/chart"
)
var (

View File

@ -20,11 +20,12 @@ import (
"testing"
"github.com/docker/distribution"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/stretchr/testify/suite"
"github.com/goharbor/harbor/src/controller/artifact/processor/base"
"github.com/goharbor/harbor/src/pkg/artifact"
"github.com/goharbor/harbor/src/testing/pkg/registry"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/stretchr/testify/suite"
)
type processorTestSuite struct {

View File

@ -22,12 +22,13 @@ import (
"github.com/docker/distribution/manifest/schema2"
// annotation parsers will be registered
v1 "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/goharbor/harbor/src/controller/artifact/annotation"
"github.com/goharbor/harbor/src/lib/errors"
"github.com/goharbor/harbor/src/lib/log"
"github.com/goharbor/harbor/src/pkg/artifact"
"github.com/goharbor/harbor/src/pkg/registry"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
)
const (

View File

@ -20,15 +20,14 @@ import (
"strings"
"testing"
"github.com/goharbor/harbor/src/pkg/distribution"
"github.com/goharbor/harbor/src/testing/mock"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/stretchr/testify/suite"
"github.com/goharbor/harbor/src/pkg/artifact"
"github.com/goharbor/harbor/src/pkg/distribution"
"github.com/goharbor/harbor/src/testing/mock"
"github.com/goharbor/harbor/src/testing/pkg/parser"
"github.com/goharbor/harbor/src/testing/pkg/registry"
"github.com/stretchr/testify/suite"
)
var (

View File

@ -18,11 +18,12 @@ import (
"context"
"github.com/docker/distribution/manifest/manifestlist"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/goharbor/harbor/src/controller/artifact/processor"
"github.com/goharbor/harbor/src/controller/artifact/processor/base"
"github.com/goharbor/harbor/src/lib/log"
"github.com/goharbor/harbor/src/pkg/artifact"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
)
func init() {

View File

@ -19,6 +19,7 @@ import (
"encoding/json"
"github.com/docker/distribution/manifest/schema1"
"github.com/goharbor/harbor/src/controller/artifact/processor"
"github.com/goharbor/harbor/src/lib/errors"
"github.com/goharbor/harbor/src/lib/log"

View File

@ -17,9 +17,10 @@ package image
import (
"testing"
"github.com/stretchr/testify/suite"
"github.com/goharbor/harbor/src/lib/errors"
"github.com/goharbor/harbor/src/pkg/artifact"
"github.com/stretchr/testify/suite"
)
type manifestV1ProcessorTestSuite struct {

View File

@ -19,12 +19,13 @@ import (
"encoding/json"
"github.com/docker/distribution/manifest/schema2"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/goharbor/harbor/src/controller/artifact/processor"
"github.com/goharbor/harbor/src/controller/artifact/processor/base"
"github.com/goharbor/harbor/src/lib/errors"
"github.com/goharbor/harbor/src/lib/log"
"github.com/goharbor/harbor/src/pkg/artifact"
"github.com/opencontainers/image-spec/specs-go/v1"
)
// const definitions

View File

@ -22,12 +22,13 @@ import (
"github.com/docker/distribution"
"github.com/docker/distribution/manifest/schema2"
"github.com/stretchr/testify/suite"
"github.com/goharbor/harbor/src/controller/artifact/processor/base"
"github.com/goharbor/harbor/src/lib/errors"
"github.com/goharbor/harbor/src/pkg/artifact"
"github.com/goharbor/harbor/src/testing/mock"
"github.com/goharbor/harbor/src/testing/pkg/registry"
"github.com/stretchr/testify/suite"
)
var (

View File

@ -16,9 +16,11 @@ package processor
import (
"context"
"github.com/goharbor/harbor/src/pkg/artifact"
"github.com/stretchr/testify/suite"
"testing"
"github.com/stretchr/testify/suite"
"github.com/goharbor/harbor/src/pkg/artifact"
)
type fakeProcessor struct{}

View File

@ -17,12 +17,14 @@ package wasm
import (
"context"
"encoding/json"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/goharbor/harbor/src/controller/artifact/processor"
"github.com/goharbor/harbor/src/controller/artifact/processor/base"
"github.com/goharbor/harbor/src/lib/errors"
"github.com/goharbor/harbor/src/lib/log"
"github.com/goharbor/harbor/src/pkg/artifact"
"github.com/opencontainers/image-spec/specs-go/v1"
)
// const definitions

View File

@ -17,19 +17,18 @@ package wasm
import (
"bytes"
"encoding/json"
"io/ioutil"
"strings"
"testing"
"github.com/docker/distribution/manifest/schema2"
"github.com/stretchr/testify/suite"
"github.com/goharbor/harbor/src/controller/artifact/processor/base"
"github.com/goharbor/harbor/src/lib/errors"
"github.com/goharbor/harbor/src/pkg/artifact"
"github.com/goharbor/harbor/src/testing/mock"
"github.com/goharbor/harbor/src/testing/pkg/registry"
"github.com/stretchr/testify/suite"
)
var (

View File

@ -19,14 +19,14 @@ import (
"fmt"
"time"
"github.com/goharbor/harbor/src/lib/q"
libredis "github.com/goharbor/harbor/src/lib/redis"
"github.com/docker/distribution"
"github.com/go-redis/redis/v8"
"github.com/goharbor/harbor/src/lib/errors"
"github.com/goharbor/harbor/src/lib/log"
"github.com/goharbor/harbor/src/lib/orm"
"github.com/goharbor/harbor/src/lib/q"
libredis "github.com/goharbor/harbor/src/lib/redis"
"github.com/goharbor/harbor/src/pkg/blob"
blob_models "github.com/goharbor/harbor/src/pkg/blob/models"
)

View File

@ -20,19 +20,18 @@ import (
"testing"
"time"
"github.com/goharbor/harbor/src/lib/errors"
"github.com/goharbor/harbor/src/pkg/blob/models"
"github.com/docker/distribution/manifest/schema2"
"github.com/google/uuid"
"github.com/stretchr/testify/suite"
"github.com/goharbor/harbor/src/lib/errors"
"github.com/goharbor/harbor/src/pkg/blob"
pkg_blob "github.com/goharbor/harbor/src/pkg/blob"
"github.com/goharbor/harbor/src/pkg/blob/models"
"github.com/goharbor/harbor/src/pkg/distribution"
htesting "github.com/goharbor/harbor/src/testing"
"github.com/goharbor/harbor/src/testing/mock"
blobtesting "github.com/goharbor/harbor/src/testing/pkg/blob"
"github.com/google/uuid"
"github.com/stretchr/testify/suite"
pkg_blob "github.com/goharbor/harbor/src/pkg/blob"
)
type ControllerTestSuite struct {

View File

@ -16,12 +16,13 @@ package config
import (
"context"
"testing"
"github.com/goharbor/harbor/src/common"
"github.com/goharbor/harbor/src/lib/config"
"github.com/goharbor/harbor/src/lib/config/metadata"
testCfg "github.com/goharbor/harbor/src/testing/lib/config"
"github.com/goharbor/harbor/src/testing/mock"
"testing"
)
func Test_verifySkipAuditLogCfg(t *testing.T) {

View File

@ -16,15 +16,16 @@ package test
import (
"context"
"testing"
"github.com/stretchr/testify/suite"
"github.com/goharbor/harbor/src/common"
. "github.com/goharbor/harbor/src/controller/config"
"github.com/goharbor/harbor/src/lib/errors"
_ "github.com/goharbor/harbor/src/pkg/config/db"
_ "github.com/goharbor/harbor/src/pkg/config/inmemory"
htesting "github.com/goharbor/harbor/src/testing"
"github.com/stretchr/testify/suite"
"testing"
)
var TestDBConfig = map[string]interface{}{

View File

@ -16,6 +16,7 @@ package auditlog
import (
"context"
"github.com/goharbor/harbor/src/controller/event"
"github.com/goharbor/harbor/src/lib/config"
"github.com/goharbor/harbor/src/lib/log"

View File

@ -18,6 +18,9 @@ import (
"context"
"testing"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/suite"
common_dao "github.com/goharbor/harbor/src/common/dao"
"github.com/goharbor/harbor/src/controller/event"
"github.com/goharbor/harbor/src/controller/event/metadata"
@ -26,8 +29,6 @@ import (
_ "github.com/goharbor/harbor/src/pkg/config/db"
"github.com/goharbor/harbor/src/pkg/notifier"
ne "github.com/goharbor/harbor/src/pkg/notifier/event"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/suite"
)
type MockAuditLogManager struct {

View File

@ -20,6 +20,8 @@ import (
"time"
beegoorm "github.com/beego/beego/orm"
"github.com/stretchr/testify/suite"
common_dao "github.com/goharbor/harbor/src/common/dao"
"github.com/goharbor/harbor/src/controller/event"
"github.com/goharbor/harbor/src/lib/config"
@ -30,7 +32,6 @@ import (
"github.com/goharbor/harbor/src/pkg/repository/model"
"github.com/goharbor/harbor/src/pkg/tag"
tagmodel "github.com/goharbor/harbor/src/pkg/tag/model/tag"
"github.com/stretchr/testify/suite"
)
// ArtifactHandlerTestSuite is test suite for artifact handler.

View File

@ -17,6 +17,8 @@ package internal
import (
"testing"
"github.com/stretchr/testify/suite"
"github.com/goharbor/harbor/src/controller/artifact"
"github.com/goharbor/harbor/src/controller/event"
"github.com/goharbor/harbor/src/controller/project"
@ -29,7 +31,6 @@ import (
scantesting "github.com/goharbor/harbor/src/testing/controller/scan"
ormtesting "github.com/goharbor/harbor/src/testing/lib/orm"
"github.com/goharbor/harbor/src/testing/mock"
"github.com/stretchr/testify/suite"
)
type AutoScanTestSuite struct {

View File

@ -17,12 +17,11 @@ package p2p
import (
"context"
"github.com/goharbor/harbor/src/controller/tag"
"github.com/goharbor/harbor/src/controller/artifact"
"github.com/goharbor/harbor/src/controller/artifact/processor/image"
"github.com/goharbor/harbor/src/controller/event"
"github.com/goharbor/harbor/src/controller/p2p/preheat"
"github.com/goharbor/harbor/src/controller/tag"
"github.com/goharbor/harbor/src/lib/errors"
"github.com/goharbor/harbor/src/lib/log"
)

View File

@ -2,6 +2,11 @@ package p2p
import (
"context"
"testing"
"time"
"github.com/stretchr/testify/suite"
"github.com/goharbor/harbor/src/controller/artifact"
"github.com/goharbor/harbor/src/controller/event"
"github.com/goharbor/harbor/src/controller/p2p/preheat"
@ -10,9 +15,6 @@ import (
test_artifact "github.com/goharbor/harbor/src/testing/controller/artifact"
test_preheat "github.com/goharbor/harbor/src/testing/controller/p2p/preheat"
"github.com/goharbor/harbor/src/testing/mock"
"github.com/stretchr/testify/suite"
"testing"
"time"
)
// PreheatTestSuite is a test suite of testing preheat handler

View File

@ -6,9 +6,8 @@ import (
"strings"
"github.com/goharbor/harbor/src/lib/config"
"github.com/goharbor/harbor/src/lib/orm"
"github.com/goharbor/harbor/src/lib/log"
"github.com/goharbor/harbor/src/lib/orm"
"github.com/goharbor/harbor/src/pkg/distribution"
policy_model "github.com/goharbor/harbor/src/pkg/notification/policy/model"
"github.com/goharbor/harbor/src/pkg/notifier/event"

View File

@ -1,13 +1,13 @@
package util
import (
"github.com/goharbor/harbor/src/common/utils/test"
"github.com/goharbor/harbor/src/lib/config"
_ "github.com/goharbor/harbor/src/pkg/config/inmemory"
"os"
"testing"
"github.com/goharbor/harbor/src/common"
"github.com/goharbor/harbor/src/common/utils/test"
"github.com/goharbor/harbor/src/lib/config"
_ "github.com/goharbor/harbor/src/pkg/config/inmemory"
)
func TestMain(m *testing.M) {

View File

@ -19,6 +19,7 @@ import (
"fmt"
beegorm "github.com/beego/beego/orm"
"github.com/goharbor/harbor/src/controller/event"
"github.com/goharbor/harbor/src/controller/event/handler/util"
"github.com/goharbor/harbor/src/controller/project"

View File

@ -4,21 +4,20 @@ import (
"context"
"errors"
"fmt"
proModels "github.com/goharbor/harbor/src/pkg/project/models"
"strings"
"github.com/goharbor/harbor/src/lib/config"
"github.com/goharbor/harbor/src/controller/event"
"github.com/goharbor/harbor/src/controller/event/handler/util"
ctlModel "github.com/goharbor/harbor/src/controller/event/model"
"github.com/goharbor/harbor/src/controller/project"
"github.com/goharbor/harbor/src/controller/replication"
"github.com/goharbor/harbor/src/jobservice/job"
"github.com/goharbor/harbor/src/lib/config"
"github.com/goharbor/harbor/src/lib/log"
"github.com/goharbor/harbor/src/lib/orm"
"github.com/goharbor/harbor/src/pkg/notification"
"github.com/goharbor/harbor/src/pkg/notifier/model"
proModels "github.com/goharbor/harbor/src/pkg/project/models"
"github.com/goharbor/harbor/src/pkg/reg"
rpModel "github.com/goharbor/harbor/src/pkg/reg/model"
)

View File

@ -16,27 +16,27 @@ package artifact
import (
"context"
proModels "github.com/goharbor/harbor/src/pkg/project/models"
"testing"
"time"
"github.com/goharbor/harbor/src/lib/config"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
common_dao "github.com/goharbor/harbor/src/common/dao"
"github.com/goharbor/harbor/src/controller/event"
"github.com/goharbor/harbor/src/controller/project"
repctl "github.com/goharbor/harbor/src/controller/replication"
repctlmodel "github.com/goharbor/harbor/src/controller/replication/model"
"github.com/goharbor/harbor/src/lib/config"
_ "github.com/goharbor/harbor/src/pkg/config/db"
_ "github.com/goharbor/harbor/src/pkg/config/inmemory"
"github.com/goharbor/harbor/src/pkg/notification"
policy_model "github.com/goharbor/harbor/src/pkg/notification/policy/model"
proModels "github.com/goharbor/harbor/src/pkg/project/models"
projecttesting "github.com/goharbor/harbor/src/testing/controller/project"
replicationtesting "github.com/goharbor/harbor/src/testing/controller/replication"
"github.com/goharbor/harbor/src/testing/mock"
testingnotification "github.com/goharbor/harbor/src/testing/pkg/notification/policy"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestReplicationHandler_Handle(t *testing.T) {

View File

@ -5,15 +5,14 @@ import (
"fmt"
"strings"
"github.com/goharbor/harbor/src/controller/retention"
"github.com/goharbor/harbor/src/lib/config"
"github.com/goharbor/harbor/src/lib/orm"
"github.com/goharbor/harbor/src/controller/event"
"github.com/goharbor/harbor/src/controller/event/handler/util"
evtModel "github.com/goharbor/harbor/src/controller/event/model"
"github.com/goharbor/harbor/src/controller/retention"
"github.com/goharbor/harbor/src/lib/config"
"github.com/goharbor/harbor/src/lib/errors"
"github.com/goharbor/harbor/src/lib/log"
"github.com/goharbor/harbor/src/lib/orm"
"github.com/goharbor/harbor/src/pkg/notification"
"github.com/goharbor/harbor/src/pkg/notifier/model"
)

View File

@ -6,21 +6,20 @@ import (
"testing"
"time"
"github.com/goharbor/harbor/src/common/dao"
"github.com/goharbor/harbor/src/lib/config"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
"github.com/goharbor/harbor/src/common/dao"
"github.com/goharbor/harbor/src/controller/event"
"github.com/goharbor/harbor/src/controller/retention"
"github.com/goharbor/harbor/src/lib/config"
"github.com/goharbor/harbor/src/lib/selector"
"github.com/goharbor/harbor/src/pkg/notification"
policy_model "github.com/goharbor/harbor/src/pkg/notification/policy/model"
ret "github.com/goharbor/harbor/src/pkg/retention"
retentiontesting "github.com/goharbor/harbor/src/testing/controller/retention"
testingnotification "github.com/goharbor/harbor/src/testing/pkg/notification/policy"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
)
func TestRetentionHandler_Handle(t *testing.T) {

View File

@ -18,11 +18,11 @@ import (
"context"
"errors"
"fmt"
"github.com/goharbor/harbor/src/lib/config"
"github.com/goharbor/harbor/src/controller/event"
"github.com/goharbor/harbor/src/controller/event/handler/util"
"github.com/goharbor/harbor/src/controller/project"
"github.com/goharbor/harbor/src/lib/config"
"github.com/goharbor/harbor/src/lib/log"
"github.com/goharbor/harbor/src/pkg/notification"
"github.com/goharbor/harbor/src/pkg/notifier/model"

View File

@ -16,23 +16,24 @@ package chart
import (
"context"
testutils "github.com/goharbor/harbor/src/common/utils/test"
"github.com/goharbor/harbor/src/lib/config"
_ "github.com/goharbor/harbor/src/pkg/config/db"
_ "github.com/goharbor/harbor/src/pkg/config/inmemory"
proModels "github.com/goharbor/harbor/src/pkg/project/models"
"os"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
testutils "github.com/goharbor/harbor/src/common/utils/test"
"github.com/goharbor/harbor/src/controller/event"
"github.com/goharbor/harbor/src/controller/project"
"github.com/goharbor/harbor/src/lib/config"
_ "github.com/goharbor/harbor/src/pkg/config/db"
_ "github.com/goharbor/harbor/src/pkg/config/inmemory"
"github.com/goharbor/harbor/src/pkg/notification"
"github.com/goharbor/harbor/src/pkg/notification/policy/model"
proModels "github.com/goharbor/harbor/src/pkg/project/models"
projecttesting "github.com/goharbor/harbor/src/testing/controller/project"
"github.com/goharbor/harbor/src/testing/mock"
testingnotification "github.com/goharbor/harbor/src/testing/pkg/notification/policy"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestMain(m *testing.M) {

View File

@ -16,24 +16,25 @@ package quota
import (
"context"
"testing"
"time"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
"github.com/goharbor/harbor/src/common"
common_dao "github.com/goharbor/harbor/src/common/dao"
"github.com/goharbor/harbor/src/controller/event"
"github.com/goharbor/harbor/src/lib/config"
_ "github.com/goharbor/harbor/src/pkg/config/inmemory"
policy_model "github.com/goharbor/harbor/src/pkg/notification/policy/model"
proModels "github.com/goharbor/harbor/src/pkg/project/models"
"github.com/goharbor/harbor/src/testing/mock"
"testing"
"time"
"github.com/goharbor/harbor/src/common"
"github.com/goharbor/harbor/src/pkg/notification"
"github.com/goharbor/harbor/src/pkg/notification/policy"
policy_model "github.com/goharbor/harbor/src/pkg/notification/policy/model"
"github.com/goharbor/harbor/src/pkg/notifier"
"github.com/goharbor/harbor/src/pkg/notifier/model"
proModels "github.com/goharbor/harbor/src/pkg/project/models"
"github.com/goharbor/harbor/src/testing/mock"
testing_notification "github.com/goharbor/harbor/src/testing/pkg/notification/policy"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
)
// QuotaPreprocessHandlerSuite ...

View File

@ -19,13 +19,14 @@ import (
"fmt"
"testing"
"github.com/stretchr/testify/suite"
"github.com/goharbor/harbor/src/controller/artifact"
"github.com/goharbor/harbor/src/controller/event"
"github.com/goharbor/harbor/src/controller/scan"
"github.com/goharbor/harbor/src/lib/q"
artifacttesting "github.com/goharbor/harbor/src/testing/controller/artifact"
scantesting "github.com/goharbor/harbor/src/testing/controller/scan"
"github.com/stretchr/testify/suite"
)
type DelArtHandlerTestSuite struct {

View File

@ -19,6 +19,7 @@ import (
"time"
o "github.com/beego/beego/orm"
"github.com/goharbor/harbor/src/controller/artifact"
"github.com/goharbor/harbor/src/controller/event"
"github.com/goharbor/harbor/src/controller/event/handler/util"

View File

@ -16,19 +16,22 @@ package scan
import (
"context"
common_dao "github.com/goharbor/harbor/src/common/dao"
"github.com/goharbor/harbor/src/controller/event"
"github.com/goharbor/harbor/src/lib/config"
_ "github.com/goharbor/harbor/src/pkg/config/inmemory"
policy_model "github.com/goharbor/harbor/src/pkg/notification/policy/model"
"testing"
"time"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
"github.com/goharbor/harbor/src/common"
common_dao "github.com/goharbor/harbor/src/common/dao"
"github.com/goharbor/harbor/src/controller/artifact"
"github.com/goharbor/harbor/src/controller/event"
sc "github.com/goharbor/harbor/src/controller/scan"
"github.com/goharbor/harbor/src/lib/config"
_ "github.com/goharbor/harbor/src/pkg/config/inmemory"
"github.com/goharbor/harbor/src/pkg/notification"
"github.com/goharbor/harbor/src/pkg/notification/policy"
policy_model "github.com/goharbor/harbor/src/pkg/notification/policy/model"
"github.com/goharbor/harbor/src/pkg/notifier"
"github.com/goharbor/harbor/src/pkg/notifier/model"
"github.com/goharbor/harbor/src/pkg/scan/dao/scan"
@ -38,8 +41,6 @@ import (
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/policy"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
)
// ScanImagePreprocessHandlerSuite is a test suite to test scan image preprocess handler.

View File

@ -16,11 +16,12 @@ package metadata
import (
"context"
"time"
"github.com/goharbor/harbor/src/common/security"
event2 "github.com/goharbor/harbor/src/controller/event"
"github.com/goharbor/harbor/src/pkg/artifact"
"github.com/goharbor/harbor/src/pkg/notifier/event"
"time"
)
// PushArtifactEventMetadata is the metadata from which the push artifact event can be resolved

View File

@ -16,11 +16,13 @@ package metadata
import (
"context"
"testing"
"github.com/stretchr/testify/suite"
event2 "github.com/goharbor/harbor/src/controller/event"
"github.com/goharbor/harbor/src/pkg/artifact"
"github.com/goharbor/harbor/src/pkg/notifier/event"
"github.com/stretchr/testify/suite"
"testing"
)
type artifactEventTestSuite struct {

View File

@ -1,9 +1,10 @@
package metadata
import (
"time"
event2 "github.com/goharbor/harbor/src/controller/event"
"github.com/goharbor/harbor/src/pkg/notifier/event"
"time"
)
// ChartMetaData defines meta data of chart event

View File

@ -15,11 +15,13 @@
package metadata
import (
event2 "github.com/goharbor/harbor/src/controller/event"
"github.com/goharbor/harbor/src/pkg/notifier/event"
"github.com/stretchr/testify/suite"
"testing"
"time"
"github.com/stretchr/testify/suite"
event2 "github.com/goharbor/harbor/src/controller/event"
"github.com/goharbor/harbor/src/pkg/notifier/event"
)
type chartEventTestSuite struct {

View File

@ -16,10 +16,11 @@ package metadata
import (
"context"
"time"
"github.com/goharbor/harbor/src/common/security"
event2 "github.com/goharbor/harbor/src/controller/event"
"github.com/goharbor/harbor/src/pkg/notifier/event"
"time"
)
// ArtifactLabeledMetadata is the metadata from which the artifact labeled event can be resolved

View File

@ -15,9 +15,10 @@
package metadata
import (
"time"
event2 "github.com/goharbor/harbor/src/controller/event"
"github.com/goharbor/harbor/src/pkg/notifier/event"
"time"
)
// CreateProjectEventMetadata is the metadata from which the create project event can be resolved

View File

@ -15,10 +15,12 @@
package metadata
import (
"testing"
"github.com/stretchr/testify/suite"
event2 "github.com/goharbor/harbor/src/controller/event"
"github.com/goharbor/harbor/src/pkg/notifier/event"
"github.com/stretchr/testify/suite"
"testing"
)
type projectEventTestSuite struct {

View File

@ -1,12 +1,12 @@
package metadata
import (
proModels "github.com/goharbor/harbor/src/pkg/project/models"
"time"
event2 "github.com/goharbor/harbor/src/controller/event"
"github.com/goharbor/harbor/src/lib/errors"
"github.com/goharbor/harbor/src/pkg/notifier/event"
proModels "github.com/goharbor/harbor/src/pkg/project/models"
)
// QuotaMetaData defines quota related event data

View File

@ -17,9 +17,10 @@ package metadata
import (
"testing"
"github.com/stretchr/testify/suite"
event2 "github.com/goharbor/harbor/src/controller/event"
"github.com/goharbor/harbor/src/pkg/notifier/event"
"github.com/stretchr/testify/suite"
)
type quotaEventTestSuite struct {

Some files were not shown because too many files have changed in this diff Show More