You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by mm...@apache.org on 2018/09/23 00:41:15 UTC

[geode-native] branch develop updated: Fix cli integration-test2 flakiness (#362)

This is an automated email from the ASF dual-hosted git repository.

mmartell pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode-native.git


The following commit(s) were added to refs/heads/develop by this push:
     new 31c5402  Fix cli integration-test2 flakiness (#362)
31c5402 is described below

commit 31c54026cc7bc1e832386c165fb47521e90e06aa
Author: Michael Martell <mm...@pivotal.io>
AuthorDate: Sat Sep 22 17:41:10 2018 -0700

    Fix cli integration-test2 flakiness (#362)
---
 clicache/integration-test2/GeodeServer.cs | 345 ++++++++++++++++--------------
 1 file changed, 180 insertions(+), 165 deletions(-)

diff --git a/clicache/integration-test2/GeodeServer.cs b/clicache/integration-test2/GeodeServer.cs
index 59d597e..0faba4c 100644
--- a/clicache/integration-test2/GeodeServer.cs
+++ b/clicache/integration-test2/GeodeServer.cs
@@ -7,199 +7,214 @@ using Xunit;
 
 public class GeodeServer : IDisposable
 {
-    #region Properties/Fields
+  #region Properties/Fields
 
-    public int LocatorPort { get; private set; }
+  public int LocatorPort { get; private set; }
+  public int LocatorJmxPort { get; private set; }
 
-    private bool _useSsl;
+  private bool _useSsl;
 
-    #endregion
+  #endregion
 
-    #region Public methods
+  #region Public methods
 
-    public GeodeServer(string regionName = "testRegion", bool readSerialized = false, bool useSsl = false)
+  public GeodeServer(string regionName = "testRegion", bool readSerialized = false, bool useSsl = false)
+  {
+    _useSsl = useSsl;
+    try
     {
-        _useSsl = useSsl;
-        try
+      //Clean up previous server dirs
+      foreach (var dir in new DirectoryInfo(Environment.CurrentDirectory).GetDirectories())
+      {
+        if (!dir.Name.Equals("ServerSslKeys", StringComparison.OrdinalIgnoreCase)
+            && !dir.Name.Equals("ClientSslKeys", StringComparison.OrdinalIgnoreCase))
         {
-            //Clean up previous server dirs
-            foreach (var dir in new DirectoryInfo(Environment.CurrentDirectory).GetDirectories())
-            {
-                if (!dir.Name.Equals("ServerSslKeys", StringComparison.OrdinalIgnoreCase) 
-                    && !dir.Name.Equals("ClientSslKeys", StringComparison.OrdinalIgnoreCase))
-                {
-                    dir.Delete(true);
-                }
-            }
-        }
-        catch
-        {
-            //Ignored
+          dir.Delete(true);
         }
+      }
+    }
+    catch
+    {
+      //Ignored
+    }
 
-        LocatorPort = FreeTcpPort();
-        var locatorJmxPort = FreeTcpPort();
+    LocatorPort = FreeTcpPort();
+    LocatorJmxPort = FreeTcpPort();
 
-        var readSerializedStr = readSerialized ? "--read-serialized=true" : "--read-serialized=false";
+    var readSerializedStr = readSerialized ? "--read-serialized=true" : "--read-serialized=false";
 
-        Process gfsh;
-        if (_useSsl)
+    Process gfsh;
+    if (_useSsl)
+    {
+      gfsh = new Process
+      {
+        StartInfo =
         {
-            gfsh = new Process
-            {
-                StartInfo =
-                {
-                    FileName = Config.GeodeGfsh,
-                    Arguments = " -e \"start locator --bind-address=localhost --port=" + LocatorPort +
-                                " --J=-Dgemfire.jmx-manager-port=" + locatorJmxPort + " --http-service-port=0 --connect=false --J=-Dgemfire.ssl-enabled-components=locator,jmx" +
-                                " --J=-Dgemfire.ssl-keystore=" + Environment.CurrentDirectory + "/ServerSslKeys/server_keystore.jks --J=-Dgemfire.ssl-keystore-password=gemstone" +
-                                " --J=-Dgemfire.ssl-truststore=" + Environment.CurrentDirectory + "/ServerSslKeys/server_truststore.jks --J=-Dgemfire.ssl-truststore-password=gemstone\"" +
-                                " -e \"connect --locator=localhost[" + LocatorPort + "] --use-ssl --key-store=" + Environment.CurrentDirectory + "/ServerSslKeys/server_keystore.jks --key-store-password=gemstone " +
-                                " --trust-store=" + Environment.CurrentDirectory + "/ServerSslKeys/server_truststore.jks --trust-store-password=gemstone\"" +
-                                " -e \"configure pdx " + readSerializedStr + "\"" +
-                                " -e \"start server --bind-address=localhost --server-port=0 --log-level=all" +
-                                " --J=-Dgemfire.ssl-enabled-components=server,locator,jmx --J=-Dgemfire.ssl-keystore=" + Environment.CurrentDirectory + "/ServerSslKeys/server_keystore.jks" +
-                                " --J=-Dgemfire.ssl-keystore-password=gemstone --J=-Dgemfire.ssl-truststore=" + Environment.CurrentDirectory + "/ServerSslKeys/server_truststore.jks --J=-Dgemfire.ssl-truststore-password=gemstone\"" +
-                                " -e \"create region --name=" + regionName + " --type=PARTITION\"" +
-                                " -e \"create region --name=testRegion1 --type=PARTITION\"",
-                    WindowStyle = ProcessWindowStyle.Hidden,
-                    UseShellExecute = false,
-                    RedirectStandardOutput = true,
-                    RedirectStandardError = true,
-                    CreateNoWindow = false
-                }
-            };
+          FileName = Config.GeodeGfsh,
+          Arguments = " -e \"start locator --bind-address=localhost --port=" + LocatorPort +
+                      " --J=-Dgemfire.jmx-manager-port=" + LocatorJmxPort +
+                      " --http-service-port=0 --connect=false --J=-Dgemfire.ssl-enabled-components=locator,jmx" +
+                      " --J=-Dgemfire.ssl-keystore=" + Environment.CurrentDirectory +
+                      "/ServerSslKeys/server_keystore.jks --J=-Dgemfire.ssl-keystore-password=gemstone" +
+                      " --J=-Dgemfire.ssl-truststore=" + Environment.CurrentDirectory +
+                      "/ServerSslKeys/server_truststore.jks --J=-Dgemfire.ssl-truststore-password=gemstone\"" +
+                      " -e \"connect --locator=localhost[" + LocatorPort + "] --use-ssl --key-store=" +
+                      Environment.CurrentDirectory +
+                      "/ServerSslKeys/server_keystore.jks --key-store-password=gemstone " +
+                      " --trust-store=" + Environment.CurrentDirectory +
+                      "/ServerSslKeys/server_truststore.jks --trust-store-password=gemstone\"" +
+                      " -e \"configure pdx " + readSerializedStr + "\"" +
+                      " -e \"start server --bind-address=localhost --server-port=0 --log-level=all" +
+                      " --J=-Dgemfire.ssl-enabled-components=server,locator,jmx --J=-Dgemfire.ssl-keystore=" +
+                      Environment.CurrentDirectory + "/ServerSslKeys/server_keystore.jks" +
+                      " --J=-Dgemfire.ssl-keystore-password=gemstone --J=-Dgemfire.ssl-truststore=" +
+                      Environment.CurrentDirectory +
+                      "/ServerSslKeys/server_truststore.jks --J=-Dgemfire.ssl-truststore-password=gemstone\"" +
+                      " -e \"create region --name=" + regionName + " --type=PARTITION\"" +
+                      " -e \"create region --name=testRegion1 --type=PARTITION\"",
+          WindowStyle = ProcessWindowStyle.Hidden,
+          UseShellExecute = false,
+          RedirectStandardOutput = true,
+          RedirectStandardError = true,
+          CreateNoWindow = false
         }
-        else
+      };
+    }
+    else
+    {
+      gfsh = new Process
+      {
+        StartInfo =
         {
-            gfsh = new Process
-            {
-                StartInfo =
-                {
-                    FileName = Config.GeodeGfsh,
-                    Arguments = " -e \"start locator --bind-address=localhost --port=" + LocatorPort + "\"" +
-                                " -e \"start server --bind-address=localhost --server-port=0\"" +
-                                " -e \"create region --name=" + regionName + " --type=PARTITION\"" +
-                                " -e \"create region --name=testRegion1 --type=PARTITION\"",
-                    WindowStyle = ProcessWindowStyle.Hidden,
-                    UseShellExecute = false,
-                    RedirectStandardOutput = true,
-                    RedirectStandardError = true,
-                    CreateNoWindow = true
-                }
-            };
+          FileName = Config.GeodeGfsh,
+          Arguments = " -e \"start locator --bind-address=localhost --port=" + LocatorPort +
+                      " --J=-Dgemfire.jmx-manager-port=" + LocatorJmxPort + " --http-service-port=0" + "\"" +
+                      " -e \"start server --bind-address=localhost --server-port=0\"" +
+                      " -e \"create region --name=" + regionName + " --type=PARTITION\"" +
+                      " -e \"create region --name=testRegion1 --type=PARTITION\"",
+          WindowStyle = ProcessWindowStyle.Hidden,
+          UseShellExecute = false,
+          RedirectStandardOutput = true,
+          RedirectStandardError = true,
+          CreateNoWindow = true
         }
+      };
+    }
 
-        gfsh.OutputDataReceived += (sender, args) =>
-        {
-            if (null != args.Data)
-                Debug.WriteLine("GeodeServer: " + args.Data);
-        };
+    gfsh.OutputDataReceived += (sender, args) =>
+    {
+      if (null != args.Data)
+        Debug.WriteLine("GeodeServer: " + args.Data);
+    };
 
-        gfsh.ErrorDataReceived += (sender, args) =>
-        {
-            if (null != args.Data)
-                Debug.WriteLine("GeodeServer: ERROR: " + args.Data);
-        };
+    gfsh.ErrorDataReceived += (sender, args) =>
+    {
+      if (null != args.Data)
+        Debug.WriteLine("GeodeServer: ERROR: " + args.Data);
+    };
 
-        gfsh.Start();
-        gfsh.BeginOutputReadLine();
-        gfsh.BeginErrorReadLine();
-        if (gfsh.WaitForExit(60000)) {
-            Debug.WriteLine("GeodeServer Start: gfsh.HasExited = {0}, gfsh.ExitCode = {1}",
-                gfsh.HasExited, gfsh.ExitCode);
-        }
-        else
-        {
-            Debug.WriteLine("GeodeServer Start: gfsh failed to exit, force killing.");
-            try
-            {
-                gfsh.Kill();
-            }
-            catch
-            {
-                // ignored
-            }
-        }
+
+    gfsh.Start();
+    gfsh.BeginOutputReadLine();
+    gfsh.BeginErrorReadLine();
+    if (gfsh.WaitForExit(60000))
+    {
+      Debug.WriteLine("GeodeServer Start: gfsh.HasExited = {0}, gfsh.ExitCode = {1}",
+        gfsh.HasExited, gfsh.ExitCode);
+    }
+    else
+    {
+      Debug.WriteLine("GeodeServer Start: gfsh failed to exit, force killing.");
+      try
+      {
+        gfsh.Kill();
+      }
+      catch
+      {
+        // ignored
+      }
     }
+  }
 
-    public void Dispose()
+  public void Dispose()
+  {
+    try
     {
-        try
-        {
-            Process gfsh;
+      Process gfsh;
 
-            if (_useSsl)
+      if (_useSsl)
+      {
+        gfsh = new Process
+        {
+          StartInfo =
             {
-                gfsh = new Process
-                {
-                    StartInfo =
-                    {
-                        FileName = Config.GeodeGfsh,
-                        Arguments = "-e \"connect --locator=localhost[" + LocatorPort + "] --use-ssl --key-store=" + Environment.CurrentDirectory +
-                                    "/ServerSslKeys/server_keystore.jks --key-store-password=gemstone --trust-store=" + Environment.CurrentDirectory +
-                                    "/ServerSslKeys/server_truststore.jks --trust-store-password=gemstone\" -e \"shutdown --include-locators true\" ",
-                        WindowStyle = ProcessWindowStyle.Hidden,
-                        UseShellExecute = false,
-                        RedirectStandardOutput = true,
-                        RedirectStandardError = true,
-                        CreateNoWindow = true
-                    }
-                };
+              FileName = Config.GeodeGfsh,
+              Arguments = "-e \"connect --jmx-manager=localhost[" + LocatorJmxPort  + "] --use-ssl --key-store=" +
+                          Environment.CurrentDirectory +
+                          "/ServerSslKeys/server_keystore.jks --key-store-password=gemstone --trust-store=" +
+                          Environment.CurrentDirectory +
+                          "/ServerSslKeys/server_truststore.jks --trust-store-password=gemstone\" -e \"shutdown --include-locators true\" ",
+              WindowStyle = ProcessWindowStyle.Hidden,
+              UseShellExecute = false,
+              RedirectStandardOutput = true,
+              RedirectStandardError = true,
+              CreateNoWindow = true
             }
-            else
+        };
+      }
+      else
+      {
+        gfsh = new Process
+        {
+          StartInfo =
             {
-                gfsh = new Process
-                {
-                    StartInfo =
-                    {
-                        FileName = Config.GeodeGfsh,
-                        Arguments = "-e \"connect --locator=localhost[" + LocatorPort +
-                                    "]\" -e \"shutdown --include-locators true\" ",
-                        WindowStyle = ProcessWindowStyle.Hidden,
-                        UseShellExecute = false,
-                        RedirectStandardOutput = true,
-                        RedirectStandardError = true,
-                        CreateNoWindow = true
-                    }
-                };
+              FileName = Config.GeodeGfsh,
+              Arguments = "-e \"connect --jmx-manager=localhost[" + LocatorJmxPort +
+                          "]\" -e \"shutdown --include-locators true\" ",
+              WindowStyle = ProcessWindowStyle.Hidden,
+              UseShellExecute = false,
+              RedirectStandardOutput = true,
+              RedirectStandardError = true,
+              CreateNoWindow = true
             }
-
-            gfsh.OutputDataReceived += (sender, args) =>
-            {
-                if (null != args.Data)
-                    Debug.WriteLine("GeodeServer: " + args.Data);
-            };
-
-            gfsh.ErrorDataReceived += (sender, args) =>
-            {
-                if (null != args.Data)
-                    Debug.WriteLine("GeodeServer: ERROR: " + args.Data);
-            };
-
-            gfsh.Start();
-            gfsh.BeginOutputReadLine();
-            gfsh.BeginErrorReadLine();
-            gfsh.WaitForExit(30000);
-        }
-        catch
-        {
-            // ignored
-        }
+        };
+      }
+
+      gfsh.OutputDataReceived += (sender, args) =>
+      {
+        if (null != args.Data)
+          Debug.WriteLine("GeodeServer: " + args.Data);
+      };
+
+      gfsh.ErrorDataReceived += (sender, args) =>
+      {
+        if (null != args.Data)
+          Debug.WriteLine("GeodeServer: ERROR: " + args.Data);
+      };
+
+      gfsh.Start();
+      gfsh.BeginOutputReadLine();
+      gfsh.BeginErrorReadLine();
+      gfsh.WaitForExit(30000);
+    }
+    catch
+    {
+      // ignored
     }
+  }
 
-    #endregion
+  #endregion
 
-    #region Private Methods
+  #region Private Methods
 
-    private static int FreeTcpPort()
-    {
-        var tcpListner = new TcpListener(IPAddress.Loopback, 0);
-        tcpListner.Start();
-        var port = ((IPEndPoint)tcpListner.LocalEndpoint).Port;
-        tcpListner.Stop();
-        return port;
-    }
+  private static int FreeTcpPort()
+  {
+    var tcpListner = new TcpListener(IPAddress.Loopback, 0);
+    tcpListner.Start();
+    var port = ((IPEndPoint) tcpListner.LocalEndpoint).Port;
+    tcpListner.Stop();
+    return port;
+  }
 
-    #endregion
-}
+  #endregion
+}
\ No newline at end of file