mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
kubeadm: fix the nil pointer dereference in testcase
`genCSRConfig.kubeadmConfig` is possible to be nil if there any error from the config loading, so access the field should only be done if there is no error in the previous step. Signed-off-by: Dave Chen <dave.chen@arm.com>
This commit is contained in:
parent
575616cc72
commit
23f75bf40e
@ -464,11 +464,11 @@ kubernetesVersion: %s`,
|
||||
err := config.load()
|
||||
if test.expectErr {
|
||||
assert.Error(t, err)
|
||||
} else {
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
for _, assertFunc := range test.assertions {
|
||||
assertFunc(t, config)
|
||||
if !test.expectErr && assert.NoError(t, err) {
|
||||
for _, assertFunc := range test.assertions {
|
||||
assertFunc(t, config)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user