@@ -186,9 +186,11 @@ func (pfct preflightCheckTest) Check() (warning, errorList []error) {
186
186
187
187
func TestRunInitNodeChecks (t * testing.T ) {
188
188
var tests = []struct {
189
- name string
190
- cfg * kubeadmapi.InitConfiguration
191
- expected bool
189
+ name string
190
+ cfg * kubeadmapi.InitConfiguration
191
+ expected bool
192
+ isSecondaryControlPlane bool
193
+ downloadCerts bool
192
194
}{
193
195
{name : "Test valid advertised address" ,
194
196
cfg : & kubeadmapi.InitConfiguration {
@@ -197,7 +199,7 @@ func TestRunInitNodeChecks(t *testing.T) {
197
199
expected : false ,
198
200
},
199
201
{
200
- name : "Test CA file exists if specfied " ,
202
+ name : "Test CA file exists if specified " ,
201
203
cfg : & kubeadmapi.InitConfiguration {
202
204
ClusterConfiguration : kubeadmapi.ClusterConfiguration {
203
205
Etcd : kubeadmapi.Etcd {External : & kubeadmapi.ExternalEtcd {CAFile : "/foo" }},
@@ -206,7 +208,18 @@ func TestRunInitNodeChecks(t *testing.T) {
206
208
expected : false ,
207
209
},
208
210
{
209
- name : "Test Cert file exists if specfied" ,
211
+ name : "Skip test CA file exists if specified/download certs" ,
212
+ cfg : & kubeadmapi.InitConfiguration {
213
+ ClusterConfiguration : kubeadmapi.ClusterConfiguration {
214
+ Etcd : kubeadmapi.Etcd {External : & kubeadmapi.ExternalEtcd {CAFile : "/foo" }},
215
+ },
216
+ },
217
+ expected : true ,
218
+ isSecondaryControlPlane : true ,
219
+ downloadCerts : true ,
220
+ },
221
+ {
222
+ name : "Test Cert file exists if specified" ,
210
223
cfg : & kubeadmapi.InitConfiguration {
211
224
ClusterConfiguration : kubeadmapi.ClusterConfiguration {
212
225
Etcd : kubeadmapi.Etcd {External : & kubeadmapi.ExternalEtcd {CertFile : "/foo" }},
@@ -215,7 +228,7 @@ func TestRunInitNodeChecks(t *testing.T) {
215
228
expected : false ,
216
229
},
217
230
{
218
- name : "Test Key file exists if specfied " ,
231
+ name : "Test Key file exists if specified " ,
219
232
cfg : & kubeadmapi.InitConfiguration {
220
233
ClusterConfiguration : kubeadmapi.ClusterConfiguration {
221
234
Etcd : kubeadmapi.Etcd {External : & kubeadmapi.ExternalEtcd {CertFile : "/foo" }},
@@ -232,7 +245,7 @@ func TestRunInitNodeChecks(t *testing.T) {
232
245
}
233
246
for _ , rt := range tests {
234
247
// TODO: Make RunInitNodeChecks accept a ClusterConfiguration object instead of InitConfiguration
235
- actual := RunInitNodeChecks (exec .New (), rt .cfg , sets .NewString (), false )
248
+ actual := RunInitNodeChecks (exec .New (), rt .cfg , sets .NewString (), rt . isSecondaryControlPlane , rt . downloadCerts )
236
249
if (actual == nil ) != rt .expected {
237
250
t .Errorf (
238
251
"failed RunInitNodeChecks:\n \t expected: %t\n \t actual: %t\n \t error: %v" ,
0 commit comments