@@ -572,6 +572,12 @@ func TestRecordConditionEvents(t *testing.T) {
572572 Reason : "KubernetesResourcesScanningAvailable" ,
573573 Message : "Kubernetes Resources Scanning is available" ,
574574 },
575+ {
576+ Type : v1alpha2 .NodeScanningDegraded ,
577+ Status : corev1 .ConditionTrue ,
578+ Reason : "NodeScanningUnavailable" ,
579+ Message : "Node Scanning is unavailable" ,
580+ },
575581 }
576582 newConditions := []v1alpha2.MondooAuditConfigCondition {
577583 {
@@ -595,6 +601,25 @@ func TestRecordConditionEvents(t *testing.T) {
595601 assertNoRecordedEvent (t , recorder )
596602}
597603
604+ func TestRecordConditionEventsSkipsInitialHealthyConditions (t * testing.T ) {
605+ config := testMondooAuditConfig ()
606+ recorder := record .NewFakeRecorder (1 )
607+ reconciler := & MondooAuditConfigReconciler {EventRecorder : recorder }
608+
609+ newConditions := []v1alpha2.MondooAuditConfigCondition {
610+ {
611+ Type : v1alpha2 .K8sContainerImageScanningDegraded ,
612+ Status : corev1 .ConditionFalse ,
613+ Reason : "KubernetesContainerImageScanningAvailable" ,
614+ Message : "Kubernetes Container Image Scanning is available" ,
615+ },
616+ }
617+
618+ reconciler .recordConditionEvents (config , nil , newConditions )
619+
620+ assertNoRecordedEvent (t , recorder )
621+ }
622+
598623func TestRecordConditionEventsSkipsUnchangedConditions (t * testing.T ) {
599624 config := testMondooAuditConfig ()
600625 recorder := record .NewFakeRecorder (1 )
0 commit comments