This repository was archived by the owner on Jul 30, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -192,6 +192,34 @@ func TestKubeadmConfigReconciler_Reconcile_ReturnEarlyIfMachineHasBootstrapData(
192192 }
193193}
194194
195+ // Return early If the owning machine does not have an associated cluster
196+ func TestKubeadmConfigReconciler_Reconcile_ReturnEarlyIfMachineHasNoCluster (t * testing.T ) {
197+ machine := newMachine (nil , "machine" ) // Machine without a cluster
198+ config := newKubeadmConfig (machine , "cfg" )
199+
200+ objects := []runtime.Object {
201+ machine ,
202+ config ,
203+ }
204+ myclient := fake .NewFakeClientWithScheme (setupScheme (), objects ... )
205+
206+ k := & KubeadmConfigReconciler {
207+ Log : log .Log ,
208+ Client : myclient ,
209+ }
210+
211+ request := ctrl.Request {
212+ NamespacedName : types.NamespacedName {
213+ Namespace : "default" ,
214+ Name : "cfg" ,
215+ },
216+ }
217+ _ , err := k .Reconcile (request )
218+ if err != nil {
219+ t .Fatalf ("Not Expecting error, got an error: %+v" , err )
220+ }
221+ }
222+
195223// This does not expect an error, hoping the machine gets updated with a cluster
196224func TestKubeadmConfigReconciler_Reconcile_ReturnNilIfMachineDoesNotHaveAssociatedCluster (t * testing.T ) {
197225 machine := newMachine (nil , "machine" ) // intentionally omitting cluster
You can’t perform that action at this time.
0 commit comments