Skip to content

Instantly share code, notes, and snippets.

@lulf
Created June 11, 2018 08:20
Show Gist options
  • Save lulf/76af3972d64f383ca9a5f5c292938f55 to your computer and use it in GitHub Desktop.
Save lulf/76af3972d64f383ca9a5f5c292938f55 to your computer and use it in GitHub Desktop.
diff --git a/systemtests/src/main/java/io/enmasse/systemtest/TestUtils.java b/systemtests/src/main/java/io/enmasse/systemtest/TestUtils.java
index d0a0ff0c..1726d027 100644
--- a/systemtests/src/main/java/io/enmasse/systemtest/TestUtils.java
+++ b/systemtests/src/main/java/io/enmasse/systemtest/TestUtils.java
@@ -223,6 +223,7 @@ public class TestUtils {
* @throws Exception
*/
public static void setAddresses(AddressApiClient apiClient, Kubernetes kubernetes, TimeoutBudget budget, AddressSpace addressSpace, boolean wait, Destination... destinations) throws Exception {
+ long start = System.nanoTime();
apiClient.setAddresses(addressSpace, destinations);
if (wait) {
JsonObject addrSpaceObj = apiClient.getAddressSpace(addressSpace.getName());
@@ -233,9 +234,12 @@ public class TestUtils {
}
waitForDestinationsReady(apiClient, addressSpace, budget, destinations);
}
+ long end = System.nanoTime();
+ log.info("Took {} seconds to set {} addresses in address space {}", TimeUnit.NANOSECONDS.toSeconds(end - start), destinations.length, addressSpace.getName());
}
public static void appendAddresses(AddressApiClient apiClient, Kubernetes kubernetes, TimeoutBudget budget, AddressSpace addressSpace, boolean wait, Destination... destinations) throws Exception {
+ long start = System.nanoTime();
apiClient.appendAddresses(addressSpace, destinations);
if (wait) {
JsonObject addrSpaceObj = apiClient.getAddressSpace(addressSpace.getName());
@@ -246,9 +250,12 @@ public class TestUtils {
}
waitForDestinationsReady(apiClient, addressSpace, budget, destinations);
}
+ long end = System.nanoTime();
+ log.info("Took {} seconds to append {} addresses in address space {}", TimeUnit.NANOSECONDS.toSeconds(end - start), destinations.length, addressSpace.getName());
}
public static void appendAddresses(AddressApiClient apiClient, Kubernetes kubernetes, TimeoutBudget budget, AddressSpace addressSpace, boolean wait, int batchSize, Destination... destinations) throws Exception {
+ long start = System.nanoTime();
apiClient.appendAddresses(addressSpace, batchSize, destinations);
if (wait) {
JsonObject addrSpaceObj = apiClient.getAddressSpace(addressSpace.getName());
@@ -259,6 +266,8 @@ public class TestUtils {
}
waitForDestinationsReady(apiClient, addressSpace, budget, destinations);
}
+ long end = System.nanoTime();
+ log.info("Took {} seconds to append {} addresses in address space {}", TimeUnit.NANOSECONDS.toSeconds(end - start), destinations.length, addressSpace.getName());
}
/**
diff --git a/systemtests/src/test/java/io/enmasse/systemtest/bases/TestBase.java b/systemtests/src/test/java/io/enmasse/systemtest/bases/TestBase.java
index 5e312393..40b32286 100644
--- a/systemtests/src/test/java/io/enmasse/systemtest/bases/TestBase.java
+++ b/systemtests/src/test/java/io/enmasse/systemtest/bases/TestBase.java
@@ -70,8 +70,11 @@ public abstract class TestBase implements ITestBase, ITestSeparator {
protected static void deleteAddressSpace(AddressSpace addressSpace) throws Exception {
if (TestUtils.existAddressSpace(addressApiClient, addressSpace.getName())) {
+ long start = System.nanoTime();
TestUtils.deleteAddressSpace(addressApiClient, addressSpace, logCollector);
TestUtils.waitForAddressSpaceDeleted(kubernetes, addressSpace);
+ long end = System.nanoTime();
+ log.info("Took {} seconds to delete address space {}", TimeUnit.NANOSECONDS.toSeconds(end - start), addressSpace.getName());
} else {
log.info("Address space '" + addressSpace + "' doesn't exists!");
}
@@ -158,6 +161,7 @@ public abstract class TestBase implements ITestBase, ITestSeparator {
AddressSpace addrSpaceResponse;
if (!TestUtils.existAddressSpace(addressApiClient, addressSpace.getName())) {
log.info("Address space '" + addressSpace + "' doesn't exist and will be created.");
+ long start = System.nanoTime();
addressApiClient.createAddressSpace(addressSpace);
addrSpaceResponse = TestUtils.waitForAddressSpaceReady(addressApiClient, addressSpace.getName());
@@ -169,6 +173,8 @@ public abstract class TestBase implements ITestBase, ITestSeparator {
log.info("Waiting for 2 minutes before starting tests");
Thread.sleep(120_000);
}
+ long end = System.nanoTime();
+ log.info("Took {} seconds to create address space {}", TimeUnit.NANOSECONDS.toSeconds(end - start), addressSpace.getName());
} else {
addrSpaceResponse = TestUtils.getAddressSpaceObject(addressApiClient, addressSpace.getName());
log.info("Address space '" + addressSpace + "' already exists.");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment