Skip to content

Commit

Permalink
Adapt integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyas-s-rao committed Jan 7, 2024
1 parent e6c7f13 commit ab0d6e3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion controllers/compaction/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func (r *Reconciler) reconcileJob(ctx context.Context, logger logr.Logger, etcd
job := &batchv1.Job{}
if err := r.Get(ctx, types.NamespacedName{Name: etcd.GetCompactionJobName(), Namespace: etcd.Namespace}, job); err != nil {
if errors.IsNotFound(err) {
logger.Info("Currently, no compaction job is running in the namespace ", etcd.Namespace)
logger.Info("Currently, no compaction job is running in the namespace", "namespace", etcd.Namespace)
} else {
// Error reading the object - requeue the request.
return ctrl.Result{
Expand Down
13 changes: 11 additions & 2 deletions test/integration/setup/testenv.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ import (
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"
"sigs.k8s.io/controller-runtime/pkg/manager"
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
Expand All @@ -56,6 +58,7 @@ type AddToManager func(mgr manager.Manager)
func NewIntegrationTestEnv(namespacePrefix string, loggerName string, crdDirectoryPaths []string) *IntegrationTestEnv {
testEnv := &IntegrationTestEnv{ctx: context.Background()}
testEnv.Logger = ctrl.Log.WithName(loggerName)
ctrl.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true)))

druidScheme := prepareScheme()
testEnv.createTestEnvironment(druidScheme, crdDirectoryPaths)
Expand Down Expand Up @@ -132,8 +135,14 @@ func (e *IntegrationTestEnv) createManager() error {
}

mgr, err := manager.New(e.RestConfig, manager.Options{
MetricsBindAddress: "0",
ClientDisableCacheFor: uncachedObjects,
Metrics: metricsserver.Options{
BindAddress: "0",
},
Client: client.Options{
Cache: &client.CacheOptions{
DisableFor: uncachedObjects,
},
},
})
if err != nil {
return err
Expand Down

0 comments on commit ab0d6e3

Please sign in to comment.