geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kh...@apache.org
Subject [geode] 01/03: GEODE-3539: Add tests for 'alter runtime'
Date Mon, 02 Oct 2017 14:38:14 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit bee0afb2f9618f8b0ba4d431058205a5e5140bc7
Author: Ken Howe <khowe@pivotal.io>
AuthorDate: Thu Sep 28 11:13:42 2017 -0700

    GEODE-3539: Add tests for 'alter runtime'
---
 ...DUnitTest.java => ConfigCommandsDUnitTest.java} | 151 ++++++++++++++++++++-
 1 file changed, 144 insertions(+), 7 deletions(-)

diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ConfigCommandDUnitTest.java
b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ConfigCommandsDUnitTest.java
similarity index 72%
rename from geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ConfigCommandDUnitTest.java
rename to geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ConfigCommandsDUnitTest.java
index e5ee428..94933b9 100644
--- a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ConfigCommandDUnitTest.java
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ConfigCommandsDUnitTest.java
@@ -52,7 +52,7 @@ import org.apache.geode.test.junit.categories.DistributedTest;
 
 @Category(DistributedTest.class)
 @RunWith(JUnitParamsRunner.class)
-public class ConfigCommandDUnitTest {
+public class ConfigCommandsDUnitTest {
   @Rule
   public LocatorServerStartupRule startupRule =
       new LocatorServerStartupRule().withTempWorkingDir().withLogFile();
@@ -222,8 +222,8 @@ public class ConfigCommandDUnitTest {
     Properties props = new Properties();
     props.setProperty(LOG_LEVEL, "error");
     MemberVM locator = startupRule.startLocatorVM(0, props);
-    MemberVM server1 = startupRule.startServerVM(1, locator.getPort());
-    MemberVM server2 = startupRule.startServerVM(2, locator.getPort());
+    MemberVM server1 = startupRule.startServerVM(1, props, locator.getPort());
+    MemberVM server2 = startupRule.startServerVM(2, props, locator.getPort());
 
     if (connectOverHttp) {
       gfsh.connectAndVerify(locator.getHttpPort(), GfshShellConnectionRule.PortType.http);
@@ -267,8 +267,8 @@ public class ConfigCommandDUnitTest {
     Properties props = new Properties();
     props.setProperty(LOG_LEVEL, "error");
     MemberVM locator = startupRule.startLocatorVM(0, props);
-    MemberVM server1 = startupRule.startServerVM(1, locator.getPort());
-    MemberVM server2 = startupRule.startServerVM(2, locator.getPort());
+    MemberVM server1 = startupRule.startServerVM(1, props, locator.getPort());
+    MemberVM server2 = startupRule.startServerVM(2, props, locator.getPort());
 
     if (connectOverHttp) {
       gfsh.connectAndVerify(locator.getHttpPort(), GfshShellConnectionRule.PortType.http);
@@ -326,8 +326,8 @@ public class ConfigCommandDUnitTest {
     Properties props = new Properties();
     props.setProperty(LOG_LEVEL, "error");
     MemberVM locator = startupRule.startLocatorVM(0, props);
-    MemberVM server1 = startupRule.startServerVM(1, locator.getPort());
-    MemberVM server2 = startupRule.startServerVM(2, locator.getPort());
+    MemberVM server1 = startupRule.startServerVM(1, props, locator.getPort());
+    MemberVM server2 = startupRule.startServerVM(2, props, locator.getPort());
 
     if (connectOverHttp) {
       gfsh.connectAndVerify(locator.getHttpPort(), GfshShellConnectionRule.PortType.http);
@@ -366,6 +366,143 @@ public class ConfigCommandDUnitTest {
 
   @Test
   @Parameters({"true", "false"})
+  public void alterRuntimeConfig_logDiskSpaceLimitOnGroup_OK(final boolean connectOverHttp)
+      throws Exception {
+
+    Properties props = new Properties();
+    props.setProperty(LOG_LEVEL, "error");
+    MemberVM locator = startupRule.startLocatorVM(0, props);
+    MemberVM server1 = startupRule.startServerVM(1, props, locator.getPort());
+    props.setProperty(GROUPS, "G1");
+    MemberVM server2 = startupRule.startServerVM(2, props, locator.getPort());
+
+    if (connectOverHttp) {
+      gfsh.connectAndVerify(locator.getHttpPort(), GfshShellConnectionRule.PortType.http);
+    } else {
+      gfsh.connectAndVerify(locator.getJmxPort(), GfshShellConnectionRule.PortType.jmxManger);
+    }
+
+    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.ALTER_RUNTIME_CONFIG);
+    csb.addOption(CliStrings.GROUPS, "G1");
+    csb.addOption(CliStrings.ALTER_RUNTIME_CONFIG__LOG__DISK__SPACE__LIMIT, "10");
+
+    gfsh.executeAndVerifyCommand(csb.toString());
+    String resultStr = gfsh.getGfshOutput();
+
+    server1.invoke(() -> {
+      InternalCache cache = LocatorServerStartupRule.serverStarter.getCache();
+      DistributionConfig config = cache.getInternalDistributedSystem().getConfig();
+      assertThat(config.getGroups()).isEqualTo("");
+      assertThat(config.getLogFileSizeLimit()).isEqualTo(0);
+      assertThat(config.getLogDiskSpaceLimit()).isEqualTo(0);
+      assertThat(config.getArchiveDiskSpaceLimit()).isEqualTo(0);
+      assertThat(config.getStatisticSampleRate()).isEqualTo(1000);
+      assertThat(config.getStatisticArchiveFile().getName()).isEqualTo("");
+      assertThat(config.getStatisticSamplingEnabled()).isTrue();
+    });
+    server2.invoke(() -> {
+      InternalCache cache = LocatorServerStartupRule.serverStarter.getCache();
+      DistributionConfig config = cache.getInternalDistributedSystem().getConfig();
+      assertThat(config.getGroups()).isEqualTo("G1");
+      assertThat(config.getLogFileSizeLimit()).isEqualTo(0);
+      assertThat(config.getLogDiskSpaceLimit()).isEqualTo(10);
+      assertThat(config.getArchiveDiskSpaceLimit()).isEqualTo(0);
+      assertThat(config.getStatisticSampleRate()).isEqualTo(1000);
+      assertThat(config.getStatisticArchiveFile().getName()).isEqualTo("");
+      assertThat(config.getStatisticSamplingEnabled()).isTrue();
+    });
+  }
+
+  /**
+   * Test to verify that when 'alter runtime' without relevant options does not change the
server's
+   * configuration
+   */
+  @Test
+  @Parameters({"true", "false"})
+  public void alterRuntimeConfig_groupWithoutOptions_needsRelevantParameter(
+      final boolean connectOverHttp) throws Exception {
+
+    Properties props = new Properties();
+    props.setProperty(LOG_LEVEL, "error");
+    MemberVM locator = startupRule.startLocatorVM(0, props);
+    MemberVM server1 = startupRule.startServerVM(1, props, locator.getPort());
+    props.setProperty(GROUPS, "G1");
+    MemberVM server2 = startupRule.startServerVM(2, props, locator.getPort());
+
+    if (connectOverHttp) {
+      gfsh.connectAndVerify(locator.getHttpPort(), GfshShellConnectionRule.PortType.http);
+    } else {
+      gfsh.connectAndVerify(locator.getJmxPort(), GfshShellConnectionRule.PortType.jmxManger);
+    }
+
+    server2.invoke(() -> {
+      InternalCache cache = LocatorServerStartupRule.serverStarter.getCache();
+      DistributionConfig config = cache.getInternalDistributedSystem().getConfig();
+      assertThat(config.getGroups()).isEqualTo("G1");
+    });
+
+    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.ALTER_RUNTIME_CONFIG);
+    csb.addOption(CliStrings.GROUPS, "G1");
+
+    CommandResult result = gfsh.executeCommand(csb.toString());
+    assertThat(result.getStatus()).isEqualTo(Result.Status.ERROR);
+    assertThat(gfsh.getGfshOutput())
+        .contains(CliStrings.ALTER_RUNTIME_CONFIG__RELEVANT__OPTION__MESSAGE);
+
+    server1.invoke(() -> {
+      InternalCache cache = LocatorServerStartupRule.serverStarter.getCache();
+      DistributionConfig config = cache.getInternalDistributedSystem().getConfig();
+      assertThat(config.getLogFileSizeLimit()).isEqualTo(0);
+      assertThat(config.getLogDiskSpaceLimit()).isEqualTo(0);
+      assertThat(config.getArchiveDiskSpaceLimit()).isEqualTo(0);
+      assertThat(config.getStatisticSampleRate()).isEqualTo(1000);
+      assertThat(config.getStatisticArchiveFile().getName()).isEqualTo("");
+      assertThat(config.getStatisticSamplingEnabled()).isTrue();
+    });
+  }
+
+  /**
+   * Test to verify that when 'alter runtime' without relevant options does not change the
server's
+   * configuration
+   */
+  @Test
+  @Parameters({"true", "false"})
+  public void alterRuntimeConfig_memberWithoutOptions_needsRelevantParameter(
+      final boolean connectOverHttp) throws Exception {
+
+    Properties props = new Properties();
+    props.setProperty(LOG_LEVEL, "error");
+    MemberVM locator = startupRule.startLocatorVM(0, props);
+    MemberVM server1 = startupRule.startServerVM(1, props, locator.getPort());
+
+    if (connectOverHttp) {
+      gfsh.connectAndVerify(locator.getHttpPort(), GfshShellConnectionRule.PortType.http);
+    } else {
+      gfsh.connectAndVerify(locator.getJmxPort(), GfshShellConnectionRule.PortType.jmxManger);
+    }
+
+    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.ALTER_RUNTIME_CONFIG);
+    csb.addOption(CliStrings.MEMBERS, server1.getName());
+
+    CommandResult result = gfsh.executeCommand(csb.toString());
+    assertThat(result.getStatus()).isEqualTo(Result.Status.ERROR);
+    assertThat(gfsh.getGfshOutput())
+        .contains(CliStrings.ALTER_RUNTIME_CONFIG__RELEVANT__OPTION__MESSAGE);
+
+    server1.invoke(() -> {
+      InternalCache cache = LocatorServerStartupRule.serverStarter.getCache();
+      DistributionConfig config = cache.getInternalDistributedSystem().getConfig();
+      assertThat(config.getLogFileSizeLimit()).isEqualTo(0);
+      assertThat(config.getLogDiskSpaceLimit()).isEqualTo(0);
+      assertThat(config.getArchiveDiskSpaceLimit()).isEqualTo(0);
+      assertThat(config.getStatisticSampleRate()).isEqualTo(1000);
+      assertThat(config.getStatisticArchiveFile().getName()).isEqualTo("");
+      assertThat(config.getStatisticSamplingEnabled()).isTrue();
+    });
+  }
+
+  @Test
+  @Parameters({"true", "false"})
   public void testAlterUpdatesSharedConfig(final boolean connectOverHttp) throws Exception
{
     MemberVM locator = startupRule.startLocatorVM(0);
 

-- 
To stop receiving notification emails like this one, please contact
"commits@geode.apache.org" <commits@geode.apache.org>.

Mime
View raw message