diff --git a/Jenkinsfile b/Jenkinsfile
index b1fdfb75..c000c1c2 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,4 +1,4 @@
-buildPlugin()
+buildPlugin(platforms: ['linux'])
node('docker') {
stage('checkout') {
@@ -8,7 +8,9 @@ node('docker') {
sh 'docker pull fbelzunc/ad-build-container-with-docker-fixtures'
}
stage('maven') {
- sh 'docker run --add-host=samdom.example.com:127.0.0.1 -v /var/lib/docker --privileged --dns=127.0.0.1 --dns=8.8.8.8 -v $WORKSPACE:/project fbelzunc/ad-build-container-with-docker-fixtures clean install -P \'!noIT\''
+ sh '''
+ docker run --add-host=samdom.example.com:127.0.0.1 -v /var/lib/docker --privileged --dns=127.0.0.1 --dns=8.8.8.8 -v $WORKSPACE:/project fbelzunc/ad-build-container-with-docker-fixtures package -Djenkins.test.timeout=6000
+ '''
}
stage('surefire-report') {
junit 'target/surefire-reports/*.xml'
diff --git a/pom.xml b/pom.xml
index a42183d6..bfb11b5f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -164,8 +164,8 @@
org.apache.maven.plugins
maven-surefire-plugin
-
-
+ 1
+ false
-Xms2048m -Xmx2048m
@@ -184,9 +184,9 @@
maven-surefire-plugin
- **/TheFlintstonesTest.java
- **/EntoEndUserCacheLookupEnabledTest.java
- **/EntoEndUserCacheLookupDisabledTest.java
+
+
+
**/WindowsAdsiModeUserCacheDisabledTest.java
**/WindowsAdsiModeUserCacheEnabledTest.java
diff --git a/src/test/java/hudson/plugins/active_directory/docker/EntoEndUserCacheLookupDisabledTest.java b/src/test/java/hudson/plugins/active_directory/docker/EntoEndUserCacheLookupDisabledTest.java
index e5a50333..4ee89afc 100644
--- a/src/test/java/hudson/plugins/active_directory/docker/EntoEndUserCacheLookupDisabledTest.java
+++ b/src/test/java/hudson/plugins/active_directory/docker/EntoEndUserCacheLookupDisabledTest.java
@@ -16,6 +16,7 @@
import org.junit.Test;
import org.jvnet.hudson.test.JenkinsRule;
import org.jvnet.hudson.test.LoggerRule;
+import org.jvnet.hudson.test.recipes.WithTimeout;
import java.util.ArrayList;
import java.util.List;
@@ -73,6 +74,7 @@ public void customSingleADSetup(ActiveDirectoryDomain activeDirectoryDomain, Str
}
@Test
+ @WithTimeout(6000)
public void testEndtoEndManagerDnCacheEnabled() throws Exception {
List messages;
l.record(hudson.plugins.active_directory.ActiveDirectoryUnixAuthenticationProvider.class, Level.FINE).capture(20);
@@ -109,6 +111,7 @@ public void testEndtoEndManagerDnCacheEnabled() throws Exception {
}
@Test
+ @WithTimeout(6000)
public void testEndtoEndManagerDnCacheDisabled() throws Exception {
List messages;
l.record(hudson.plugins.active_directory.ActiveDirectoryUnixAuthenticationProvider.class, Level.FINE).capture(20);
@@ -140,7 +143,6 @@ public void testEndtoEndManagerDnCacheDisabled() throws Exception {
// Try to login as Fred with correct password
wc.login("Fred", "ia4uV1EeKait");
assertThat(wc.goToXml("whoAmI/api/xml").asXml().replaceAll("\\s+", ""), containsString("Fred"));
-
}
@DockerFixture(id = "ad-dc", ports= {135, 138, 445, 39, 464, 389, 3268}, udpPorts = {53}, matchHostPorts = true, dockerfileFolder="docker/TheFlintstonesTest/TheFlintstones")
diff --git a/src/test/java/hudson/plugins/active_directory/docker/EntoEndUserCacheLookupEnabledTest.java b/src/test/java/hudson/plugins/active_directory/docker/EntoEndUserCacheLookupEnabledTest.java
index 93b9e7a9..815b487a 100644
--- a/src/test/java/hudson/plugins/active_directory/docker/EntoEndUserCacheLookupEnabledTest.java
+++ b/src/test/java/hudson/plugins/active_directory/docker/EntoEndUserCacheLookupEnabledTest.java
@@ -19,6 +19,7 @@
import org.junit.Test;
import org.jvnet.hudson.test.JenkinsRule;
import org.jvnet.hudson.test.LoggerRule;
+import org.jvnet.hudson.test.recipes.WithTimeout;
import java.util.ArrayList;
import java.util.List;
@@ -78,9 +79,12 @@ public void customSingleADSetup(ActiveDirectoryDomain activeDirectoryDomain, Str
ActiveDirectorySecurityRealm activeDirectorySecurityRealm = new ActiveDirectorySecurityRealm(null, domains, site, bindName, bindPassword, null, groupLookupStrategy, removeIrrelevantGroups, customDomain, cache, startTls, internalUsersDatabase);
j.getInstance().setSecurityRealm(activeDirectorySecurityRealm);
+
while(!FileUtils.readFileToString(d.getLogfile()).contains("custom (exit status 0; expected)")) {
Thread.sleep(1000);
}
+
+
UserDetails userDetails = null;
int i = 0;
while (i < MAX_RETRIES && userDetails == null) {
@@ -94,6 +98,7 @@ public void customSingleADSetup(ActiveDirectoryDomain activeDirectoryDomain, Str
}
@Test
+ @WithTimeout(6000)
public void testEndtoEndManagerDnCacheEnabled() throws Exception {
List messages;
l.record(hudson.plugins.active_directory.ActiveDirectoryUnixAuthenticationProvider.class, Level.FINE).capture(20);
@@ -130,6 +135,7 @@ public void testEndtoEndManagerDnCacheEnabled() throws Exception {
}
@Test
+ @WithTimeout(6000)
public void testEndtoEndManagerDnCacheDisabled() throws Exception {
List messages;
l.record(hudson.plugins.active_directory.ActiveDirectoryUnixAuthenticationProvider.class, Level.FINE).capture(20);
diff --git a/src/test/java/hudson/plugins/active_directory/docker/TheFlintstonesTest.java b/src/test/java/hudson/plugins/active_directory/docker/TheFlintstonesTest.java
index 3fddc563..568d622b 100644
--- a/src/test/java/hudson/plugins/active_directory/docker/TheFlintstonesTest.java
+++ b/src/test/java/hudson/plugins/active_directory/docker/TheFlintstonesTest.java
@@ -69,6 +69,7 @@
import hudson.util.RingBufferLogHandler;
import org.jvnet.hudson.test.LoggerRule;
import org.jvnet.hudson.test.recipes.LocalData;
+import org.jvnet.hudson.test.recipes.WithTimeout;
/**
* Integration tests with Docker
@@ -95,8 +96,7 @@ public void dynamicSetUp() throws Exception {
TheFlintstones d = docker.get();
dockerIp = d.ipBound(3268);
dockerPort = d.port(3268);
- ActiveDirectoryDomain activeDirectoryDomain = new ActiveDirectoryDomain(AD_DOMAIN, dockerIp + ":" + dockerPort , null, AD_MANAGER_DN, AD_MANAGER_DN_PASSWORD);
- List domains = new ArrayList<>(1);
+ ActiveDirectoryDomain activeDirectoryDomain = new ActiveDirectoryDomain(AD_DOMAIN, dockerIp + ":" + dockerPort , null, AD_MANAGER_DN, AD_MANAGER_DN_PASSWORD); List domains = new ArrayList<>(1);
domains.add(activeDirectoryDomain);
ActiveDirectorySecurityRealm activeDirectorySecurityRealm = new ActiveDirectorySecurityRealm(null, domains, null, null, null, null, GroupLookupStrategy.RECURSIVE, false, true, null, false, null, null);
j.getInstance().setSecurityRealm(activeDirectorySecurityRealm);
@@ -142,6 +142,7 @@ public void manualSetUp() throws Exception {
}
@Test
+ @WithTimeout(6000)
public void simpleLoginSuccessful() throws Exception {
dynamicSetUp();
UserDetails userDetails = j.jenkins.getSecurityRealm().loadUserByUsername("Fred");
@@ -149,6 +150,7 @@ public void simpleLoginSuccessful() throws Exception {
}
@Test
+ @WithTimeout(6000)
public void actualLogin() throws Exception {
dynamicSetUp();
JenkinsRule.WebClient wc = j.createWebClient().login("Fred", "ia4uV1EeKait");
@@ -162,6 +164,7 @@ public void actualLogin() throws Exception {
@Issue("SECURITY-2099")
@Test
+ @WithTimeout(6000)
public void shouldNotAllowEmptyPassword() throws Exception {
l.record(hudson.plugins.active_directory.ActiveDirectoryUnixAuthenticationProvider.class, Level.FINE).capture(20);
dynamicSetUp();
@@ -175,6 +178,7 @@ public void shouldNotAllowEmptyPassword() throws Exception {
}
@Test
+ @WithTimeout(6000)
public void simpleLoginFails() throws Exception {
dynamicSetUp();
try {
@@ -186,6 +190,7 @@ public void simpleLoginFails() throws Exception {
@Issue("JENKINS-36148")
@Test
+ @WithTimeout(6000)
public void checkDomainHealth() throws Exception {
dynamicSetUp();
ActiveDirectorySecurityRealm securityRealm = (ActiveDirectorySecurityRealm) Jenkins.getInstance().getSecurityRealm();
@@ -195,6 +200,7 @@ public void checkDomainHealth() throws Exception {
@Issue("JENKINS-36148")
@Test
+ @WithTimeout(6000)
public void validateCustomDomainController() throws ServletException, NamingException, IOException, Exception {
dynamicSetUp();
ActiveDirectoryDomain.DescriptorImpl adDescriptor = new ActiveDirectoryDomain.DescriptorImpl();
@@ -203,6 +209,7 @@ public void validateCustomDomainController() throws ServletException, NamingExce
@Issue("JENKINS-36148")
@Test
+ @WithTimeout(6000)
public void validateDomain() throws ServletException, NamingException, IOException, Exception {
dynamicSetUp();
ActiveDirectoryDomain.DescriptorImpl adDescriptor = new ActiveDirectoryDomain.DescriptorImpl();
@@ -212,6 +219,7 @@ public void validateDomain() throws ServletException, NamingException, IOExcepti
@Issue("JENKINS-45576")
@Test
+ @WithTimeout(6000)
public void loadGroupFromGroupname() throws Exception {
dynamicSetUp();
String groupname = "The Rubbles";
@@ -221,6 +229,7 @@ public void loadGroupFromGroupname() throws Exception {
@Issue("JENKINS-45576")
@Test
+ @WithTimeout(6000)
public void loadGroupFromAlias() throws Exception {
dynamicSetUp();
// required to monitor the log messages, removing this line the test will fail
@@ -266,6 +275,7 @@ public synchronized void publish(LogRecord record) {
@LocalData
@Test
+ @WithTimeout(6000)
public void testSimpleLoginSuccessfulAfterReadResolveTlsConfigurationSingleDomain() throws Exception {
manualSetUp();
UserDetails userDetails = j.jenkins.getSecurityRealm().loadUserByUsername("Fred");
@@ -274,6 +284,7 @@ public void testSimpleLoginSuccessfulAfterReadResolveTlsConfigurationSingleDomai
@LocalData
@Test
+ @WithTimeout(6000)
public void testSimpleLoginFailsAfterReadResolveTlsConfigurationSingleDomain() throws Exception {
manualSetUp();
try {
@@ -285,6 +296,7 @@ public void testSimpleLoginFailsAfterReadResolveTlsConfigurationSingleDomain() t
@LocalData
@Test
+ @WithTimeout(6000)
public void testSimpleLoginSuccessAfterReadResolveTlsConfigurationMultipleDomainsOneDomain() throws Exception {
manualSetUp();
UserDetails userDetails = j.jenkins.getSecurityRealm().loadUserByUsername("Fred");
@@ -293,6 +305,7 @@ public void testSimpleLoginSuccessAfterReadResolveTlsConfigurationMultipleDomain
@LocalData
@Test
+ @WithTimeout(6000)
public void testSimpleLoginFailsAfterReadResolveTlsConfigurationMultipleDomainsOneDomain() throws Exception {
manualSetUp();
try {
@@ -305,6 +318,7 @@ public void testSimpleLoginFailsAfterReadResolveTlsConfigurationMultipleDomainsO
// TlsConfiguration tests
@LocalData
@Test
+ @WithTimeout(6000)
public void testSimpleLoginSuccessfulTrustingAllCertificates() throws Exception {
manualSetUp();
UserDetails userDetails = j.jenkins.getSecurityRealm().loadUserByUsername("Fred");
@@ -313,6 +327,7 @@ public void testSimpleLoginSuccessfulTrustingAllCertificates() throws Exception
@LocalData
@Test
+ @WithTimeout(6000)
public void testSimpleLoginFailsTrustingJDKTrustStore() throws Exception {
try {
manualSetUp();
@@ -323,6 +338,7 @@ public void testSimpleLoginFailsTrustingJDKTrustStore() throws Exception {
@Issue("SECURITY-2117")
@Test
+ @WithTimeout(6000)
public void testNullBytesInPasswordMustFail() throws Exception {
l.record(hudson.plugins.active_directory.ActiveDirectoryUnixAuthenticationProvider.class, Level.FINE).capture(20);
dynamicSetUp();
@@ -337,6 +353,7 @@ public void testNullBytesInPasswordMustFail() throws Exception {
@Issue("SECURITY-2117")
@Test
+ @WithTimeout(6000)
public void testIncorrectPasswordMustFail() throws Exception {
l.record(hudson.plugins.active_directory.ActiveDirectoryUnixAuthenticationProvider.class, Level.FINE).capture(20);
dynamicSetUp();
@@ -349,7 +366,7 @@ public void testIncorrectPasswordMustFail() throws Exception {
assertTrue(messages.stream().anyMatch(s -> s.contains("Failed to retrieve user Fred")));
}
- @DockerFixture(id = "ad-dc", ports= {135, 138, 445, 39, 464, 389, 3268}, udpPorts = {53}, matchHostPorts = true)
+ @DockerFixture(id = "ad-dc", ports= {135, 138, 445, 39, 53, 464, 389, 3268}, udpPorts = {53}, matchHostPorts = true)
public static class TheFlintstones extends DockerContainer {
}
diff --git a/src/test/resources/hudson/plugins/active_directory/docker/TheFlintstonesTest/testSimpleLoginFailsAfterReadResolveTlsConfigurationSingleDomain.zip b/src/test/resources/hudson/plugins/active_directory/docker/TheFlintstonesTest/testSimpleLoginFailsAfterReadResolveTlsConfigurationSingleDomain.zip
index e7d7fe3b..e02cbb49 100644
Binary files a/src/test/resources/hudson/plugins/active_directory/docker/TheFlintstonesTest/testSimpleLoginFailsAfterReadResolveTlsConfigurationSingleDomain.zip and b/src/test/resources/hudson/plugins/active_directory/docker/TheFlintstonesTest/testSimpleLoginFailsAfterReadResolveTlsConfigurationSingleDomain.zip differ
diff --git a/src/test/resources/hudson/plugins/active_directory/docker/TheFlintstonesTest/testSimpleLoginSuccessAfterReadResolveTlsConfigurationMultipleDomainsOneDomain.zip b/src/test/resources/hudson/plugins/active_directory/docker/TheFlintstonesTest/testSimpleLoginSuccessAfterReadResolveTlsConfigurationMultipleDomainsOneDomain.zip
index 2aa37467..2d098d09 100644
Binary files a/src/test/resources/hudson/plugins/active_directory/docker/TheFlintstonesTest/testSimpleLoginSuccessAfterReadResolveTlsConfigurationMultipleDomainsOneDomain.zip and b/src/test/resources/hudson/plugins/active_directory/docker/TheFlintstonesTest/testSimpleLoginSuccessAfterReadResolveTlsConfigurationMultipleDomainsOneDomain.zip differ
diff --git a/src/test/resources/hudson/plugins/active_directory/docker/TheFlintstonesTest/testSimpleLoginSuccessfulAfterReadResolveTlsConfigurationSingleDomain.zip b/src/test/resources/hudson/plugins/active_directory/docker/TheFlintstonesTest/testSimpleLoginSuccessfulAfterReadResolveTlsConfigurationSingleDomain.zip
index 3990b0df..69238d8c 100644
Binary files a/src/test/resources/hudson/plugins/active_directory/docker/TheFlintstonesTest/testSimpleLoginSuccessfulAfterReadResolveTlsConfigurationSingleDomain.zip and b/src/test/resources/hudson/plugins/active_directory/docker/TheFlintstonesTest/testSimpleLoginSuccessfulAfterReadResolveTlsConfigurationSingleDomain.zip differ