From a7cedfbf359f912d4a0e891a9b62fb343c66a4e2 Mon Sep 17 00:00:00 2001 From: Mike Martell Date: Mon, 28 Feb 2022 14:09:37 -0800 Subject: [PATCH 1/2] GEODE-10088: serverGroups support - add to new clicache test framework --- clicache/integration-test2/Cluster.cs | 17 ++++++++++++----- clicache/integration-test2/Gfsh.cs | 8 +++++++- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/clicache/integration-test2/Cluster.cs b/clicache/integration-test2/Cluster.cs index f4deaa2470..6eb6bca9a9 100644 --- a/clicache/integration-test2/Cluster.cs +++ b/clicache/integration-test2/Cluster.cs @@ -33,6 +33,7 @@ public class Cluster : IDisposable private bool started_; private List locators_; private string name_; + private string groups_; internal int jmxManagerPort = Framework.FreeTcpPort(); internal string keyStore_ = Config.SslServerKeyPath + "/server_keystore_chained.jks"; internal string keyStorePassword_ = "apachegeode"; @@ -53,12 +54,13 @@ internal PoolFactory ApplyLocators(PoolFactory poolFactory) return poolFactory; } - public Cluster(ITestOutputHelper output, string name, int locatorCount, int serverCount) + public Cluster(ITestOutputHelper output, string name, int locatorCount, int serverCount, string groups = "") { started_ = false; Gfsh = new GfshExecute(output); UseSSL = false; name_ = name; + groups_ = groups; locatorCount_ = locatorCount; serverCount_ = serverCount; locators_ = new List(); @@ -85,7 +87,7 @@ private bool StartServers() for (var i = 0; i < serverCount_; i++) { var server = new Server(this, locators_, - name_ + "/server/" + i.ToString()); + name_ + "/server/" + i.ToString(), groups_); var localResult = server.Start(); if (localResult != 0) { @@ -126,7 +128,7 @@ public void Dispose() } } - public Cache CreateCache(IDictionary properties) + public Cache CreateCache(IDictionary properties, string serverGroup = "") { var cacheFactory = new CacheFactory(); @@ -141,7 +143,9 @@ public Cache CreateCache(IDictionary properties) var cache = cacheFactory.Create(); - ApplyLocators(cache.GetPoolFactory()).Create("default"); + ApplyLocators(cache.GetPoolFactory()) + .SetServerGroup(serverGroup) + .Create("default"); return cache; } @@ -243,12 +247,14 @@ public class Server private string name_; private List locators_; private bool started_; + private string groups_; - public Server(Cluster cluster, List locators, string name) + public Server(Cluster cluster, List locators, string name, string groups) { cluster_ = cluster; locators_ = locators; name_ = name; + groups_ = groups; var address = new Address(); address.address = "localhost"; address.port = 0; @@ -269,6 +275,7 @@ public int Start() .withName(name_.Replace('/', '_')) .withBindAddress(Address.address) .withPort(Address.port) + .withGroups(groups_) .withMaxHeap("1g"); if (cluster_.UseSSL) { diff --git a/clicache/integration-test2/Gfsh.cs b/clicache/integration-test2/Gfsh.cs index 826c1fda3e..8f993ebaa8 100644 --- a/clicache/integration-test2/Gfsh.cs +++ b/clicache/integration-test2/Gfsh.cs @@ -80,7 +80,13 @@ public Server withDir(string dir) return this; } - public Server withBindAddress(string bindAddress) + public Server withGroups(string groups) + { + command_ += " --group=" + groups; + return this; + } + + public Server withBindAddress(string bindAddress) { command_ += " --bind-address=" + bindAddress; return this; From d4ca457ba654de0e108780628180da4b836c34ed Mon Sep 17 00:00:00 2001 From: Mike Martell Date: Wed, 6 Apr 2022 21:06:18 -0700 Subject: [PATCH 2/2] Add groups support to existing StartServerStringsTest --- clicache/integration-test2/GfshTest.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/clicache/integration-test2/GfshTest.cs b/clicache/integration-test2/GfshTest.cs index 819bf081f6..53ffa0cf5c 100644 --- a/clicache/integration-test2/GfshTest.cs +++ b/clicache/integration-test2/GfshTest.cs @@ -113,13 +113,15 @@ public void StartServerStringsTest() .withSslKeyStore("some/path/keystore.jks") .withSslKeyStorePassword("password1") .withSslTrustStore("some/path/truststore.jks") - .withSslTrustStorePassword("password2"); + .withSslTrustStorePassword("password2") + .withGroups("GroupA,GroupB"); s = server.ToString(); Assert.Equal("start server --name=server " + "--dir=someDir --bind-address=someAddress --server-port=1234 --locators=someLocator --log-level=debug " + "--max-heap=1.21gigabytes --J=-Dgemfire.ssl-enabled-components=server,locator,jmx " + "--J=-Dgemfire.ssl-keystore=some/path/keystore.jks --J=-Dgemfire.ssl-keystore-password=password1 " + - "--J=-Dgemfire.ssl-truststore=some/path/truststore.jks --J=-Dgemfire.ssl-truststore-password=password2", s); + "--J=-Dgemfire.ssl-truststore=some/path/truststore.jks --J=-Dgemfire.ssl-truststore-password=password2 " + + "--groups=GroupA,GroupB", s); } [Fact]