Fix etcd3 config changed

This commit is contained in:
kkkkun 2023-05-06 19:40:40 +08:00
parent 36b760a931
commit 57969c1b52
2 changed files with 8 additions and 8 deletions

View File

@ -66,10 +66,10 @@ func NewTestConfig(t testing.TB) *embed.Config {
clientURL := url.URL{Scheme: "http", Host: net.JoinHostPort("localhost", strconv.Itoa(ports[0]))} clientURL := url.URL{Scheme: "http", Host: net.JoinHostPort("localhost", strconv.Itoa(ports[0]))}
peerURL := url.URL{Scheme: "http", Host: net.JoinHostPort("localhost", strconv.Itoa(ports[1]))} peerURL := url.URL{Scheme: "http", Host: net.JoinHostPort("localhost", strconv.Itoa(ports[1]))}
cfg.LPUrls = []url.URL{peerURL} cfg.ListenPeerUrls = []url.URL{peerURL}
cfg.APUrls = []url.URL{peerURL} cfg.AdvertisePeerUrls = []url.URL{peerURL}
cfg.LCUrls = []url.URL{clientURL} cfg.ListenClientUrls = []url.URL{clientURL}
cfg.ACUrls = []url.URL{clientURL} cfg.AdvertiseClientUrls = []url.URL{clientURL}
cfg.InitialCluster = cfg.InitialClusterFromName(cfg.Name) cfg.InitialCluster = cfg.InitialClusterFromName(cfg.Name)
cfg.ZapLoggerBuilder = embed.NewZapLoggerBuilder(zaptest.NewLogger(t, zaptest.Level(zapcore.ErrorLevel)).Named("etcd-server")) cfg.ZapLoggerBuilder = embed.NewZapLoggerBuilder(zaptest.NewLogger(t, zaptest.Level(zapcore.ErrorLevel)).Named("etcd-server"))

View File

@ -62,11 +62,11 @@ func TestTLSConnection(t *testing.T) {
KeyFile: keyFile, KeyFile: keyFile,
TrustedCAFile: caFile, TrustedCAFile: caFile,
} }
for i := range etcdConfig.LCUrls { for i := range etcdConfig.ListenClientUrls {
etcdConfig.LCUrls[i].Scheme = "https" etcdConfig.ListenClientUrls[i].Scheme = "https"
} }
for i := range etcdConfig.ACUrls { for i := range etcdConfig.AdvertiseClientUrls {
etcdConfig.ACUrls[i].Scheme = "https" etcdConfig.AdvertiseClientUrls[i].Scheme = "https"
} }
client := testserver.RunEtcd(t, etcdConfig) client := testserver.RunEtcd(t, etcdConfig)