Skip to content

Commit

Permalink
upgrade controller runtim version
Browse files Browse the repository at this point in the history
Signed-off-by: coderth <[email protected]>
  • Loading branch information
CoderTH committed May 22, 2023
1 parent 54c117c commit 88c6ca9
Show file tree
Hide file tree
Showing 66 changed files with 304 additions and 554 deletions.
3 changes: 1 addition & 2 deletions apis/goharbor.io/v1alpha3/harbor_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ package v1alpha3_test
import (
goharborv1 "github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha3"
harbormetav1 "github.com/goharbor/harbor-operator/apis/meta/v1alpha1"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
)
Expand Down
2 changes: 1 addition & 1 deletion apis/goharbor.io/v1alpha3/v1alpha3_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package v1alpha3_test
import (
"testing"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

Expand Down
2 changes: 1 addition & 1 deletion apis/goharbor.io/v1beta1/v1beta1_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package v1beta1_test
import (
"testing"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

Expand Down
2 changes: 1 addition & 1 deletion controllers/goharbor/chartmuseum/chartmuseum_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"fmt"
"time"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

goharborv1 "github.com/goharbor/harbor-operator/apis/goharbor.io/v1beta1"
Expand Down
13 changes: 4 additions & 9 deletions controllers/goharbor/chartmuseum/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ import (
"context"
"testing"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/goharbor/harbor-operator/controllers/goharbor/chartmuseum"
"github.com/goharbor/harbor-operator/controllers/goharbor/internal/test"
"github.com/goharbor/harbor-operator/controllers/goharbor/internal/test/controllers"
"sigs.k8s.io/controller-runtime/pkg/envtest/printer"
)

var (
Expand All @@ -21,22 +20,18 @@ var (
func TestAPIs(t *testing.T) {
RegisterFailHandler(Fail)

RunSpecsWithDefaultAndCustomReporters(t,
"Controller Suite",
[]Reporter{printer.NewlineReporter{}})
RunSpecs(t, "Controller Suite")
}

var _ = BeforeSuite(func(done Done) {
var _ = BeforeSuite(func() {
ctx = test.InitSuite()

className := test.NewName("class")

reconciler = controllers.NewChartMuseum(ctx, className)

test.StartManager(ctx)

close(done)
}, 60)
})

var _ = AfterSuite(func() {
defer test.AfterSuite(ctx)
Expand Down
3 changes: 1 addition & 2 deletions controllers/goharbor/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import (
"context"
"time"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gstruct"

Expand Down
2 changes: 1 addition & 1 deletion controllers/goharbor/core/core_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"strings"
"time"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

goharborv1 "github.com/goharbor/harbor-operator/apis/goharbor.io/v1beta1"
Expand Down
13 changes: 4 additions & 9 deletions controllers/goharbor/core/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ import (
"context"
"testing"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/goharbor/harbor-operator/controllers/goharbor/core"
"github.com/goharbor/harbor-operator/controllers/goharbor/internal/test"
"github.com/goharbor/harbor-operator/controllers/goharbor/internal/test/controllers"
"sigs.k8s.io/controller-runtime/pkg/envtest/printer"
)

var (
Expand All @@ -34,22 +33,18 @@ var (
func TestAPIs(t *testing.T) {
RegisterFailHandler(Fail)

RunSpecsWithDefaultAndCustomReporters(t,
"Controller Suite",
[]Reporter{printer.NewlineReporter{}})
RunSpecs(t, "Controller Suite")
}

var _ = BeforeSuite(func(done Done) {
var _ = BeforeSuite(func() {
ctx = test.InitSuite()

className := test.NewName("class")

reconciler = controllers.NewCore(ctx, className)

test.StartManager(ctx)

close(done)
}, 60)
})

var _ = AfterSuite(func() {
defer test.AfterSuite(ctx)
Expand Down
2 changes: 1 addition & 1 deletion controllers/goharbor/harbor/harbor_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/goharbor/harbor-operator/controllers"
"github.com/goharbor/harbor-operator/controllers/goharbor/harbor"
"github.com/goharbor/harbor-operator/pkg/config"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/serializer"
Expand Down
2 changes: 1 addition & 1 deletion controllers/goharbor/harbor/harbor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/goharbor/harbor-operator/controllers/goharbor/harbor"
"github.com/goharbor/harbor-operator/controllers/goharbor/internal/test"
"github.com/goharbor/harbor-operator/pkg/image"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
Expand Down
2 changes: 1 addition & 1 deletion controllers/goharbor/harbor/trivy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/goharbor/harbor-operator/pkg/controller"
"github.com/goharbor/harbor-operator/pkg/factories/owner"
"github.com/goharbor/harbor-operator/pkg/graph"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/ovh/configstore"
ctrl "sigs.k8s.io/controller-runtime"
Expand Down
2 changes: 1 addition & 1 deletion controllers/goharbor/harbor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/goharbor/harbor-operator/pkg/factories/logger"
certv1 "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1"
cmmeta "github.com/jetstack/cert-manager/pkg/apis/meta/v1"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
apierrs "k8s.io/apimachinery/pkg/api/errors"
Expand Down
2 changes: 1 addition & 1 deletion controllers/goharbor/internal/test/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/goharbor/harbor-operator/pkg/factories/application"
"github.com/goharbor/harbor-operator/pkg/factories/logger"
"github.com/goharbor/harbor-operator/pkg/scheme"
"github.com/onsi/ginkgo"
"github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/rest"
Expand Down
4 changes: 2 additions & 2 deletions controllers/goharbor/internal/test/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"fmt"
"math/rand"

"github.com/onsi/ginkgo"
"github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -72,7 +72,7 @@ func InitNamespace(ctxFactory func() context.Context) *corev1.Namespace {
})

ginkgo.AfterEach(func() {
if ginkgo.CurrentGinkgoTestDescription().Failed && keepNamespaceOnFailure {
if ginkgo.CurrentSpecReport().Failed() && keepNamespaceOnFailure {
fmt.Fprintf(ginkgo.GinkgoWriter, "keeping namespace %s\n", ns.GetName())

return
Expand Down
2 changes: 1 addition & 1 deletion controllers/goharbor/internal/test/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package test
import (
"context"

"github.com/onsi/ginkgo"
"github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/manager"
Expand Down
8 changes: 3 additions & 5 deletions controllers/goharbor/internal/test/pods/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"

"github.com/goharbor/harbor-operator/controllers/goharbor/internal/test"
"github.com/onsi/ginkgo"
"github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"
appsv1 "k8s.io/api/apps/v1"
"k8s.io/apimachinery/pkg/types"
Expand Down Expand Up @@ -43,10 +43,8 @@ func (pods Pods) Logs(ctx context.Context) map[string][]byte {
}

func LogsAll(ctx *context.Context, name func() types.NamespacedName) interface{} {
return func(done ginkgo.Done) {
defer close(done)

if !ginkgo.CurrentGinkgoTestDescription().Failed {
return func() {
if !ginkgo.CurrentSpecReport().Failed() {
return
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/go-logr/logr"
"github.com/goharbor/harbor-operator/controllers/goharbor/internal/test"
"github.com/goharbor/harbor-operator/controllers/goharbor/internal/test/pods"
"github.com/onsi/ginkgo"
"github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/rest"
Expand Down
2 changes: 1 addition & 1 deletion controllers/goharbor/jobservice/jobservice_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"fmt"
"time"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gstruct"

Expand Down
13 changes: 4 additions & 9 deletions controllers/goharbor/jobservice/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ import (
"context"
"testing"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/goharbor/harbor-operator/controllers/goharbor/internal/test"
"github.com/goharbor/harbor-operator/controllers/goharbor/internal/test/controllers"
"github.com/goharbor/harbor-operator/controllers/goharbor/jobservice"
"sigs.k8s.io/controller-runtime/pkg/envtest/printer"
)

var (
Expand All @@ -21,22 +20,18 @@ var (
func TestAPIs(t *testing.T) {
RegisterFailHandler(Fail)

RunSpecsWithDefaultAndCustomReporters(t,
"Controller Suite",
[]Reporter{printer.NewlineReporter{}})
RunSpecs(t, "Controller Suite")
}

var _ = BeforeSuite(func(done Done) {
var _ = BeforeSuite(func() {
ctx = test.InitSuite()

className := test.NewName("class")

reconciler = controllers.NewJobService(ctx, className)

test.StartManager(ctx)

close(done)
}, 60)
})

var _ = AfterSuite(func() {
defer test.AfterSuite(ctx)
Expand Down
2 changes: 1 addition & 1 deletion controllers/goharbor/notaryserver/notaryserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"time"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

goharborv1 "github.com/goharbor/harbor-operator/apis/goharbor.io/v1beta1"
Expand Down
13 changes: 4 additions & 9 deletions controllers/goharbor/notaryserver/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ import (
"context"
"testing"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/goharbor/harbor-operator/controllers/goharbor/internal/test"
"github.com/goharbor/harbor-operator/controllers/goharbor/internal/test/controllers"
"github.com/goharbor/harbor-operator/controllers/goharbor/notaryserver"
"sigs.k8s.io/controller-runtime/pkg/envtest/printer"
)

var (
Expand All @@ -21,22 +20,18 @@ var (
func TestAPIs(t *testing.T) {
RegisterFailHandler(Fail)

RunSpecsWithDefaultAndCustomReporters(t,
"Controller Suite",
[]Reporter{printer.NewlineReporter{}})
RunSpecs(t, "Controller Suite")
}

var _ = BeforeSuite(func(done Done) {
var _ = BeforeSuite(func() {
ctx = test.InitSuite()

className := test.NewName("class")

reconciler = controllers.NewNotaryServer(ctx, className)

test.StartManager(ctx)

close(done)
}, 60)
})

var _ = AfterSuite(func() {
defer test.AfterSuite(ctx)
Expand Down
2 changes: 1 addition & 1 deletion controllers/goharbor/notarysigner/notarysigner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"fmt"
"time"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

goharborv1 "github.com/goharbor/harbor-operator/apis/goharbor.io/v1beta1"
Expand Down
13 changes: 4 additions & 9 deletions controllers/goharbor/notarysigner/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ import (
"context"
"testing"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/goharbor/harbor-operator/controllers/goharbor/internal/test"
"github.com/goharbor/harbor-operator/controllers/goharbor/internal/test/controllers"
"github.com/goharbor/harbor-operator/controllers/goharbor/notarysigner"
"sigs.k8s.io/controller-runtime/pkg/envtest/printer"
)

var (
Expand All @@ -21,22 +20,18 @@ var (
func TestAPIs(t *testing.T) {
RegisterFailHandler(Fail)

RunSpecsWithDefaultAndCustomReporters(t,
"Controller Suite",
[]Reporter{printer.NewlineReporter{}})
RunSpecs(t, "Controller Suite")
}

var _ = BeforeSuite(func(done Done) {
var _ = BeforeSuite(func() {
ctx = test.InitSuite()

className := test.NewName("class")

reconciler = controllers.NewNotarySigner(ctx, className)

test.StartManager(ctx)

close(done)
}, 60)
})

var _ = AfterSuite(func() {
defer test.AfterSuite(ctx)
Expand Down
2 changes: 1 addition & 1 deletion controllers/goharbor/portal/portal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"time"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

goharborv1 "github.com/goharbor/harbor-operator/apis/goharbor.io/v1beta1"
Expand Down
Loading

0 comments on commit 88c6ca9

Please sign in to comment.