mirror of
https://github.com/rancher/rke.git
synced 2025-09-20 02:49:08 +00:00
Add generic generation for pki objects and etcd TLS
This commit is contained in:
@@ -5,11 +5,12 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/rancher/rke/hosts"
|
||||
"github.com/rancher/rke/pki"
|
||||
"github.com/rancher/types/apis/management.cattle.io/v3"
|
||||
)
|
||||
|
||||
const (
|
||||
TestInitEtcdClusterString = "etcd-etcd1=http://1.1.1.1:2380,etcd-etcd2=http://2.2.2.2:2380"
|
||||
TestInitEtcdClusterString = "etcd-etcd1=https://1.1.1.1:2380,etcd-etcd2=https://2.2.2.2:2380"
|
||||
TestEtcdImage = "etcd/etcdImage:latest"
|
||||
TestEtcdNamePrefix = "--name=etcd-"
|
||||
TestEtcdVolumeBind = "/var/lib/etcd:/etcd-data"
|
||||
@@ -46,7 +47,8 @@ func TestEtcdConfig(t *testing.T) {
|
||||
assertEqual(t, initCluster, TestInitEtcdClusterString, "")
|
||||
|
||||
for _, host := range etcdHosts {
|
||||
imageCfg, hostCfg := buildEtcdConfig(host, etcdService, TestInitEtcdClusterString)
|
||||
nodeName := pki.GetEtcdCrtName(host.InternalAddress)
|
||||
imageCfg, hostCfg := buildEtcdConfig(host, etcdService, TestInitEtcdClusterString, nodeName)
|
||||
assertEqual(t, isStringInSlice(TestEtcdNamePrefix+host.HostnameOverride, imageCfg.Cmd), true,
|
||||
fmt.Sprintf("Failed to find [%s] in Etcd command", TestEtcdNamePrefix+host.HostnameOverride))
|
||||
assertEqual(t, TestEtcdImage, imageCfg.Image,
|
||||
|
Reference in New Issue
Block a user