diff --git a/controllers/logging/logging_controller_test.go b/controllers/logging/logging_controller_test.go index f375a528f..4770f40cc 100644 --- a/controllers/logging/logging_controller_test.go +++ b/controllers/logging/logging_controller_test.go @@ -305,8 +305,14 @@ func TestLogginResourcesWithNonUniqueLoggingRefs(t *testing.T) { g.Eventually(getLoggingProblems(logging2)).WithPolling(time.Second).WithTimeout(5 * time.Second).Should(gomega.ContainElement(gomega.ContainSubstring("Deprecated"))) g.Eventually(getLoggingProblems(logging3)).WithPolling(time.Second).WithTimeout(5 * time.Second).Should(gomega.BeEmpty()) - logging1.Spec.ClusterDomain = utils.StringPointer("change something to trigger new reconciliation") - g.Expect(mgr.GetClient().Update(context.TODO(), logging1)).Should(gomega.Succeed()) + g.Eventually(func() error { + l := &v1beta1.Logging{} + if err := mgr.GetClient().Get(context.TODO(), client.ObjectKeyFromObject(logging1), l); err != nil { + return err + } + l.Spec.ErrorOutputRef = "trigger reconcile" + return mgr.GetClient().Update(context.TODO(), l) + }).WithPolling(time.Second).WithTimeout(5 * time.Second).Should(gomega.Succeed()) g.Eventually(getLoggingProblems(logging1)).WithPolling(time.Second).WithTimeout(5 * time.Second).Should(gomega.ContainElement(gomega.ContainSubstring("Deprecated"))) } diff --git a/pkg/resources/model/reconciler.go b/pkg/resources/model/reconciler.go index 357475c1b..4596c9649 100644 --- a/pkg/resources/model/reconciler.go +++ b/pkg/resources/model/reconciler.go @@ -206,7 +206,7 @@ func NewValidationReconciler( resources.Logging.Status.Problems = nil loggingsForTheSameRef := make([]string, 0) - for _, l := range resources.AllLoggings.Items { + for _, l := range resources.AllLoggings { if l.Name == resources.Logging.Name { continue } diff --git a/pkg/resources/model/repository.go b/pkg/resources/model/repository.go index fc8af8e30..d1a204001 100644 --- a/pkg/resources/model/repository.go +++ b/pkg/resources/model/repository.go @@ -45,10 +45,11 @@ func (r LoggingResourceRepository) LoggingResourcesFor(ctx context.Context, logg var err error - res.AllLoggings = v1beta1.LoggingList{} - if err := r.Client.List(ctx, &res.AllLoggings); err != nil { + allLoggings := &v1beta1.LoggingList{} + if err := r.Client.List(ctx, allLoggings); err != nil { errs = errors.Append(errs, err) } + res.AllLoggings = allLoggings.Items res.Fluentd.ClusterFlows, err = r.ClusterFlowsFor(ctx, logging) errs = errors.Append(errs, err) diff --git a/pkg/resources/model/resources.go b/pkg/resources/model/resources.go index cc2be6a92..a23bb6913 100644 --- a/pkg/resources/model/resources.go +++ b/pkg/resources/model/resources.go @@ -19,7 +19,7 @@ import ( ) type LoggingResources struct { - AllLoggings v1beta1.LoggingList + AllLoggings []v1beta1.Logging Logging v1beta1.Logging Fluentd FluentdLoggingResources SyslogNG SyslogNGLoggingResources