KEYCLOAK-10150 surefire.memory.settings is ignored when running testsuite

This commit is contained in:
mposolda 2019-04-26 23:16:50 +02:00 committed by Marek Posolda
parent bcd213e8e7
commit 859bfc06ad
5 changed files with 65 additions and 7 deletions

View file

@ -150,7 +150,11 @@
<docker.maven.plugin.version>0.28.0</docker.maven.plugin.version>
<!-- Surefire Settings -->
<surefire.memory.settings>-Xms512m -Xmx2048m -XX:MetaspaceSize=96m -XX:MaxMetaspaceSize=256m</surefire.memory.settings>
<surefire.memory.Xms>512m</surefire.memory.Xms>
<surefire.memory.Xmx>2048m</surefire.memory.Xmx>
<surefire.memory.metaspace>96m</surefire.memory.metaspace>
<surefire.memory.metaspace.max>256m</surefire.memory.metaspace.max>
<surefire.memory.settings>-Xms${surefire.memory.Xms} -Xmx${surefire.memory.Xmx} -XX:MetaspaceSize=${surefire.memory.metaspace} -XX:MaxMetaspaceSize=${surefire.memory.metaspace.max}</surefire.memory.settings>
<!-- Tomcat versions -->
<tomcat7.version>7.0.92</tomcat7.version>
@ -1499,8 +1503,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkMode>once</forkMode>
<argLine>${surefire.memory.settings}</argLine>
<argLine>-Djava.awt.headless=true</argLine>
<argLine>-Djava.awt.headless=true ${surefire.memory.settings}</argLine>
</configuration>
</plugin>
<plugin>

View file

@ -943,7 +943,7 @@
<properties>
<skip.clean.second.cache>false</skip.clean.second.cache>
<exclude.crossdc>-</exclude.crossdc>
<surefire.memory.settings>-Xms512m -Xmx1024m -XX:MetaspaceSize=96m -XX:MaxMetaspaceSize=256m</surefire.memory.settings>
<surefire.memory.Xmx>1024m</surefire.memory.Xmx>
</properties>
</profile>
<profile>
@ -952,7 +952,7 @@
<skip.clean.second.cache>false</skip.clean.second.cache>
<skip.copy.auth.crossdc.nodes>false</skip.copy.auth.crossdc.nodes>
<exclude.crossdc>-</exclude.crossdc>
<surefire.memory.settings>-Xms512m -Xmx1024m -XX:MetaspaceSize=96m -XX:MaxMetaspaceSize=256m</surefire.memory.settings>
<surefire.memory.Xmx>1024m</surefire.memory.Xmx>
</properties>
</profile>
</profiles>

View file

@ -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) {

View file

@ -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 <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
*/
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";
}
}

View file

@ -643,7 +643,7 @@
<auth.server.config.property.value>standalone.xml</auth.server.config.property.value>
<auth.server.config.dir>${auth.server.home}/standalone/configuration</auth.server.config.dir>
<h2.version>1.3.173</h2.version>
<surefire.memory.settings>-Xms512m -Xmx1024m -XX:MetaspaceSize=96m -XX:MaxMetaspaceSize=256m</surefire.memory.settings>
<surefire.memory.Xmx>1024m</surefire.memory.Xmx>
</properties>
<dependencies>
<dependency>
@ -668,7 +668,7 @@
<auth.server.config.property.value>standalone.xml</auth.server.config.property.value>
<auth.server.config.dir>${auth.server.home}/standalone/configuration</auth.server.config.dir>
<h2.version>1.3.173</h2.version>
<surefire.memory.settings>-Xms512m -Xmx1024m -XX:MetaspaceSize=96m -XX:MaxMetaspaceSize=256m</surefire.memory.settings>
<surefire.memory.Xmx>1024m</surefire.memory.Xmx>
</properties>
<dependencies>
<dependency>