Browse Source

functional-tester/agent: wait before loading TLS

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
Gyuho Lee 7 years ago
parent
commit
31a4b692ee
1 changed files with 18 additions and 0 deletions
  1. 18 0
      tools/functional-tester/agent/handler.go

+ 18 - 0
tools/functional-tester/agent/handler.go

@@ -275,8 +275,17 @@ func (srv *Server) saveTLSAssets() error {
 func (srv *Server) loadAutoTLSAssets() error {
 func (srv *Server) loadAutoTLSAssets() error {
 	// if started with auto TLS, sends back TLS assets to tester/client
 	// if started with auto TLS, sends back TLS assets to tester/client
 	if srv.Member.Etcd.ClientAutoTLS {
 	if srv.Member.Etcd.ClientAutoTLS {
+		// in case of slow disk
+		time.Sleep(time.Second)
+
 		fdir := filepath.Join(srv.Member.Etcd.DataDir, "fixtures", "client")
 		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")
 		certPath := filepath.Join(fdir, "cert.pem")
 		if !fileutil.Exist(certPath) {
 		if !fileutil.Exist(certPath) {
 			return fmt.Errorf("cannot find %q", certPath)
 			return fmt.Errorf("cannot find %q", certPath)
@@ -306,8 +315,17 @@ func (srv *Server) loadAutoTLSAssets() error {
 		)
 		)
 	}
 	}
 	if srv.Member.Etcd.ClientAutoTLS {
 	if srv.Member.Etcd.ClientAutoTLS {
+		// in case of slow disk
+		time.Sleep(time.Second)
+
 		fdir := filepath.Join(srv.Member.Etcd.DataDir, "fixtures", "peer")
 		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")
 		certPath := filepath.Join(fdir, "cert.pem")
 		if !fileutil.Exist(certPath) {
 		if !fileutil.Exist(certPath) {
 			return fmt.Errorf("cannot find %q", certPath)
 			return fmt.Errorf("cannot find %q", certPath)