@@ -1917,6 +1917,60 @@ func TestReconciler(t *testing.T) {
1917
1917
},
1918
1918
want : want {result : reconcile.Result {RequeueAfter : defaultPollInterval }},
1919
1919
},
1920
+ "ObserveAndLateInitializePolicy" : {
1921
+ reason : "If management policy is set to Observe and LateInitialize, reconciliation should proceed" ,
1922
+ args : args {
1923
+ m : & fake.Manager {
1924
+ Client : & test.MockClient {
1925
+ MockGet : test .NewMockGetFn (nil , func (obj client.Object ) error {
1926
+ mg := obj .(* fake.Managed )
1927
+ mg .SetManagementPolicies (xpv1.ManagementPolicies {xpv1 .ManagementActionObserve , xpv1 .ManagementActionLateInitialize })
1928
+ return nil
1929
+ }),
1930
+ MockUpdate : test .NewMockUpdateFn (nil ),
1931
+ MockStatusUpdate : test .MockSubResourceUpdateFn (func (_ context.Context , _ client.Object , _ ... client.SubResourceUpdateOption ) error {
1932
+ return nil
1933
+ }),
1934
+ },
1935
+ Scheme : fake .SchemeWith (& fake.Managed {}),
1936
+ },
1937
+ mg : resource .ManagedKind (fake .GVK (& fake.Managed {})),
1938
+ o : []ReconcilerOption {
1939
+ WithManagementPolicies (),
1940
+ WithReconcilerSupportedManagementPolicies (defaultSupportedManagementPolicies ()),
1941
+ },
1942
+ },
1943
+ want : want {result : reconcile.Result {RequeueAfter : defaultPollInterval }},
1944
+ },
1945
+ "ObserveUpdateAndLateInitializePolicy" : {
1946
+ reason : "If management policy is set to Observe, Update and LateInitialize, reconciliation should proceed" ,
1947
+ args : args {
1948
+ m : & fake.Manager {
1949
+ Client : & test.MockClient {
1950
+ MockGet : test .NewMockGetFn (nil , func (obj client.Object ) error {
1951
+ mg := obj .(* fake.Managed )
1952
+ mg .SetManagementPolicies (xpv1.ManagementPolicies {
1953
+ xpv1 .ManagementActionObserve ,
1954
+ xpv1 .ManagementActionUpdate ,
1955
+ xpv1 .ManagementActionLateInitialize ,
1956
+ })
1957
+ return nil
1958
+ }),
1959
+ MockUpdate : test .NewMockUpdateFn (nil ),
1960
+ MockStatusUpdate : test .MockSubResourceUpdateFn (func (_ context.Context , _ client.Object , _ ... client.SubResourceUpdateOption ) error {
1961
+ return nil
1962
+ }),
1963
+ },
1964
+ Scheme : fake .SchemeWith (& fake.Managed {}),
1965
+ },
1966
+ mg : resource .ManagedKind (fake .GVK (& fake.Managed {})),
1967
+ o : []ReconcilerOption {
1968
+ WithManagementPolicies (),
1969
+ WithReconcilerSupportedManagementPolicies (defaultSupportedManagementPolicies ()),
1970
+ },
1971
+ },
1972
+ want : want {result : reconcile.Result {RequeueAfter : defaultPollInterval }},
1973
+ },
1920
1974
}
1921
1975
1922
1976
for name , tc := range cases {
0 commit comments