Skip to content

Commit

Permalink
integration tests: little improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
eguzki committed Sep 8, 2023
1 parent 1cfcfa9 commit c2ef3ee
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions controllers/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,23 @@ limitations under the License.
package controllers

import (
"os"
"path/filepath"
"testing"
"time"

limitadorv1alpha1 "github.com/kuadrant/limitador-operator/api/v1alpha1"
"github.com/kuadrant/limitador-operator/pkg/log"
"github.com/kuadrant/limitador-operator/pkg/reconcilers"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec"
"k8s.io/client-go/kubernetes/scheme"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/envtest"
"sigs.k8s.io/controller-runtime/pkg/log/zap"

limitadorv1alpha1 "github.com/kuadrant/limitador-operator/api/v1alpha1"
"github.com/kuadrant/limitador-operator/pkg/log"
"github.com/kuadrant/limitador-operator/pkg/reconcilers"
//+kubebuilder:scaffold:imports
)

Expand All @@ -47,13 +50,6 @@ func TestAPIs(t *testing.T) {
}

var _ = BeforeSuite(func() {
logger := log.NewLogger(
log.SetLevel(log.DebugLevel),
log.SetMode(log.ModeDev),
log.WriteTo(GinkgoWriter),
).WithName("controller_test")
log.SetLogger(logger)

By("bootstrapping test environment")
testEnv = &envtest.Environment{
CRDDirectoryPaths: []string{filepath.Join("..", "config", "crd", "bases")},
Expand Down Expand Up @@ -107,3 +103,16 @@ var _ = BeforeSuite(func() {
var _ = AfterSuite(func() {
By("tearing down the test environment")
})

func TestMain(m *testing.M) {
logger := log.NewLogger(
log.SetLevel(log.DebugLevel),
log.SetMode(log.ModeDev),
log.WriteTo(GinkgoWriter),
).WithName("controller_test")
log.SetLogger(logger)

logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true)))

Check failure on line 115 in controllers/suite_test.go

View workflow job for this annotation

GitHub Actions / Lint

undefined: logf (typecheck)

os.Exit(m.Run())
}

0 comments on commit c2ef3ee

Please sign in to comment.