diff --git a/cmd/kubeadm/app/preflight/checks_test.go b/cmd/kubeadm/app/preflight/checks_test.go index 3a6b2f27ab9..99824922f96 100644 --- a/cmd/kubeadm/app/preflight/checks_test.go +++ b/cmd/kubeadm/app/preflight/checks_test.go @@ -237,6 +237,7 @@ func TestRunInitNodeChecks(t *testing.T) { expected: false, }, { + name: "Test APIEndpoint exists if exists", cfg: &kubeadmapi.InitConfiguration{ LocalAPIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "2001:1234::1:15"}, }, @@ -248,7 +249,8 @@ func TestRunInitNodeChecks(t *testing.T) { actual := RunInitNodeChecks(exec.New(), rt.cfg, sets.NewString(), rt.isSecondaryControlPlane, rt.downloadCerts) if (actual == nil) != rt.expected { t.Errorf( - "failed RunInitNodeChecks:\n\texpected: %t\n\t actual: %t\n\t error: %v", + "failed RunInitNodeChecks:%v\n\texpected: %t\n\t actual: %t\n\t error: %v", + rt.name, rt.expected, (actual == nil), actual, @@ -259,14 +261,17 @@ func TestRunInitNodeChecks(t *testing.T) { func TestRunJoinNodeChecks(t *testing.T) { var tests = []struct { + name string cfg *kubeadmapi.JoinConfiguration expected bool }{ { + name: "Check empty JoinConfiguration", cfg: &kubeadmapi.JoinConfiguration{}, expected: false, }, { + name: "Check TLS Bootstrap APIServerEndpoint IPv4 addr", cfg: &kubeadmapi.JoinConfiguration{ Discovery: kubeadmapi.Discovery{ BootstrapToken: &kubeadmapi.BootstrapTokenDiscovery{ @@ -277,6 +282,7 @@ func TestRunJoinNodeChecks(t *testing.T) { expected: false, }, { + name: "Check TLS Bootstrap APIServerEndpoint IPv6 addr", cfg: &kubeadmapi.JoinConfiguration{ Discovery: kubeadmapi.Discovery{ BootstrapToken: &kubeadmapi.BootstrapTokenDiscovery{ @@ -292,7 +298,8 @@ func TestRunJoinNodeChecks(t *testing.T) { actual := RunJoinNodeChecks(exec.New(), rt.cfg, sets.NewString()) if (actual == nil) != rt.expected { t.Errorf( - "failed RunJoinNodeChecks:\n\texpected: %t\n\t actual: %t", + "failed RunJoinNodeChecks:%v\n\texpected: %t\n\t actual: %t", + rt.name, rt.expected, (actual != nil), )