mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-12 12:48:51 +00:00
fix-external-etcd
This commit is contained in:
@@ -186,9 +186,11 @@ func (pfct preflightCheckTest) Check() (warning, errorList []error) {
|
||||
|
||||
func TestRunInitNodeChecks(t *testing.T) {
|
||||
var tests = []struct {
|
||||
name string
|
||||
cfg *kubeadmapi.InitConfiguration
|
||||
expected bool
|
||||
name string
|
||||
cfg *kubeadmapi.InitConfiguration
|
||||
expected bool
|
||||
isSecondaryControlPlane bool
|
||||
downloadCerts bool
|
||||
}{
|
||||
{name: "Test valid advertised address",
|
||||
cfg: &kubeadmapi.InitConfiguration{
|
||||
@@ -197,7 +199,7 @@ func TestRunInitNodeChecks(t *testing.T) {
|
||||
expected: false,
|
||||
},
|
||||
{
|
||||
name: "Test CA file exists if specfied",
|
||||
name: "Test CA file exists if specified",
|
||||
cfg: &kubeadmapi.InitConfiguration{
|
||||
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
||||
Etcd: kubeadmapi.Etcd{External: &kubeadmapi.ExternalEtcd{CAFile: "/foo"}},
|
||||
@@ -206,7 +208,18 @@ func TestRunInitNodeChecks(t *testing.T) {
|
||||
expected: false,
|
||||
},
|
||||
{
|
||||
name: "Test Cert file exists if specfied",
|
||||
name: "Skip test CA file exists if specified/download certs",
|
||||
cfg: &kubeadmapi.InitConfiguration{
|
||||
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
||||
Etcd: kubeadmapi.Etcd{External: &kubeadmapi.ExternalEtcd{CAFile: "/foo"}},
|
||||
},
|
||||
},
|
||||
expected: true,
|
||||
isSecondaryControlPlane: true,
|
||||
downloadCerts: true,
|
||||
},
|
||||
{
|
||||
name: "Test Cert file exists if specified",
|
||||
cfg: &kubeadmapi.InitConfiguration{
|
||||
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
||||
Etcd: kubeadmapi.Etcd{External: &kubeadmapi.ExternalEtcd{CertFile: "/foo"}},
|
||||
@@ -215,7 +228,7 @@ func TestRunInitNodeChecks(t *testing.T) {
|
||||
expected: false,
|
||||
},
|
||||
{
|
||||
name: "Test Key file exists if specfied",
|
||||
name: "Test Key file exists if specified",
|
||||
cfg: &kubeadmapi.InitConfiguration{
|
||||
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
||||
Etcd: kubeadmapi.Etcd{External: &kubeadmapi.ExternalEtcd{CertFile: "/foo"}},
|
||||
@@ -232,7 +245,7 @@ func TestRunInitNodeChecks(t *testing.T) {
|
||||
}
|
||||
for _, rt := range tests {
|
||||
// TODO: Make RunInitNodeChecks accept a ClusterConfiguration object instead of InitConfiguration
|
||||
actual := RunInitNodeChecks(exec.New(), rt.cfg, sets.NewString(), false)
|
||||
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",
|
||||
|
Reference in New Issue
Block a user