@@ -1977,6 +1977,20 @@ func TestZoneReconcilerRecordsRoute53RecordSetEventsOnRecordSets(t *testing.T) {
19771977 if pending == nil || pending .ID == "" {
19781978 t .Fatalf ("pendingRecordSetChange = %#v, want pending record set change" , pending )
19791979 }
1980+ var unit dnsv1alpha1.ZoneUnit
1981+ if err := k8sClient .Get (ctx , client.ObjectKey {Namespace : zone .Namespace , Name : zone .Name }, & unit ); err != nil {
1982+ t .Fatalf ("ZoneUnit was not found: %v" , err )
1983+ }
1984+ statusIndex := slices .IndexFunc (unit .Status .RecordSets , func (status dnsv1alpha1.ZoneUnitRecordSetStatus ) bool {
1985+ return status .RecordSetNamespace == recordSet .Namespace && status .RecordSetName == recordSet .Name
1986+ })
1987+ if statusIndex < 0 {
1988+ t .Fatalf ("ZoneUnit status.recordSets has no entry for %s/%s: %#v" , recordSet .Namespace , recordSet .Name , unit .Status .RecordSets )
1989+ }
1990+ unit .Status .RecordSets [statusIndex ].Provider = nil
1991+ if err := k8sClient .Status ().Update (ctx , & unit ); err != nil {
1992+ t .Fatalf ("clear RecordSet provider status fixture: %v" , err )
1993+ }
19801994 provider .changes [pending .ID ].Status = route53v1alpha1 .Route53ChangeStatusInSync
19811995
19821996 if _ , err := reconcileRoute53AndProject (t , ctx , k8sClient , reconciler , ctrl.Request {NamespacedName : types.NamespacedName {Namespace : "app" , Name : "apps-example-com" }}); err != nil {
@@ -1988,6 +2002,21 @@ func TestZoneReconcilerRecordsRoute53RecordSetEventsOnRecordSets(t *testing.T) {
19882002 if recorder .has ("Zone" , "Route53RecordSetChangeInSync" ) {
19892003 t .Fatalf ("Route53RecordSetChangeInSync was recorded on a Zone: %#v" , recorder .events )
19902004 }
2005+ statusData := mustZoneUnitRecordSetStatusState (t , ctx , k8sClient , zone .Namespace , zone .Name , recordSet .Namespace , recordSet .Name )
2006+ if statusData .HostedZoneID != "Z000001" || statusData .RecordName != "www.apps.example.com." || statusData .RecordType != string (dnsv1alpha1 .RecordTypeA ) {
2007+ t .Fatalf ("ZoneUnit recordSet provider state = %#v, want Route 53 record identity after INSYNC" , statusData )
2008+ }
2009+ var gotUnit dnsv1alpha1.ZoneUnit
2010+ if err := k8sClient .Get (ctx , client.ObjectKey {Namespace : zone .Namespace , Name : zone .Name }, & gotUnit ); err != nil {
2011+ t .Fatalf ("ZoneUnit was not found after INSYNC: %v" , err )
2012+ }
2013+ statusIndex = slices .IndexFunc (gotUnit .Status .RecordSets , func (status dnsv1alpha1.ZoneUnitRecordSetStatus ) bool {
2014+ return status .RecordSetNamespace == recordSet .Namespace && status .RecordSetName == recordSet .Name
2015+ })
2016+ if statusIndex < 0 {
2017+ t .Fatalf ("ZoneUnit status.recordSets has no entry after INSYNC for %s/%s: %#v" , recordSet .Namespace , recordSet .Name , gotUnit .Status .RecordSets )
2018+ }
2019+ assertCondition (t , gotUnit .Status .RecordSets [statusIndex ].Conditions , string (dnsv1alpha1 .ConditionProgrammed ), metav1 .ConditionTrue , "Programmed" )
19912020}
19922021
19932022func TestZoneReconcilerDeletesRecordSetFromSpecIdentity (t * testing.T ) {
0 commit comments