You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by nn...@apache.org on 2022/01/27 17:55:35 UTC
[geode] branch support/1.15 updated (73026a0 -> 0271f6a)
This is an automated email from the ASF dual-hosted git repository.
nnag pushed a change to branch support/1.15
in repository https://gitbox.apache.org/repos/asf/geode.git.
from 73026a0 remove stray markdown file (#7314)
new 3cb8cff GEODE-6751: Improved the tests for locator-gfsh compatibility (#7289)
new 0271f6a GEODE-8616: Refactoring the test to remove deprecated APIs (#7301)
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../cli/commands/ConnectCommandUpgradeTest.java | 57 ++++++++--
.../ClientServerCacheOperationDUnitTest.java | 123 +++++++++------------
2 files changed, 100 insertions(+), 80 deletions(-)
[geode] 01/02: GEODE-6751: Improved the tests for locator-gfsh compatibility (#7289)
Posted by nn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
nnag pushed a commit to branch support/1.15
in repository https://gitbox.apache.org/repos/asf/geode.git
commit 3cb8cff3d8222f8706f47771406e746ddb9b4995
Author: Nabarun Nag <na...@users.noreply.github.com>
AuthorDate: Mon Jan 24 17:19:49 2022 -0800
GEODE-6751: Improved the tests for locator-gfsh compatibility (#7289)
* Previously the tests only checked with 1.3.0 version of locator
* The test now checks the behavior of the all the versions
* New version gfsh could not connect with locators versions below 1.10.0
* New version gfsh are now able to connect with locators 1.10.0 and above.
* This is now reflected in the test.
* Previously a race condition between the execution of the two scripts caused the second script to be executed before the locator startup had completed.
* Now the locator is started using the cluster startup rule.
(cherry picked from commit 085b616dab895cdaa9f61f796405b11af82ffd80)
---
.../cli/commands/ConnectCommandUpgradeTest.java | 57 +++++++++++++++++-----
1 file changed, 46 insertions(+), 11 deletions(-)
diff --git a/geode-assembly/src/upgradeTest/java/org/apache/geode/management/internal/cli/commands/ConnectCommandUpgradeTest.java b/geode-assembly/src/upgradeTest/java/org/apache/geode/management/internal/cli/commands/ConnectCommandUpgradeTest.java
index 98b0551..d99b86a 100644
--- a/geode-assembly/src/upgradeTest/java/org/apache/geode/management/internal/cli/commands/ConnectCommandUpgradeTest.java
+++ b/geode-assembly/src/upgradeTest/java/org/apache/geode/management/internal/cli/commands/ConnectCommandUpgradeTest.java
@@ -19,22 +19,44 @@ package org.apache.geode.management.internal.cli.commands;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assume.assumeFalse;
+import java.util.Collection;
+import java.util.List;
+
import org.apache.commons.lang3.JavaVersion;
import org.apache.commons.lang3.SystemUtils;
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.apache.geode.test.dunit.rules.ClusterStartupRule;
+import org.apache.geode.test.dunit.rules.MemberVM;
import org.apache.geode.test.junit.categories.GfshTest;
import org.apache.geode.test.junit.rules.gfsh.GfshExecution;
import org.apache.geode.test.junit.rules.gfsh.GfshRule;
import org.apache.geode.test.junit.rules.gfsh.GfshScript;
+import org.apache.geode.test.version.TestVersion;
+import org.apache.geode.test.version.VersionManager;
@Category(GfshTest.class)
+@RunWith(Parameterized.class)
public class ConnectCommandUpgradeTest {
+ private String oldVersion;
+
+ public ConnectCommandUpgradeTest(String oldVersion) {
+ this.oldVersion = oldVersion;
+ }
+
+ @Parameterized.Parameters(name = "Locator Version: {0}")
+ public static Collection<String> data() {
+ List<String> result = VersionManager.getInstance().getVersionsWithoutCurrent();
+ return result;
+ }
+
@Rule
- public GfshRule gfsh130 = new GfshRule("1.3.0");
+ public ClusterStartupRule clusterStartupRule = new ClusterStartupRule();
@Rule
public GfshRule gfshDefault = new GfshRule();
@@ -45,22 +67,35 @@ public class ConnectCommandUpgradeTest {
"this test can only be run with pre-9 jdk since it needs to run older version of gfsh",
SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_9));
- GfshScript
- .of("start locator")
- .execute(gfsh130);
+ MemberVM oldVersionLocator = clusterStartupRule.startLocatorVM(0, oldVersion);
- GfshExecution connect = GfshScript
- .of("connect")
- .expectFailure()
- .execute(gfshDefault);
+ if (TestVersion.compare(oldVersion, "1.10.0") < 0) { // New version gfsh could not connect to
+ // locators with version below 1.10.0
+ GfshExecution connect = GfshScript
+ .of("connect --locator=localhost[" + oldVersionLocator.getPort() + "]")
+ .expectFailure()
+ .execute(gfshDefault);
- assertThat(connect.getOutputText())
- .contains("Cannot use a")
- .contains("gfsh client to connect to this cluster.");
+ assertThat(connect.getOutputText())
+ .contains("Cannot use a")
+ .contains("gfsh client to connect to")
+ .contains("cluster.");
+
+ } else { // From 1.10.0 new version gfsh are able to connect to old version locators
+ GfshExecution connect = GfshScript
+ .of("connect --locator=localhost[" + oldVersionLocator.getPort() + "]")
+ .expectExitCode(0)
+ .execute(gfshDefault);
+
+ assertThat(connect.getOutputText())
+ .contains("Successfully connected to:");
+ }
}
@Test
public void invalidHostname() {
+ MemberVM oldVersionLocator = clusterStartupRule.startLocatorVM(0, oldVersion);
+
GfshExecution connect = GfshScript
.of("connect --locator=\"invalid host name[52326]\"")
.expectFailure()
[geode] 02/02: GEODE-8616: Refactoring the test to remove deprecated APIs (#7301)
Posted by nn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
nnag pushed a commit to branch support/1.15
in repository https://gitbox.apache.org/repos/asf/geode.git
commit 0271f6a60d230f4a1eb077a73d9406099377d469
Author: Nabarun Nag <na...@users.noreply.github.com>
AuthorDate: Tue Jan 25 09:33:33 2022 -0800
GEODE-8616: Refactoring the test to remove deprecated APIs (#7301)
* Re-enabling the windows test.
* Refactored to remove the deprecated APIs
(cherry picked from commit 6579b01dbfe2f7e15aaf05a4c712fcaf27498239)
---
.../ClientServerCacheOperationDUnitTest.java | 123 +++++++++------------
1 file changed, 54 insertions(+), 69 deletions(-)
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/cache30/ClientServerCacheOperationDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/cache30/ClientServerCacheOperationDUnitTest.java
index df332e6..26c2477 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/cache30/ClientServerCacheOperationDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/cache30/ClientServerCacheOperationDUnitTest.java
@@ -18,12 +18,10 @@ import static org.apache.geode.cache.RegionShortcut.REPLICATE;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
-import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@@ -34,65 +32,56 @@ import org.apache.geode.cache.client.ClientRegionShortcut;
import org.apache.geode.cache.client.Pool;
import org.apache.geode.cache.client.PoolManager;
import org.apache.geode.cache.client.ServerConnectivityException;
-import org.apache.geode.cache.server.CacheServer;
-import org.apache.geode.test.dunit.DistributedTestUtils;
-import org.apache.geode.test.dunit.VM;
-import org.apache.geode.test.dunit.rules.CacheRule;
-import org.apache.geode.test.dunit.rules.ClientCacheRule;
-import org.apache.geode.test.dunit.rules.DistributedRule;
+import org.apache.geode.test.dunit.rules.ClientVM;
+import org.apache.geode.test.dunit.rules.ClusterStartupRule;
+import org.apache.geode.test.dunit.rules.MemberVM;
import org.apache.geode.test.junit.categories.ClientServerTest;
-import org.apache.geode.test.junit.rules.IgnoreOnWindowsRule;
@Category({ClientServerTest.class})
public class ClientServerCacheOperationDUnitTest implements Serializable {
- // The tests in this class fail consistently on Windows. They fail intermittently on Linux.
- // When the intermittent failure on Linux is fixed, perhaps this rule can be removed.
- @ClassRule
- public static IgnoreOnWindowsRule ignoreOnWindows = new IgnoreOnWindowsRule();
- private String regionName = "CsTestRegion";
+ private final String regionName = "CsTestRegion";
@Rule
- public DistributedRule distributedRule = new DistributedRule();
-
- @Rule
- public CacheRule cacheRule = new CacheRule();
-
- @Rule
- public ClientCacheRule clientCacheRule = new ClientCacheRule();
+ public ClusterStartupRule clusterStartupRule = new ClusterStartupRule();
@Test
- public void largeObjectPutWithReadTimeoutThrowsException() {
- VM server1 = VM.getVM(0);
- VM server2 = VM.getVM(1);
- VM client = VM.getVM(2);
-
+ public void largeObjectPutWithReadTimeoutThrowsException() throws Exception {
+ MemberVM locator = clusterStartupRule.startLocatorVM(0);
+ int locatorPort = locator.getPort();
+ MemberVM server1 =
+ clusterStartupRule.startServerVM(1, s -> s.withConnectionToLocator(locatorPort));
+ MemberVM server2 =
+ clusterStartupRule.startServerVM(2, s -> s.withConnectionToLocator(locatorPort));
+ ClientVM client1 =
+ clusterStartupRule.startClientVM(3,
+ c -> c.withLocatorConnection(locatorPort).withPoolSubscription(true));
+
+ ClientVM client2 =
+ clusterStartupRule.startClientVM(4,
+ c -> c.withLocatorConnection(locatorPort).withPoolSubscription(true));
final int byteSize = 40 * 1000 * 1000;
final int listSize = 2;
- final int locatorPort = DistributedTestUtils.getLocatorPort();
-
- server1.invoke(() -> createServerCache());
- server2.invoke(() -> createServerCache());
server1.invoke(() -> {
- RegionFactory<?, ?> regionFactory = cacheRule.getCache().createRegionFactory(REPLICATE);
+ RegionFactory<?, ?> regionFactory =
+ ClusterStartupRule.getCache().createRegionFactory(REPLICATE);
regionFactory.create(regionName);
});
server2.invoke(() -> {
- RegionFactory<?, ?> regionFactory = cacheRule.getCache().createRegionFactory(REPLICATE);
+ RegionFactory<?, ?> regionFactory =
+ ClusterStartupRule.getCache().createRegionFactory(REPLICATE);
regionFactory.create(regionName);
});
- List<byte[]> list = new ArrayList(listSize);
+ List<byte[]> list = new ArrayList<byte[]>(listSize);
for (int i = 0; i < listSize; i++) {
list.add(new byte[byteSize]);
}
- client.invoke(() -> {
- clientCacheRule.createClientCache();
-
+ client1.invoke(() -> {
Pool pool = PoolManager.createFactory()
.addLocator("localhost", locatorPort)
.setSocketBufferSize(50)
@@ -102,62 +91,66 @@ public class ClientServerCacheOperationDUnitTest implements Serializable {
.setServerConnectionTimeout(50)
.create("testPool");
- Region region = clientCacheRule.getClientCache()
+ Region<Object, Object> region = ClusterStartupRule.getClientCache()
.createClientRegionFactory(ClientRegionShortcut.PROXY)
.setPoolName(pool.getName())
.create(regionName);
-
assertThatThrownBy(() -> region.put("key", list))
.isInstanceOf(ServerConnectivityException.class);
});
server1.invoke(() -> {
- Region region = cacheRule.getCache().getRegion(regionName);
- List value = (List) region.get("key");
+ Region<?, ?> region = ClusterStartupRule.getCache().getRegion(regionName);
+ List<?> value = (List<?>) region.get("key");
if (value != null) {
assertThat(value.size()).isEqualTo(listSize);
list.forEach((b) -> assertThat(b.length).isEqualTo(byteSize));
}
});
- client.invoke(() -> {
- Region region = clientCacheRule.getClientCache().getRegion(regionName);
+ client2.invoke(() -> {
+ Region<Object, Object> region = ClusterStartupRule.getClientCache()
+ .createClientRegionFactory(ClientRegionShortcut.PROXY)
+ .create(regionName);
assertThat(region.size()).isEqualTo(0);
- List value = (List) region.get("key");
+ List<?> value = (List<?>) region.get("key");
if (value != null) {
assertThat(value.size()).isEqualTo(listSize);
list.forEach((b) -> assertThat(b.length).isEqualTo(byteSize));
}
});
-
}
@Test
- public void largeObjectGetWithReadTimeout() {
- VM server1 = VM.getVM(0);
- VM server2 = VM.getVM(1);
- VM server3 = VM.getVM(2);
- VM client = VM.getVM(3);
-
- final int locatorPort = DistributedTestUtils.getLocatorPort();
-
- server1.invoke(() -> createServerCache());
- server2.invoke(() -> createServerCache());
- server3.invoke(() -> createServerCache());
+ public void largeObjectGetWithReadTimeout() throws Exception {
+ MemberVM locator = clusterStartupRule.startLocatorVM(0);
+ int locatorPort = locator.getPort();
+ MemberVM server1 =
+ clusterStartupRule.startServerVM(1, s -> s.withConnectionToLocator(locatorPort));
+ MemberVM server2 =
+ clusterStartupRule.startServerVM(2, s -> s.withConnectionToLocator(locatorPort));
+ MemberVM server3 =
+ clusterStartupRule.startServerVM(3, s -> s.withConnectionToLocator(locatorPort));
+ ClientVM client =
+ clusterStartupRule.startClientVM(4,
+ c -> c.withLocatorConnection(locatorPort).withPoolSubscription(true));
server1.invoke(() -> {
- RegionFactory<?, ?> regionFactory = cacheRule.getCache().createRegionFactory(REPLICATE);
+ RegionFactory<?, ?> regionFactory =
+ ClusterStartupRule.getCache().createRegionFactory(REPLICATE);
regionFactory.create(regionName);
});
server2.invoke(() -> {
- RegionFactory<?, ?> regionFactory = cacheRule.getCache().createRegionFactory(REPLICATE);
+ RegionFactory<?, ?> regionFactory =
+ ClusterStartupRule.getCache().createRegionFactory(REPLICATE);
regionFactory.create(regionName);
});
server3.invoke(() -> {
- RegionFactory<?, ?> regionFactory = cacheRule.getCache().createRegionFactory(REPLICATE);
+ RegionFactory<?, ?> regionFactory =
+ ClusterStartupRule.getCache().createRegionFactory(REPLICATE);
Region region = regionFactory.create(regionName);
int listSize = 2;
@@ -171,21 +164,21 @@ public class ClientServerCacheOperationDUnitTest implements Serializable {
});
server1.invoke(() -> {
- Region region = cacheRule.getCache().getRegion(regionName);
+ Region region = ClusterStartupRule.getCache().getRegion(regionName);
assertThat(region.size()).isEqualTo(1);
});
client.invoke(() -> {
- clientCacheRule.createClientCache();
Pool pool = PoolManager.createFactory()
.addLocator("localhost", locatorPort)
.setSocketBufferSize(100)
.setReadTimeout(50)
+ .setRetryAttempts(4)
.create("testPool");
- Region region = clientCacheRule.getClientCache()
+ Region region = ClusterStartupRule.getClientCache()
.createClientRegionFactory(ClientRegionShortcut.PROXY)
.setPoolName(pool.getName())
.create(regionName);
@@ -199,12 +192,4 @@ public class ClientServerCacheOperationDUnitTest implements Serializable {
});
}
-
- private void createServerCache() throws IOException {
- cacheRule.createCache();
- CacheServer cacheServer = cacheRule.getCache().addCacheServer();
- cacheServer.setPort(0);
- cacheServer.start();
- }
-
}