@@ -24,12 +24,21 @@ func TestInitStorageContainerChecks(t *testing.T) {
24
24
nutanixClusterConfigSpec * carenv1.NutanixClusterConfigSpec
25
25
workerNodeConfigSpecByMDName map [string ]* carenv1.NutanixWorkerNodeConfigSpec
26
26
expectedChecksCount int
27
+ nclient client
27
28
}{
29
+ {
30
+ name : "client not initialized" ,
31
+ nutanixClusterConfigSpec : nil ,
32
+ workerNodeConfigSpecByMDName : nil ,
33
+ expectedChecksCount : 0 ,
34
+ nclient : nil ,
35
+ },
28
36
{
29
37
name : "nil cluster config" ,
30
38
nutanixClusterConfigSpec : nil ,
31
39
workerNodeConfigSpecByMDName : map [string ]* carenv1.NutanixWorkerNodeConfigSpec {},
32
40
expectedChecksCount : 0 ,
41
+ nclient : & mocknclient {},
33
42
},
34
43
{
35
44
name : "cluster config without addons" ,
@@ -40,6 +49,7 @@ func TestInitStorageContainerChecks(t *testing.T) {
40
49
},
41
50
workerNodeConfigSpecByMDName : map [string ]* carenv1.NutanixWorkerNodeConfigSpec {},
42
51
expectedChecksCount : 0 ,
52
+ nclient : & mocknclient {},
43
53
},
44
54
{
45
55
name : "cluster config with addons but no CSI" ,
@@ -51,6 +61,7 @@ func TestInitStorageContainerChecks(t *testing.T) {
51
61
},
52
62
workerNodeConfigSpecByMDName : map [string ]* carenv1.NutanixWorkerNodeConfigSpec {},
53
63
expectedChecksCount : 0 ,
64
+ nclient : & mocknclient {},
54
65
},
55
66
{
56
67
name : "cluster config with CSI but no control plane or worker nodes" ,
@@ -65,6 +76,7 @@ func TestInitStorageContainerChecks(t *testing.T) {
65
76
},
66
77
workerNodeConfigSpecByMDName : map [string ]* carenv1.NutanixWorkerNodeConfigSpec {},
67
78
expectedChecksCount : 0 ,
79
+ nclient : & mocknclient {},
68
80
},
69
81
{
70
82
name : "cluster config with CSI and control plane" ,
@@ -97,6 +109,7 @@ func TestInitStorageContainerChecks(t *testing.T) {
97
109
},
98
110
workerNodeConfigSpecByMDName : map [string ]* carenv1.NutanixWorkerNodeConfigSpec {},
99
111
expectedChecksCount : 1 ,
112
+ nclient : & mocknclient {},
100
113
},
101
114
{
102
115
name : "cluster config with CSI and worker nodes" ,
@@ -122,6 +135,7 @@ func TestInitStorageContainerChecks(t *testing.T) {
122
135
},
123
136
},
124
137
expectedChecksCount : 1 ,
138
+ nclient : & mocknclient {},
125
139
},
126
140
{
127
141
name : "cluster config with CSI, control plane and worker nodes" ,
@@ -167,6 +181,7 @@ func TestInitStorageContainerChecks(t *testing.T) {
167
181
},
168
182
},
169
183
expectedChecksCount : 3 , // 1 for control plane, 2 for workers
184
+ nclient : & mocknclient {},
170
185
},
171
186
{
172
187
name : "cluster config with CSI and null control plane nutanix" ,
@@ -184,6 +199,7 @@ func TestInitStorageContainerChecks(t *testing.T) {
184
199
},
185
200
workerNodeConfigSpecByMDName : map [string ]* carenv1.NutanixWorkerNodeConfigSpec {},
186
201
expectedChecksCount : 0 ,
202
+ nclient : & mocknclient {},
187
203
},
188
204
{
189
205
name : "cluster config with CSI and some nutanix nil workers" ,
@@ -212,6 +228,7 @@ func TestInitStorageContainerChecks(t *testing.T) {
212
228
},
213
229
},
214
230
expectedChecksCount : 1 , // only for the defined worker-1
231
+ nclient : & mocknclient {},
215
232
},
216
233
}
217
234
@@ -220,6 +237,7 @@ func TestInitStorageContainerChecks(t *testing.T) {
220
237
cd := & checkDependencies {
221
238
nutanixClusterConfigSpec : tc .nutanixClusterConfigSpec ,
222
239
nutanixWorkerNodeConfigSpecByMachineDeploymentName : tc .workerNodeConfigSpecByMDName ,
240
+ nclient : tc .nclient ,
223
241
}
224
242
225
243
// Call the function under test
0 commit comments