From 31a4b692ee165ae72337ea7566b40341222c4bcb Mon Sep 17 00:00:00 2001 From: Gyuho Lee Date: Thu, 5 Apr 2018 15:41:37 -0700 Subject: [PATCH] functional-tester/agent: wait before loading TLS Signed-off-by: Gyuho Lee --- tools/functional-tester/agent/handler.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tools/functional-tester/agent/handler.go b/tools/functional-tester/agent/handler.go index fd53ea52d..182bc2e8e 100644 --- a/tools/functional-tester/agent/handler.go +++ b/tools/functional-tester/agent/handler.go @@ -275,8 +275,17 @@ func (srv *Server) saveTLSAssets() error { func (srv *Server) loadAutoTLSAssets() error { // if started with auto TLS, sends back TLS assets to tester/client if srv.Member.Etcd.ClientAutoTLS { + // in case of slow disk + time.Sleep(time.Second) + fdir := filepath.Join(srv.Member.Etcd.DataDir, "fixtures", "client") + srv.lg.Info( + "loading client TLS assets", + zap.String("dir", fdir), + zap.String("endpoint", srv.EtcdClientEndpoint), + ) + certPath := filepath.Join(fdir, "cert.pem") if !fileutil.Exist(certPath) { return fmt.Errorf("cannot find %q", certPath) @@ -306,8 +315,17 @@ func (srv *Server) loadAutoTLSAssets() error { ) } if srv.Member.Etcd.ClientAutoTLS { + // in case of slow disk + time.Sleep(time.Second) + fdir := filepath.Join(srv.Member.Etcd.DataDir, "fixtures", "peer") + srv.lg.Info( + "loading client TLS assets", + zap.String("dir", fdir), + zap.String("endpoint", srv.EtcdClientEndpoint), + ) + certPath := filepath.Join(fdir, "cert.pem") if !fileutil.Exist(certPath) { return fmt.Errorf("cannot find %q", certPath)