Browse Source

Merge pull request #9702 from gyuho/fix-tests

tests/e2e: fix v2 proxy tests
Gyuho Lee 7 years ago
parent
commit
f42d9a8451
3 changed files with 15 additions and 5 deletions
  1. 2 2
      etcdmain/etcd.go
  2. 12 2
      etcdmain/grpc_proxy.go
  3. 1 1
      tests/e2e/cluster_proxy_test.go

+ 2 - 2
etcdmain/etcd.go

@@ -549,9 +549,9 @@ func startProxy(cfg *config) error {
 		host := u.String()
 		go func() {
 			if lg != nil {
-				lg.Info("proxy started listening on client requests", zap.String("host", host))
+				lg.Info("v2 proxy started listening on client requests", zap.String("host", host))
 			} else {
-				plog.Info("proxy: listening for client requests on ", host)
+				plog.Infof("v2 proxy started listening on client requests on %q", host)
 			}
 			mux := http.NewServeMux()
 			etcdhttp.HandlePrometheus(mux) // v2 proxy just uses the same port

+ 12 - 2
etcdmain/grpc_proxy.go

@@ -158,6 +158,9 @@ func startGRPCProxy(cmd *cobra.Command, args []string) {
 		},
 		Encoding:      "json",
 		EncoderConfig: zap.NewProductionEncoderConfig(),
+
+		OutputPaths:      []string{"stderr"},
+		ErrorOutputPaths: []string{"stderr"},
 	}
 	if grpcProxyDebug {
 		lcfg.Level = zap.NewAtomicLevelAt(zap.DebugLevel)
@@ -195,7 +198,7 @@ func startGRPCProxy(cmd *cobra.Command, args []string) {
 	grpcl := m.Match(cmux.HTTP2())
 	defer func() {
 		grpcl.Close()
-		lg.Info("stopping listening gRPC proxy client requests", zap.String("address", grpcProxyListenAddr))
+		lg.Info("stop listening gRPC proxy client requests", zap.String("address", grpcProxyListenAddr))
 	}()
 
 	client := mustNewClient(lg)
@@ -211,11 +214,18 @@ func startGRPCProxy(cmd *cobra.Command, args []string) {
 			mux := http.NewServeMux()
 			etcdhttp.HandlePrometheus(mux)
 			grpcproxy.HandleHealth(mux, client)
+			lg.Info("gRPC proxy server metrics URL serving")
 			herr := http.Serve(mhttpl, mux)
-			lg.Fatal("gRPC proxy server serve returned", zap.Error(herr))
+			if herr != nil {
+				lg.Fatal("gRPC proxy server metrics URL returned", zap.Error(herr))
+			} else {
+				lg.Info("gRPC proxy server metrics URL returned")
+			}
 		}()
 	}
 
+	lg.Info("started gRPC proxy", zap.String("address", grpcProxyListenAddr))
+
 	// grpc-proxy is initialized, ready to serve
 	notifySystemd(lg)
 

+ 1 - 1
tests/e2e/cluster_proxy_test.go

@@ -284,5 +284,5 @@ func (v3p *proxyV3Proc) Start() error {
 	if err := v3p.start(); err != nil {
 		return err
 	}
-	return v3p.waitReady("listening for grpc-proxy client requests")
+	return v3p.waitReady("started gRPC proxy")
 }