This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch sni in repository https://gitbox.apache.org/repos/asf/geode-benchmarks.git
The following commit(s) were added to refs/heads/sni by this push: new d109aa7 make withSniProxy option work across all benchmarks d109aa7 is described below commit d109aa769cee6679241ae915f11e141576116a3c Author: Bill Burcham <bburc...@pivotal.io> AuthorDate: Thu Jun 4 09:57:40 2020 -0700 make withSniProxy option work across all benchmarks --- README.md | 7 +-- .../geode/benchmark/tasks/StartSniProxy.java | 17 ++++++ .../benchmark/tests/AbstractFunctionBenchmark.java | 1 - .../geode/benchmark/tests/GeodeBenchmark.java | 22 ++++++-- .../geode/benchmark/tests/NoopBenchmark.java | 1 - .../benchmark/tests/PartitionedGetBenchmark.java | 1 - .../tests/PartitionedGetLongBenchmark.java | 1 - .../tests/PartitionedIndexedQueryBenchmark.java | 1 - .../tests/PartitionedNonIndexedQueryBenchmark.java | 1 - .../tests/PartitionedPutAllBenchmark.java | 1 - .../tests/PartitionedPutAllLongBenchmark.java | 1 - .../benchmark/tests/PartitionedPutBenchmark.java | 9 --- .../tests/PartitionedPutLongBenchmark.java | 1 - .../benchmark/tests/ReplicatedGetBenchmark.java | 1 - .../tests/ReplicatedGetLongBenchmark.java | 1 - .../tests/ReplicatedIndexedQueryBenchmark.java | 1 - .../tests/ReplicatedNonIndexedQueryBenchmark.java | 1 - .../benchmark/tests/ReplicatedPutAllBenchmark.java | 1 - .../tests/ReplicatedPutAllLongBenchmark.java | 1 - .../benchmark/tests/ReplicatedPutBenchmark.java | 1 - .../tests/ReplicatedPutLongBenchmark.java | 1 - .../geode/benchmark/tests/GeodeBenchmarkTest.java | 64 ++++++++++++++++++++++ .../main/java/org/apache/geode/perftest/Task.java | 3 + .../java/org/apache/geode/perftest/TestConfig.java | 20 ------- .../java/org/apache/geode/perftest/TestStep.java | 45 +++++++++++++++ .../geode/perftest/runner/DefaultTestRunner.java | 3 +- 26 files changed, 151 insertions(+), 56 deletions(-) diff --git a/README.md b/README.md index d34f747..856763d 100644 --- a/README.md +++ b/README.md @@ -165,9 +165,8 @@ Also we have to provide `-DwithSsl=true` for an SNI test even though no SNI test * ~~turn on SNI via `setPoolSocketFactory` in a new `StartClientSNI` task~~ * ~~set `--hostname-for-clients` on locator and servers for SNI~~ * ~~reinstate thread-per-core in `PrePopulateRegion.run()` and in `PartitionedPutBenchmark[SNI]` ya~~ -* set `keyRange` back to 1e6 in `PartitionedPutBenchmark[SNI]` after client-server connections are healthy -* make topology orthogonal to tests so all tests can run with SNI; have a `-Psni`/`-Dsni` flag -* fix borken `PartitionedPutBenchmarkSNITest`: `DefineHostNamingsOffPlatformTask` breaks when running multiple roles on a single host +* ~~set `keyRange` back to 1e6 in `PartitionedPutBenchmark[SNI]` after client-server connections are healthy~~ +* ~~make topology orthogonal to tests so all tests can run with SNI; have a `-PwithSniProxy`/`-DwithSniProxy=true` flag~~ ## TODO (General) * need to clean up locator.dat files before running a locator on a node @@ -175,5 +174,5 @@ Also we have to provide `-DwithSsl=true` for an SNI test even though no SNI test * move `docker-compose.yml` distribution out of `harness` module up into `geode-benchmarks` so it gets distributed whenever it changes (without requiring rebuilding AWS AMI and cluster on AWS) * generate 2048-bit keys (instead of 1024-bit ones) for TLS; will slow TLS handshakes which may necessitate a new baseline * make `StartServer` task use `ServerLauncher` (instead of `CacheFactory`) for symmetry with `LocatorLauncher`—also too: encapsulation! -* `./run_tests.sh` often seems to hang after benchmarks have completed, requiring operator to enter ^C to un-stick it +* `./run_tests.sh` sometimes seems to hang after benchmarks have completed, requiring operator to enter ^C to un-stick it * make `rsync:` Git "scheme" work in `run_tests.sh` script for benchmark repo (not just for geode repo) diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/StartSniProxy.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/StartSniProxy.java index 16e93dc..18353c3 100644 --- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/StartSniProxy.java +++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/StartSniProxy.java @@ -28,6 +28,7 @@ import java.io.IOException; import java.net.InetAddress; import java.util.Iterator; import java.util.Map; +import java.util.Objects; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -159,4 +160,20 @@ public class StartSniProxy implements Task { } } + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final StartSniProxy that = (StartSniProxy) o; + return locatorPort == that.locatorPort; + } + + @Override + public int hashCode() { + return Objects.hash(locatorPort); + } } diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/AbstractFunctionBenchmark.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/AbstractFunctionBenchmark.java index e597179..d8f8fd7 100644 --- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/AbstractFunctionBenchmark.java +++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/AbstractFunctionBenchmark.java @@ -44,7 +44,6 @@ abstract class AbstractFunctionBenchmark implements PerformanceTest { public TestConfig configure() { TestConfig config = GeodeBenchmark.createConfig(); config.threads(Runtime.getRuntime().availableProcessors() * 3); - ClientServerTopology.configure(config); configureRegion(config); before(config, new CreateClientProxyRegion(), CLIENT); before(config, new PrePopulateRegion(getKeyRange()), CLIENT); diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/GeodeBenchmark.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/GeodeBenchmark.java index 7551eec..bf7d426 100644 --- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/GeodeBenchmark.java +++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/GeodeBenchmark.java @@ -17,6 +17,8 @@ package org.apache.geode.benchmark.tests; import static java.util.concurrent.TimeUnit.MINUTES; +import org.apache.geode.benchmark.topology.ClientServerTopology; +import org.apache.geode.benchmark.topology.ClientServerTopologyWithSNIProxy; import org.apache.geode.perftest.TestConfig; public class GeodeBenchmark { @@ -38,11 +40,21 @@ public class GeodeBenchmark { public static TestConfig createConfig() { - TestConfig testConfig = new TestConfig(); - testConfig.warmupSeconds(WARM_UP_TIME); - testConfig.durationSeconds(BENCHMARK_DURATION); - testConfig.threads(THREADS); - return testConfig; + TestConfig config = new TestConfig(); + config.warmupSeconds(WARM_UP_TIME); + config.durationSeconds(BENCHMARK_DURATION); + config.threads(THREADS); + + final String sniProp = System.getProperty("withSniProxy"); + final boolean doSni = sniProp != null && !sniProp.equals("false"); + + if (doSni) { + ClientServerTopologyWithSNIProxy.configure(config); + } else { + ClientServerTopology.configure(config); + } + + return config; } } diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/NoopBenchmark.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/NoopBenchmark.java index 3bacdb0..54bc0ac 100644 --- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/NoopBenchmark.java +++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/NoopBenchmark.java @@ -44,7 +44,6 @@ public class NoopBenchmark implements PerformanceTest { @Override public TestConfig configure() { TestConfig config = GeodeBenchmark.createConfig(); - ClientServerTopology.configure(config); workload(config, new NoopTask(), CLIENT); return config; diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedGetBenchmark.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedGetBenchmark.java index 6ed6b4d..e7432b0 100644 --- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedGetBenchmark.java +++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedGetBenchmark.java @@ -56,7 +56,6 @@ public class PartitionedGetBenchmark implements PerformanceTest { @Override public TestConfig configure() { TestConfig config = GeodeBenchmark.createConfig(); - ClientServerTopology.configure(config); before(config, new CreatePartitionedRegion(), SERVER); before(config, new CreateClientProxyRegion(), CLIENT); before(config, new PrePopulateRegion(keyRange), CLIENT); diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedGetLongBenchmark.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedGetLongBenchmark.java index bed35fa..f02c1e7 100644 --- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedGetLongBenchmark.java +++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedGetLongBenchmark.java @@ -56,7 +56,6 @@ public class PartitionedGetLongBenchmark implements PerformanceTest { @Override public TestConfig configure() { TestConfig config = GeodeBenchmark.createConfig(); - ClientServerTopology.configure(config); before(config, new CreatePartitionedRegion(), SERVER); before(config, new CreateClientProxyRegion(), CLIENT); before(config, new PrePopulateRegionLong(keyRange), CLIENT); diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedIndexedQueryBenchmark.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedIndexedQueryBenchmark.java index 886df2c..97043c8 100644 --- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedIndexedQueryBenchmark.java +++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedIndexedQueryBenchmark.java @@ -55,7 +55,6 @@ public class PartitionedIndexedQueryBenchmark implements PerformanceTest { public TestConfig configure() { TestConfig config = GeodeBenchmark.createConfig(); config.threads(Runtime.getRuntime().availableProcessors() * 8); - ClientServerTopology.configure(config); before(config, new CreatePartitionedRegion(), SERVER); before(config, new CreateClientProxyRegion(), CLIENT); before(config, new CreateIndexOnID(), SERVER); diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedNonIndexedQueryBenchmark.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedNonIndexedQueryBenchmark.java index 75ddfa6..9df06d9 100644 --- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedNonIndexedQueryBenchmark.java +++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedNonIndexedQueryBenchmark.java @@ -54,7 +54,6 @@ public class PartitionedNonIndexedQueryBenchmark implements PerformanceTest { public TestConfig configure() { TestConfig config = GeodeBenchmark.createConfig(); config.threads(Runtime.getRuntime().availableProcessors()); - ClientServerTopology.configure(config); before(config, new CreatePartitionedRegion(), SERVER); before(config, new CreateClientProxyRegion(), CLIENT); before(config, new PrePopulateRegion(keyRange), CLIENT); diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedPutAllBenchmark.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedPutAllBenchmark.java index 605c7b4..e95129c 100644 --- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedPutAllBenchmark.java +++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedPutAllBenchmark.java @@ -58,7 +58,6 @@ public class PartitionedPutAllBenchmark implements PerformanceTest { public TestConfig configure() { TestConfig config = GeodeBenchmark.createConfig(); config.threads(Runtime.getRuntime().availableProcessors() * 2); - ClientServerTopology.configure(config); before(config, new CreatePartitionedRegion(), SERVER); before(config, new CreateClientProxyRegion(), CLIENT); before(config, new PrePopulateRegion(keyRange), CLIENT); diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedPutAllLongBenchmark.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedPutAllLongBenchmark.java index 3025b73..80b33d4 100644 --- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedPutAllLongBenchmark.java +++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedPutAllLongBenchmark.java @@ -58,7 +58,6 @@ public class PartitionedPutAllLongBenchmark implements PerformanceTest { public TestConfig configure() { TestConfig config = GeodeBenchmark.createConfig(); config.threads(Runtime.getRuntime().availableProcessors() * 2); - ClientServerTopology.configure(config); before(config, new CreatePartitionedRegion(), SERVER); before(config, new CreateClientProxyRegion(), CLIENT); before(config, new PrePopulateRegionLong(keyRange), CLIENT); diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedPutBenchmark.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedPutBenchmark.java index d50a1ba..1d9b384 100644 --- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedPutBenchmark.java +++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedPutBenchmark.java @@ -57,15 +57,6 @@ public class PartitionedPutBenchmark implements PerformanceTest { public TestConfig configure() { TestConfig config = GeodeBenchmark.createConfig(); - final String sniProp = System.getProperty("withSniProxy"); - final boolean doSni = sniProp != null && !sniProp.equals("false"); - - if (doSni) { - ClientServerTopologyWithSNIProxy.configure(config); - } else { - ClientServerTopology.configure(config); - } - before(config, new CreatePartitionedRegion(), SERVER); before(config, new CreateClientProxyRegion(), CLIENT); before(config, new PrePopulateRegion(keyRange), CLIENT); diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedPutLongBenchmark.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedPutLongBenchmark.java index b3db678..edc455b 100644 --- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedPutLongBenchmark.java +++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedPutLongBenchmark.java @@ -55,7 +55,6 @@ public class PartitionedPutLongBenchmark implements PerformanceTest { @Override public TestConfig configure() { TestConfig config = GeodeBenchmark.createConfig(); - ClientServerTopology.configure(config); before(config, new CreatePartitionedRegion(), SERVER); before(config, new CreateClientProxyRegion(), CLIENT); before(config, new PrePopulateRegionLong(keyRange), CLIENT); diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/ReplicatedGetBenchmark.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/ReplicatedGetBenchmark.java index d3b8f1e..a4c55b1 100644 --- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/ReplicatedGetBenchmark.java +++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/ReplicatedGetBenchmark.java @@ -56,7 +56,6 @@ public class ReplicatedGetBenchmark implements PerformanceTest { @Override public TestConfig configure() { TestConfig config = GeodeBenchmark.createConfig(); - ClientServerTopology.configure(config); before(config, new CreateReplicatedRegion(), SERVER); before(config, new CreateClientProxyRegion(), CLIENT); before(config, new PrePopulateRegion(keyRange), CLIENT); diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/ReplicatedGetLongBenchmark.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/ReplicatedGetLongBenchmark.java index b601428..da62fb7 100644 --- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/ReplicatedGetLongBenchmark.java +++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/ReplicatedGetLongBenchmark.java @@ -56,7 +56,6 @@ public class ReplicatedGetLongBenchmark implements PerformanceTest { @Override public TestConfig configure() { TestConfig config = GeodeBenchmark.createConfig(); - ClientServerTopology.configure(config); before(config, new CreateReplicatedRegion(), SERVER); before(config, new CreateClientProxyRegion(), CLIENT); before(config, new PrePopulateRegionLong(keyRange), CLIENT); diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/ReplicatedIndexedQueryBenchmark.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/ReplicatedIndexedQueryBenchmark.java index 6dcf708..a876a7f 100644 --- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/ReplicatedIndexedQueryBenchmark.java +++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/ReplicatedIndexedQueryBenchmark.java @@ -55,7 +55,6 @@ public class ReplicatedIndexedQueryBenchmark implements PerformanceTest { public TestConfig configure() { TestConfig config = GeodeBenchmark.createConfig(); config.threads(Runtime.getRuntime().availableProcessors() * 8); - ClientServerTopology.configure(config); before(config, new CreateReplicatedRegion(), SERVER); before(config, new CreateClientProxyRegion(), CLIENT); before(config, new CreateIndexOnID(), SERVER); diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/ReplicatedNonIndexedQueryBenchmark.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/ReplicatedNonIndexedQueryBenchmark.java index aa3eabf..e6fe6cb 100644 --- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/ReplicatedNonIndexedQueryBenchmark.java +++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/ReplicatedNonIndexedQueryBenchmark.java @@ -54,7 +54,6 @@ public class ReplicatedNonIndexedQueryBenchmark implements PerformanceTest { public TestConfig configure() { TestConfig config = GeodeBenchmark.createConfig(); config.threads(Runtime.getRuntime().availableProcessors()); - ClientServerTopology.configure(config); before(config, new CreateReplicatedRegion(), SERVER); before(config, new CreateClientProxyRegion(), CLIENT); before(config, new PrePopulateRegion(keyRange), CLIENT); diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/ReplicatedPutAllBenchmark.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/ReplicatedPutAllBenchmark.java index cfcdb8b..b237f25 100644 --- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/ReplicatedPutAllBenchmark.java +++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/ReplicatedPutAllBenchmark.java @@ -58,7 +58,6 @@ public class ReplicatedPutAllBenchmark implements PerformanceTest { public TestConfig configure() { TestConfig config = GeodeBenchmark.createConfig(); config.threads(Runtime.getRuntime().availableProcessors() * 2); - ClientServerTopology.configure(config); before(config, new CreateReplicatedRegion(), SERVER); before(config, new CreateClientProxyRegion(), CLIENT); before(config, new PrePopulateRegion(keyRange), CLIENT); diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/ReplicatedPutAllLongBenchmark.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/ReplicatedPutAllLongBenchmark.java index 965eb61..43ef709 100644 --- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/ReplicatedPutAllLongBenchmark.java +++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/ReplicatedPutAllLongBenchmark.java @@ -58,7 +58,6 @@ public class ReplicatedPutAllLongBenchmark implements PerformanceTest { public TestConfig configure() { TestConfig config = GeodeBenchmark.createConfig(); config.threads(Runtime.getRuntime().availableProcessors() * 2); - ClientServerTopology.configure(config); before(config, new CreateReplicatedRegion(), SERVER); before(config, new CreateClientProxyRegion(), CLIENT); before(config, new PrePopulateRegionLong(keyRange), CLIENT); diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/ReplicatedPutBenchmark.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/ReplicatedPutBenchmark.java index 2cfb71f..6497e68 100644 --- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/ReplicatedPutBenchmark.java +++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/ReplicatedPutBenchmark.java @@ -55,7 +55,6 @@ public class ReplicatedPutBenchmark implements PerformanceTest { @Override public TestConfig configure() { TestConfig config = GeodeBenchmark.createConfig(); - ClientServerTopology.configure(config); before(config, new CreateReplicatedRegion(), SERVER); before(config, new CreateClientProxyRegion(), CLIENT); before(config, new PrePopulateRegion(keyRange), CLIENT); diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/ReplicatedPutLongBenchmark.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/ReplicatedPutLongBenchmark.java index 3248255..9e8c1f3 100644 --- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/ReplicatedPutLongBenchmark.java +++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/ReplicatedPutLongBenchmark.java @@ -55,7 +55,6 @@ public class ReplicatedPutLongBenchmark implements PerformanceTest { @Override public TestConfig configure() { TestConfig config = GeodeBenchmark.createConfig(); - ClientServerTopology.configure(config); before(config, new CreateReplicatedRegion(), SERVER); before(config, new CreateClientProxyRegion(), CLIENT); before(config, new PrePopulateRegionLong(keyRange), CLIENT); diff --git a/geode-benchmarks/src/test/java/org/apache/geode/benchmark/tests/GeodeBenchmarkTest.java b/geode-benchmarks/src/test/java/org/apache/geode/benchmark/tests/GeodeBenchmarkTest.java new file mode 100644 index 0000000..565409d --- /dev/null +++ b/geode-benchmarks/src/test/java/org/apache/geode/benchmark/tests/GeodeBenchmarkTest.java @@ -0,0 +1,64 @@ +package org.apache.geode.benchmark.tests; + +import static org.apache.geode.benchmark.topology.Ports.LOCATOR_PORT; +import static org.apache.geode.benchmark.topology.Roles.PROXY; +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import org.apache.geode.benchmark.tasks.StartSniProxy; +import org.apache.geode.perftest.TestConfig; +import org.apache.geode.perftest.TestStep; + +/** + * Verify that if withSniProxy system property is set at all and if it is set to anything but + * false, that we get an SNI proxy in our topology. If the system property is not set at all, or + * if it is set to (exactly) "false" then we do not get an SNI proxy in our topology. + */ +class GeodeBenchmarkTest { + + private TestConfig config; + private TestStep startProxyStep; + + @BeforeEach + public void beforeEach() { + startProxyStep = + new TestStep(new StartSniProxy(LOCATOR_PORT), new String[]{PROXY.name()}); + } + + @AfterAll + public static void afterAll() { + System.clearProperty("withSniProxy"); + } + + @Test + public void withoutSniProxy() { + System.clearProperty("withSniProxy"); + config = GeodeBenchmark.createConfig(); + assertThat(config.getBefore()).doesNotContain(startProxyStep); + } + + @Test + public void withSniProxyFalse() { + System.setProperty("withSniProxy", "false"); + config = GeodeBenchmark.createConfig(); + assertThat(config.getBefore()).doesNotContain(startProxyStep); + } + + @Test + public void withSniProxyTrue() { + System.setProperty("withSniProxy", "true"); + config = GeodeBenchmark.createConfig(); + assertThat(config.getBefore()).contains(startProxyStep); + } + + @Test + public void withSniProxyNotLowercaseFalse() { + System.setProperty("withSniProxy", "AnythING"); + config = GeodeBenchmark.createConfig(); + assertThat(config.getBefore()).contains(startProxyStep); + } + +} \ No newline at end of file diff --git a/harness/src/main/java/org/apache/geode/perftest/Task.java b/harness/src/main/java/org/apache/geode/perftest/Task.java index a764ae5..2aece9b 100644 --- a/harness/src/main/java/org/apache/geode/perftest/Task.java +++ b/harness/src/main/java/org/apache/geode/perftest/Task.java @@ -19,10 +19,13 @@ package org.apache.geode.perftest; import java.io.Serializable; +import jdk.nashorn.internal.objects.annotations.Function; + /** * A single task in a test, such as initializing a member * or doing a single operation during the workload phase. */ +@FunctionalInterface public interface Task extends Serializable { /** diff --git a/harness/src/main/java/org/apache/geode/perftest/TestConfig.java b/harness/src/main/java/org/apache/geode/perftest/TestConfig.java index 3868b43..69043dd 100644 --- a/harness/src/main/java/org/apache/geode/perftest/TestConfig.java +++ b/harness/src/main/java/org/apache/geode/perftest/TestConfig.java @@ -154,24 +154,4 @@ public class TestConfig implements Serializable { return Collections.unmodifiableMap(jvmArgs); } - public static class TestStep { - private final Task task; - private final String[] roles; - - public TestStep(Task task, String[] roles) { - if (roles == null || roles.length == 0) { - throw new IllegalStateException("Task " + task + " must be assigned to at least one role"); - } - this.task = task; - this.roles = roles; - } - - public Task getTask() { - return task; - } - - public String[] getRoles() { - return roles; - } - } } diff --git a/harness/src/main/java/org/apache/geode/perftest/TestStep.java b/harness/src/main/java/org/apache/geode/perftest/TestStep.java new file mode 100644 index 0000000..70bc4e1 --- /dev/null +++ b/harness/src/main/java/org/apache/geode/perftest/TestStep.java @@ -0,0 +1,45 @@ +package org.apache.geode.perftest; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import java.util.Set; + +public class TestStep { + private final Task task; + private final Set<String> roles; + + public TestStep(Task task, String[] roles) { + if (roles == null || roles.length == 0) { + throw new IllegalStateException("Task " + task + " must be assigned to at least one role"); + } + this.task = task; + this.roles = new HashSet<>(Arrays.asList(roles)); + } + + public Task getTask() { + return task; + } + + public String[] getRoles() { + return roles.toArray(new String[0]); + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final TestStep testStep = (TestStep) o; + return task.equals(testStep.task) && + roles.equals(testStep.roles); + } + + @Override + public int hashCode() { + return Objects.hash(task, roles); + } +} diff --git a/harness/src/main/java/org/apache/geode/perftest/runner/DefaultTestRunner.java b/harness/src/main/java/org/apache/geode/perftest/runner/DefaultTestRunner.java index 9448c8d..3f26b00 100644 --- a/harness/src/main/java/org/apache/geode/perftest/runner/DefaultTestRunner.java +++ b/harness/src/main/java/org/apache/geode/perftest/runner/DefaultTestRunner.java @@ -36,6 +36,7 @@ import org.slf4j.LoggerFactory; import org.apache.geode.perftest.PerformanceTest; import org.apache.geode.perftest.TestConfig; import org.apache.geode.perftest.TestRunner; +import org.apache.geode.perftest.TestStep; import org.apache.geode.perftest.infrastructure.InfrastructureFactory; import org.apache.geode.perftest.jvms.RemoteJVMFactory; import org.apache.geode.perftest.jvms.RemoteJVMs; @@ -153,7 +154,7 @@ public class DefaultTestRunner implements TestRunner { return versionProperties; } - private void runTasks(List<TestConfig.TestStep> steps, + private void runTasks(List<TestStep> steps, RemoteJVMs remoteJVMs) { steps.forEach(testStep -> { remoteJVMs.execute(testStep.getTask(), testStep.getRoles());