@@ -88,15 +88,16 @@ var _ = Describe("NodeModulesConfigReconciler_Reconcile", func() {
8888 nmc := & kmmv1beta1.NodeModulesConfig {
8989 ObjectMeta : metav1.ObjectMeta {Name : nmcName },
9090 }
91-
91+ node := v1. Node {}
9292 gomock .InOrder (
9393 kubeClient .
9494 EXPECT ().
9595 Get (ctx , nmcNsn , & kmmv1beta1.NodeModulesConfig {}).
9696 Do (func (_ context.Context , _ types.NamespacedName , kubeNmc ctrlclient.Object , _ ... ctrlclient.Options ) {
9797 * kubeNmc .(* kmmv1beta1.NodeModulesConfig ) = * nmc
9898 }),
99- wh .EXPECT ().SyncStatus (ctx , nmc ).Return (errors .New ("random error" )),
99+ kubeClient .EXPECT ().Get (ctx , types.NamespacedName {Name : nmc .Name }, & node ).Return (nil ),
100+ wh .EXPECT ().SyncStatus (ctx , nmc , & node ).Return (errors .New ("random error" )),
100101 )
101102
102103 _ , err := r .Reconcile (ctx , req )
@@ -115,7 +116,6 @@ var _ = Describe("NodeModulesConfigReconciler_Reconcile", func() {
115116 Do (func (_ context.Context , _ types.NamespacedName , kubeNmc ctrlclient.Object , _ ... ctrlclient.Options ) {
116117 * kubeNmc .(* kmmv1beta1.NodeModulesConfig ) = * nmc
117118 }),
118- wh .EXPECT ().SyncStatus (ctx , nmc ),
119119 kubeClient .EXPECT ().Get (ctx , types.NamespacedName {Name : nmc .Name }, & node ).Return (fmt .Errorf ("some error" )),
120120 )
121121
@@ -158,13 +158,13 @@ var _ = Describe("NodeModulesConfigReconciler_Reconcile", func() {
158158 Do (func (_ context.Context , _ types.NamespacedName , kubeNmc ctrlclient.Object , _ ... ctrlclient.Options ) {
159159 * kubeNmc .(* kmmv1beta1.NodeModulesConfig ) = * nmc
160160 }),
161- wh .EXPECT ().SyncStatus (ctx , nmc ),
162161 kubeClient .EXPECT ().Get (ctx , types.NamespacedName {Name : nmc .Name }, & v1.Node {}).DoAndReturn (
163162 func (_ context.Context , _ types.NamespacedName , fetchedNode * v1.Node , _ ... ctrlclient.Options ) error {
164163 * fetchedNode = node
165164 return nil
166165 },
167166 ),
167+ wh .EXPECT ().SyncStatus (ctx , nmc , & node ),
168168 nm .EXPECT ().IsNodeSchedulable (& node , nil ).Return (false ),
169169 nm .EXPECT ().UpdateLabels (ctx , & node , nil , []string {kmodName }).DoAndReturn (
170170 func (_ context.Context , obj ctrlclient.Object , _ , _ []string ) error {
@@ -214,13 +214,13 @@ var _ = Describe("NodeModulesConfigReconciler_Reconcile", func() {
214214 Do (func (_ context.Context , _ types.NamespacedName , kubeNmc ctrlclient.Object , _ ... ctrlclient.Options ) {
215215 * kubeNmc .(* kmmv1beta1.NodeModulesConfig ) = * nmc
216216 }),
217- wh .EXPECT ().SyncStatus (ctx , nmc ),
218217 kubeClient .EXPECT ().Get (ctx , types.NamespacedName {Name : nmc .Name }, & v1.Node {}).DoAndReturn (
219218 func (_ context.Context , _ types.NamespacedName , fetchedNode * v1.Node , _ ... ctrlclient.Options ) error {
220219 * fetchedNode = node
221220 return nil
222221 },
223222 ),
223+ wh .EXPECT ().SyncStatus (ctx , nmc , & node ),
224224 nm .EXPECT ().IsNodeSchedulable (& node , nil ).Return (false ),
225225 nm .EXPECT ().UpdateLabels (ctx , & node , nil , []string {kmodName }).DoAndReturn (
226226 func (_ context.Context , obj ctrlclient.Object , _ , _ []string ) error {
@@ -295,8 +295,8 @@ var _ = Describe("NodeModulesConfigReconciler_Reconcile", func() {
295295 Do (func (_ context.Context , _ types.NamespacedName , kubeNmc ctrlclient.Object , _ ... ctrlclient.Options ) {
296296 * kubeNmc .(* kmmv1beta1.NodeModulesConfig ) = * nmc
297297 }),
298- wh .EXPECT ().SyncStatus (ctx , nmc ),
299298 kubeClient .EXPECT ().Get (ctx , types.NamespacedName {Name : nmc .Name }, & node ).Return (nil ),
299+ wh .EXPECT ().SyncStatus (ctx , nmc , & node ),
300300 nm .EXPECT ().IsNodeSchedulable (& node , nil ).Return (true ),
301301 wh .EXPECT ().ProcessModuleSpec (contextWithValueMatch , nmc , & spec0 , & status0 , & node ),
302302 nm .EXPECT ().IsNodeSchedulable (& node , nil ).Return (true ),
@@ -377,8 +377,8 @@ var _ = Describe("NodeModulesConfigReconciler_Reconcile", func() {
377377 Do (func (_ context.Context , _ types.NamespacedName , kubeNmc ctrlclient.Object , _ ... ctrlclient.Options ) {
378378 * kubeNmc .(* kmmv1beta1.NodeModulesConfig ) = * nmc
379379 }),
380- wh .EXPECT ().SyncStatus (ctx , nmc ).Return (nil ),
381380 kubeClient .EXPECT ().Get (ctx , types.NamespacedName {Name : nmc .Name }, & node ).Return (nil ),
381+ wh .EXPECT ().SyncStatus (ctx , nmc , & node ).Return (nil ),
382382 nm .EXPECT ().IsNodeSchedulable (& node , nil ).Return (true ),
383383 wh .EXPECT ().ProcessModuleSpec (contextWithValueMatch , nmc , & spec0 , & status0 , & node ).Return (errors .New (errorMeassge )),
384384 wh .EXPECT ().ProcessUnconfiguredModuleStatus (contextWithValueMatch , nmc , & status2 , & node ).Return (errors .New (errorMeassge )),
@@ -751,7 +751,7 @@ var _ = Describe("nmcReconcilerHelperImpl_ProcessModuleSpec", func() {
751751
752752 gomock .InOrder (
753753 mockWorkerPodManager .EXPECT ().GetWorkerPod (ctx , podName , namespace ),
754- nm .EXPECT ().NodeBecomeReadyAfter (node , status .LastTransitionTime ).Return (returnValue ),
754+ nm .EXPECT ().IsNodeRebooted (node , status .BootId ).Return (returnValue ),
755755 )
756756
757757 if shouldCreate {
@@ -890,7 +890,7 @@ var _ = Describe("nmcReconcilerHelperImpl_ProcessUnconfiguredModuleStatus", func
890890
891891 It ("should do nothing , if the node has been rebooted/ready lately" , func () {
892892 gomock .InOrder (
893- nm .EXPECT ().NodeBecomeReadyAfter (& node , status .LastTransitionTime ).Return (true ),
893+ nm .EXPECT ().IsNodeRebooted (& node , status .BootId ).Return (true ),
894894 client .EXPECT ().Status ().Return (sw ),
895895 sw .EXPECT ().Patch (ctx , nmc , gomock .Any ()),
896896 )
@@ -904,7 +904,7 @@ var _ = Describe("nmcReconcilerHelperImpl_ProcessUnconfiguredModuleStatus", func
904904
905905 It ("should create an unloader Pod if no worker Pod exists" , func () {
906906 gomock .InOrder (
907- nm .EXPECT ().NodeBecomeReadyAfter (& node , status .LastTransitionTime ).Return (false ),
907+ nm .EXPECT ().IsNodeRebooted (& node , status .BootId ).Return (false ),
908908 mockWorkerPodManager .EXPECT ().GetWorkerPod (ctx , podName , namespace ),
909909 mockWorkerPodManager .EXPECT ().CreateUnloaderPod (ctx , nmc , status ),
910910 )
@@ -925,7 +925,7 @@ var _ = Describe("nmcReconcilerHelperImpl_ProcessUnconfiguredModuleStatus", func
925925 }
926926
927927 gomock .InOrder (
928- nm .EXPECT ().NodeBecomeReadyAfter (& node , status .LastTransitionTime ).Return (false ),
928+ nm .EXPECT ().IsNodeRebooted (& node , status .BootId ).Return (false ),
929929 mockWorkerPodManager .EXPECT ().GetWorkerPod (ctx , podName , namespace ).Return (& pod , nil ),
930930 mockWorkerPodManager .EXPECT ().IsLoaderPod (& pod ).Return (true ),
931931 mockWorkerPodManager .EXPECT ().DeletePod (ctx , & pod ),
@@ -947,7 +947,7 @@ var _ = Describe("nmcReconcilerHelperImpl_ProcessUnconfiguredModuleStatus", func
947947 }
948948
949949 gomock .InOrder (
950- nm .EXPECT ().NodeBecomeReadyAfter (& node , status .LastTransitionTime ).Return (false ),
950+ nm .EXPECT ().IsNodeRebooted (& node , status .BootId ).Return (false ),
951951 mockWorkerPodManager .EXPECT ().GetWorkerPod (ctx , podName , namespace ).Return (& pod , nil ),
952952 mockWorkerPodManager .EXPECT ().IsLoaderPod (& pod ).Return (false ),
953953 )
@@ -976,7 +976,7 @@ var _ = Describe("nmcReconcilerHelperImpl_ProcessUnconfiguredModuleStatus", func
976976 }
977977
978978 gomock .InOrder (
979- nm .EXPECT ().NodeBecomeReadyAfter (& node , status .LastTransitionTime ).Return (false ),
979+ nm .EXPECT ().IsNodeRebooted (& node , status .BootId ).Return (false ),
980980 mockWorkerPodManager .EXPECT ().GetWorkerPod (ctx , podName , namespace ).Return (& pod , nil ),
981981 mockWorkerPodManager .EXPECT ().IsLoaderPod (& pod ).Return (false ),
982982 mockWorkerPodManager .EXPECT ().UnloaderPodTemplate (ctx , nmc , status ).Return (nil , errors .New ("random error" )),
@@ -1008,7 +1008,7 @@ var _ = Describe("nmcReconcilerHelperImpl_ProcessUnconfiguredModuleStatus", func
10081008 podTemplate := p .DeepCopy ()
10091009
10101010 gomock .InOrder (
1011- nm .EXPECT ().NodeBecomeReadyAfter (& node , status .LastTransitionTime ).Return (false ),
1011+ nm .EXPECT ().IsNodeRebooted (& node , status .BootId ).Return (false ),
10121012 mockWorkerPodManager .EXPECT ().GetWorkerPod (ctx , podName , namespace ).Return (& p , nil ),
10131013 mockWorkerPodManager .EXPECT ().IsLoaderPod (& p ).Return (false ),
10141014 mockWorkerPodManager .EXPECT ().UnloaderPodTemplate (ctx , nmc , status ).Return (podTemplate , nil ),
@@ -1055,9 +1055,9 @@ var _ = Describe("nmcReconcilerHelperImpl_SyncStatus", func() {
10551055 nmc := & kmmv1beta1.NodeModulesConfig {
10561056 ObjectMeta : metav1.ObjectMeta {Name : nmcName },
10571057 }
1058-
1058+ node := v1. Node {}
10591059 Expect (
1060- wh .SyncStatus (ctx , nmc ),
1060+ wh .SyncStatus (ctx , nmc , & node ),
10611061 ).NotTo (
10621062 HaveOccurred (),
10631063 )
@@ -1110,9 +1110,9 @@ var _ = Describe("nmcReconcilerHelperImpl_SyncStatus", func() {
11101110 mockWorkerPodManager .EXPECT ().DeletePod (ctx , & podWithStatus ),
11111111 mockWorkerPodManager .EXPECT ().DeletePod (ctx , & podWithoutStatus ),
11121112 )
1113-
1113+ node := v1. Node {}
11141114 Expect (
1115- wh .SyncStatus (ctx , nmc ),
1115+ wh .SyncStatus (ctx , nmc , & node ),
11161116 ).NotTo (
11171117 HaveOccurred (),
11181118 )
@@ -1157,9 +1157,9 @@ var _ = Describe("nmcReconcilerHelperImpl_SyncStatus", func() {
11571157 sw .EXPECT ().Patch (ctx , nmc , gomock .Any ()),
11581158 mockWorkerPodManager .EXPECT ().DeletePod (ctx , & pod ),
11591159 )
1160-
1160+ node := v1. Node {}
11611161 Expect (
1162- wh .SyncStatus (ctx , nmc ),
1162+ wh .SyncStatus (ctx , nmc , & node ),
11631163 ).NotTo (
11641164 HaveOccurred (),
11651165 )
@@ -1241,9 +1241,9 @@ var _ = Describe("nmcReconcilerHelperImpl_SyncStatus", func() {
12411241 sw .EXPECT ().Patch (ctx , nmc , gomock .Any ()),
12421242 mockWorkerPodManager .EXPECT ().DeletePod (ctx , & p ),
12431243 )
1244-
1244+ node := v1. Node {}
12451245 Expect (
1246- wh .SyncStatus (ctx , nmc ),
1246+ wh .SyncStatus (ctx , nmc , & node ),
12471247 ).NotTo (
12481248 HaveOccurred (),
12491249 )
@@ -1301,9 +1301,9 @@ var _ = Describe("nmcReconcilerHelperImpl_SyncStatus", func() {
13011301 kubeClient .EXPECT ().Status ().Return (sw ),
13021302 sw .EXPECT ().Patch (ctx , nmc , gomock .Any ()).Return (errors .New ("some error" )),
13031303 )
1304-
1304+ node := v1. Node {}
13051305 Expect (
1306- wh .SyncStatus (ctx , nmc ),
1306+ wh .SyncStatus (ctx , nmc , & node ),
13071307 ).To (
13081308 HaveOccurred (),
13091309 )
0 commit comments