mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
names unnamed testcases, adds name to t.Errorf msg
This commit is contained in:
parent
04362870ad
commit
1eb1690a92
@ -237,6 +237,7 @@ func TestRunInitNodeChecks(t *testing.T) {
|
|||||||
expected: false,
|
expected: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
name: "Test APIEndpoint exists if exists",
|
||||||
cfg: &kubeadmapi.InitConfiguration{
|
cfg: &kubeadmapi.InitConfiguration{
|
||||||
LocalAPIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "2001:1234::1:15"},
|
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)
|
actual := RunInitNodeChecks(exec.New(), rt.cfg, sets.NewString(), rt.isSecondaryControlPlane, rt.downloadCerts)
|
||||||
if (actual == nil) != rt.expected {
|
if (actual == nil) != rt.expected {
|
||||||
t.Errorf(
|
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,
|
rt.expected,
|
||||||
(actual == nil),
|
(actual == nil),
|
||||||
actual,
|
actual,
|
||||||
@ -259,14 +261,17 @@ func TestRunInitNodeChecks(t *testing.T) {
|
|||||||
|
|
||||||
func TestRunJoinNodeChecks(t *testing.T) {
|
func TestRunJoinNodeChecks(t *testing.T) {
|
||||||
var tests = []struct {
|
var tests = []struct {
|
||||||
|
name string
|
||||||
cfg *kubeadmapi.JoinConfiguration
|
cfg *kubeadmapi.JoinConfiguration
|
||||||
expected bool
|
expected bool
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
|
name: "Check empty JoinConfiguration",
|
||||||
cfg: &kubeadmapi.JoinConfiguration{},
|
cfg: &kubeadmapi.JoinConfiguration{},
|
||||||
expected: false,
|
expected: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
name: "Check TLS Bootstrap APIServerEndpoint IPv4 addr",
|
||||||
cfg: &kubeadmapi.JoinConfiguration{
|
cfg: &kubeadmapi.JoinConfiguration{
|
||||||
Discovery: kubeadmapi.Discovery{
|
Discovery: kubeadmapi.Discovery{
|
||||||
BootstrapToken: &kubeadmapi.BootstrapTokenDiscovery{
|
BootstrapToken: &kubeadmapi.BootstrapTokenDiscovery{
|
||||||
@ -277,6 +282,7 @@ func TestRunJoinNodeChecks(t *testing.T) {
|
|||||||
expected: false,
|
expected: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
name: "Check TLS Bootstrap APIServerEndpoint IPv6 addr",
|
||||||
cfg: &kubeadmapi.JoinConfiguration{
|
cfg: &kubeadmapi.JoinConfiguration{
|
||||||
Discovery: kubeadmapi.Discovery{
|
Discovery: kubeadmapi.Discovery{
|
||||||
BootstrapToken: &kubeadmapi.BootstrapTokenDiscovery{
|
BootstrapToken: &kubeadmapi.BootstrapTokenDiscovery{
|
||||||
@ -292,7 +298,8 @@ func TestRunJoinNodeChecks(t *testing.T) {
|
|||||||
actual := RunJoinNodeChecks(exec.New(), rt.cfg, sets.NewString())
|
actual := RunJoinNodeChecks(exec.New(), rt.cfg, sets.NewString())
|
||||||
if (actual == nil) != rt.expected {
|
if (actual == nil) != rt.expected {
|
||||||
t.Errorf(
|
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,
|
rt.expected,
|
||||||
(actual != nil),
|
(actual != nil),
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user