From 859bfc06addf66d5dce236465323af23418dbd05 Mon Sep 17 00:00:00 2001 From: mposolda Date: Fri, 26 Apr 2019 23:16:50 +0200 Subject: [PATCH] KEYCLOAK-10150 surefire.memory.settings is ignored when running testsuite --- pom.xml | 9 ++-- .../integration-arquillian/tests/base/pom.xml | 4 +- .../arquillian/AuthServerTestEnricher.java | 2 + .../testsuite/util/SystemInfoHelper.java | 53 +++++++++++++++++++ .../integration-arquillian/tests/pom.xml | 4 +- 5 files changed, 65 insertions(+), 7 deletions(-) create mode 100644 testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/SystemInfoHelper.java diff --git a/pom.xml b/pom.xml index 7e78da7611..6b77469412 100755 --- a/pom.xml +++ b/pom.xml @@ -150,7 +150,11 @@ 0.28.0 - -Xms512m -Xmx2048m -XX:MetaspaceSize=96m -XX:MaxMetaspaceSize=256m + 512m + 2048m + 96m + 256m + -Xms${surefire.memory.Xms} -Xmx${surefire.memory.Xmx} -XX:MetaspaceSize=${surefire.memory.metaspace} -XX:MaxMetaspaceSize=${surefire.memory.metaspace.max} 7.0.92 @@ -1499,8 +1503,7 @@ maven-surefire-plugin once - ${surefire.memory.settings} - -Djava.awt.headless=true + -Djava.awt.headless=true ${surefire.memory.settings} diff --git a/testsuite/integration-arquillian/tests/base/pom.xml b/testsuite/integration-arquillian/tests/base/pom.xml index 845fbc440a..eb1393f712 100644 --- a/testsuite/integration-arquillian/tests/base/pom.xml +++ b/testsuite/integration-arquillian/tests/base/pom.xml @@ -943,7 +943,7 @@ false - - -Xms512m -Xmx1024m -XX:MetaspaceSize=96m -XX:MaxMetaspaceSize=256m + 1024m @@ -952,7 +952,7 @@ false false - - -Xms512m -Xmx1024m -XX:MetaspaceSize=96m -XX:MaxMetaspaceSize=256m + 1024m diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/AuthServerTestEnricher.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/AuthServerTestEnricher.java index fff390d6d2..d1da336c40 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/AuthServerTestEnricher.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/AuthServerTestEnricher.java @@ -41,6 +41,7 @@ import org.keycloak.testsuite.arquillian.annotation.UncaughtServerErrorExpected; import org.keycloak.testsuite.client.KeycloakTestingClient; import org.keycloak.testsuite.util.LogChecker; import org.keycloak.testsuite.util.OAuthClient; +import org.keycloak.testsuite.util.SystemInfoHelper; import org.wildfly.extras.creaper.commands.undertow.AddUndertowListener; import org.wildfly.extras.creaper.commands.undertow.RemoveUndertowListener; import org.wildfly.extras.creaper.commands.undertow.SslVerifyClient; @@ -289,6 +290,7 @@ public class AuthServerTestEnricher { suiteContextProducer.set(suiteContext); CrossDCTestEnricher.initializeSuiteContext(suiteContext); log.info("\n\n" + suiteContext); + log.info("\n\n" + SystemInfoHelper.getSystemInfo()); } private ContainerInfo updateWithAuthServerInfo(ContainerInfo authServerInfo) { diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/SystemInfoHelper.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/SystemInfoHelper.java new file mode 100644 index 0000000000..441b69f9c2 --- /dev/null +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/SystemInfoHelper.java @@ -0,0 +1,53 @@ +/* + * Copyright 2017 Red Hat, Inc. and/or its affiliates + * and other contributors as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.keycloak.testsuite.util; + +import java.lang.management.ManagementFactory; +import java.lang.management.MemoryPoolMXBean; + + +/** + * Provides some data about CPU and Memory of the java process used for the testsuite + * + * @author Marek Posolda + */ +public class SystemInfoHelper { + + public static String getSystemInfo() { + Runtime runtime = Runtime.getRuntime(); + + StringBuilder s = new StringBuilder("TEST PROCESS INFO: "); + s.append("\nAvailable processors: " + runtime.availableProcessors()); + s.append("\nTotal memory: " + toMB(runtime.totalMemory())); + s.append("\nMax memory (Xmx): " + toMB(runtime.maxMemory())); + + for (MemoryPoolMXBean memoryMXBean : ManagementFactory.getMemoryPoolMXBeans()) { + if ("Metaspace".equalsIgnoreCase(memoryMXBean.getName())) { + s.append("\nMetaspace Max: " + toMB(memoryMXBean.getUsage().getMax())); + } + } + + return s.toString(); + } + + + private static String toMB(long bytes) { + return bytes / 1024 / 1024 + " MB"; + } + +} diff --git a/testsuite/integration-arquillian/tests/pom.xml b/testsuite/integration-arquillian/tests/pom.xml index e70dadbf39..b4b2568024 100755 --- a/testsuite/integration-arquillian/tests/pom.xml +++ b/testsuite/integration-arquillian/tests/pom.xml @@ -643,7 +643,7 @@ standalone.xml ${auth.server.home}/standalone/configuration 1.3.173 - -Xms512m -Xmx1024m -XX:MetaspaceSize=96m -XX:MaxMetaspaceSize=256m + 1024m @@ -668,7 +668,7 @@ standalone.xml ${auth.server.home}/standalone/configuration 1.3.173 - -Xms512m -Xmx1024m -XX:MetaspaceSize=96m -XX:MaxMetaspaceSize=256m + 1024m