active-directory-plugin icon indicating copy to clipboard operation
active-directory-plugin copied to clipboard

[JENKINS-55813] Improve analysis of AD attributes

Open jvz opened this issue 5 years ago • 24 comments

Reverts the revert of #89 to continue development.

@reviewbybees @Wadeck @fbelzunc

jvz avatar May 23 '19 20:05 jvz

I managed to create a real Active Directory setup on GCP, so I'm going to manually test the changes here with the different account settings I can toggle (locked, expired, etc.)

jvz avatar Nov 13 '20 21:11 jvz

I've tested this plugin in both ADSI mode and manually configured with Windows Server 2019 and Active Directory with the three featured attributes (expired, locked, disabled) all manually tested. It was during this testing that I discovered why the original PR had caused a regression: in ADSI mode, the com4j interfaces created for calling the ADSI native code were converting the timestamp into a Date which made it non-obvious to look for a logical 0 timestamp of 1601-01-01T00:00:00Z. Everything seems to be working fine in both modes. I'll be testing out the corresponding LDAP PR (https://github.com/jenkinsci/ldap-plugin/pull/59) in this same Active Directory domain to ensure everything is consistent.

jvz avatar Nov 18 '20 19:11 jvz

@jvz, any reason why this test failure can be ignored?

jeffret-b avatar Dec 08 '20 22:12 jeffret-b

Might need to re-run that. Let me try that.

jvz avatar Dec 08 '20 22:12 jvz

I can't reproduce the test failure locally.

jvz avatar Dec 09 '20 16:12 jvz

I can't reproduce the test failure locally either, but given the substantial implementation differences between Unix and Windows, we can't just ignore it. It might be part of general issues with Windows test machines or infra.

jeffret-b avatar Dec 09 '20 19:12 jeffret-b

@jvz @jeffret-b I can easily reproduce the test failure.

To reproduce it, you need to have Docker Engine up and running and have in your DNS settings configured with something like this - adapted to your OS (take special attention to de 127.0.0.1 thing - IIRC this is the only important thing from the DNS to add)

Screenshot 2020-12-09 at 21 37 13

Then, run the following maven command

mvn clean test -P\!noIT

the -P\!noIT will disable this profile activated by default which DOES NOT run the docker test by default.

<profiles>
    <profile>
      <id>noIT</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>

fbelzunc avatar Dec 09 '20 20:12 fbelzunc

Seems as though one problem is that if docker isn't available, the tests pass with an error message.

jvz avatar Dec 09 '20 21:12 jvz

Ok, when I make sure Docker is running, and after running with that profile, I get three test failures:

[ERROR] Tests run: 18, Failures: 2, Errors: 1, Skipped: 0, Time elapsed: 484.264 s <<< FAILURE! - in hudson.plugins.active_directory.docker.TheFlintstonesTest
[ERROR] hudson.plugins.active_directory.docker.TheFlintstonesTest.validateDomain  Time elapsed: 25.953 s  <<< FAILURE!
org.junit.ComparisonFailure: expected:<[OK: Success]> but was:<[ERROR: samdom.example.com doesn&#039;t look like a valid domain name]>
	at org.junit.Assert.assertEquals(Assert.java:117)
	at org.junit.Assert.assertEquals(Assert.java:146)
	at hudson.plugins.active_directory.docker.TheFlintstonesTest.validateDomain(TheFlintstonesTest.java:222)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.jenkinsci.test.acceptance.docker.DockerRule$1.evaluate(DockerRule.java:87)
	at org.jvnet.hudson.test.JenkinsRule$1.evaluate(JenkinsRule.java:599)
	at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:288)
	at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:282)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.lang.Thread.run(Thread.java:748)

[ERROR] hudson.plugins.active_directory.docker.TheFlintstonesTest.checkDomainHealth  Time elapsed: 24.665 s  <<< ERROR!
java.lang.NullPointerException
	at hudson.plugins.active_directory.docker.TheFlintstonesTest.checkDomainHealth(TheFlintstonesTest.java:206)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.jenkinsci.test.acceptance.docker.DockerRule$1.evaluate(DockerRule.java:87)
	at org.jvnet.hudson.test.JenkinsRule$1.evaluate(JenkinsRule.java:599)
	at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:288)
	at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:282)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.lang.Thread.run(Thread.java:748)

[ERROR] hudson.plugins.active_directory.docker.TheFlintstonesTest.validateCustomDomainController  Time elapsed: 23.697 s  <<< FAILURE!
org.junit.ComparisonFailure: expected:<[OK: Success]> but was:<[WARNING: Success - but samdom.example.com does not look like a valid domain name]>
	at org.junit.Assert.assertEquals(Assert.java:117)
	at org.junit.Assert.assertEquals(Assert.java:146)
	at hudson.plugins.active_directory.docker.TheFlintstonesTest.validateCustomDomainController(TheFlintstonesTest.java:214)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.jenkinsci.test.acceptance.docker.DockerRule$1.evaluate(DockerRule.java:87)
	at org.jvnet.hudson.test.JenkinsRule$1.evaluate(JenkinsRule.java:599)
	at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:288)
	at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:282)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.lang.Thread.run(Thread.java:748)

I get the same exact failures running those tests on the master branch. Can you confirm that the tests are passing in master and on what OS?

jvz avatar Dec 09 '20 22:12 jvz

I think those three tests will be fixed if you add in your /etc/hosts an entre for 127.0.0.1 samdom.example.com

  • TheFlintstonesTest.validateDomain
  • TheFlintstonesTest.checkDomainHealth
  • TheFlintstonesTest.validateCustomDomainController

However, the test I am worried about is TheFlintstonesTest.loadGroupFromAlias. It is failing here as well. Is it not failing on your computer?

fbelzunc avatar Dec 10 '20 18:12 fbelzunc

That test seems to pass on my computer. I'm not sure if it's a timeout issue or docker-specific or what as the integration test itself has a lot of supporting infrastructure.

I'll retry the tests with that hosts file entry and get back to you.

jvz avatar Dec 10 '20 19:12 jvz

Adding the hosts entries still have the tests failing. The assertion doesn't provide any information, either, so I'm not even sure how to go about debugging this, especially when running this test takes nearly 10 minutes on my machine for some reason.

jvz avatar Dec 10 '20 19:12 jvz

Oh wait, I didn't try setting my network settings to match your DNS screenshot. Let me try that as well and see if it makes a difference.

jvz avatar Dec 10 '20 20:12 jvz

Alright, I finally figured it out after much debugging. Turns out the log capturing wasn't capturing enough of the log anymore now that the setup was doing more things.

jvz avatar Dec 10 '20 21:12 jvz

Alright, I give up on that failing test on CI. It works on my machine. Log as proof:

$ mvn -P'!noIT' clean test -Dtest=TheFlintstonesTest\#loadGroupFromAlias
[INFO] Scanning for projects...
[INFO]
[INFO] --------------< org.jenkins-ci.plugins:active-directory >---------------
[INFO] Building Jenkins Active Directory plugin 2.21-SNAPSHOT
[INFO] --------------------------------[ hpi ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ active-directory ---
[INFO] Deleting /Users/matt/code/gh-jenkinsci/active-directory-plugin/target
[INFO]
[INFO] --- maven-hpi-plugin:3.15:validate (default-validate) @ active-directory ---
[INFO]
[INFO] --- maven-enforcer-plugin:3.0.0-M3:display-info (display-info) @ active-directory ---
[INFO] Maven Version: 3.6.3
[INFO] JDK Version: 1.8.0_222 normalized as: 1.8.0-222
[INFO] OS Info: Arch: x86_64 Family: mac Name: mac os x Version: 10.16
[INFO]
[INFO] --- maven-enforcer-plugin:3.0.0-M3:enforce (display-info) @ active-directory ---
[INFO] Adding ignore: module-info
[INFO] Ignoring requireUpperBoundDeps in com.google.guava:guava
[INFO]
[INFO] --- maven-enforcer-plugin:3.0.0-M3:enforce (no-snapshots-in-release) @ active-directory ---
[INFO]
[INFO] --- gmavenplus-plugin:1.10.0:addTestSources (test-in-groovy) @ active-directory ---
[INFO]
[INFO] --- maven-localizer-plugin:1.26:generate (default) @ active-directory ---
[INFO]
[INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ active-directory ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] Copying 25 resources
[INFO]
[INFO] --- flatten-maven-plugin:1.2.5:flatten (flatten) @ active-directory ---
[INFO] Generating flattened POM of project org.jenkins-ci.plugins:active-directory:hpi:2.21-SNAPSHOT...
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ active-directory ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 25 source files to /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/classes
[WARNING] /Users/matt/code/gh-jenkinsci/active-directory-plugin/src/main/java/hudson/plugins/active_directory/ActiveDirectorySecurityRealm.java:[27,25] com.sun.jndi.ldap.LdapCtxFactory is internal proprietary API and may be removed in a future release
[WARNING] /Users/matt/code/gh-jenkinsci/active-directory-plugin/src/main/java/hudson/plugins/active_directory/ActiveDirectorySecurityRealm.java:[27,25] com.sun.jndi.ldap.LdapCtxFactory is internal proprietary API and may be removed in a future release
[WARNING] /Users/matt/code/gh-jenkinsci/active-directory-plugin/src/main/java/hudson/plugins/active_directory/ActiveDirectorySecurityRealm.java:[27,25] com.sun.jndi.ldap.LdapCtxFactory is internal proprietary API and may be removed in a future release
[WARNING] /Users/matt/code/gh-jenkinsci/active-directory-plugin/src/main/java/hudson/plugins/active_directory/ActiveDirectorySecurityRealm.java:[615,52] com.sun.jndi.ldap.LdapCtxFactory is internal proprietary API and may be removed in a future release
[WARNING] /Users/matt/code/gh-jenkinsci/active-directory-plugin/src/main/java/hudson/plugins/active_directory/ActiveDirectorySecurityRealm.java:[647,48] com.sun.jndi.ldap.LdapCtxFactory is internal proprietary API and may be removed in a future release
[INFO] /Users/matt/code/gh-jenkinsci/active-directory-plugin/src/main/java/hudson/plugins/active_directory/ActiveDirectoryUnixAuthenticationProvider.java: Some input files use or override a deprecated API.
[INFO] /Users/matt/code/gh-jenkinsci/active-directory-plugin/src/main/java/hudson/plugins/active_directory/ActiveDirectoryUnixAuthenticationProvider.java: Recompile with -Xlint:deprecation for details.
[INFO] /Users/matt/code/gh-jenkinsci/active-directory-plugin/src/main/java/hudson/plugins/active_directory/ActiveDirectoryUnixAuthenticationProvider.java: Some input files use unchecked or unsafe operations.
[INFO] /Users/matt/code/gh-jenkinsci/active-directory-plugin/src/main/java/hudson/plugins/active_directory/ActiveDirectoryUnixAuthenticationProvider.java: Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] --- access-modifier-checker:1.16:enforce (default-enforce) @ active-directory ---
[INFO]
[INFO] --- maven-hpi-plugin:3.15:insert-test (default-insert-test) @ active-directory ---
[INFO]
[INFO] --- gmavenplus-plugin:1.10.0:generateTestStubs (test-in-groovy) @ active-directory ---
[INFO] No sources specified for stub generation. Skipping.
[INFO] Generated 0 stubs.
[INFO]
[INFO] --- maven-antrun-plugin:3.0.0:run (createTempDir) @ active-directory ---
[INFO] Executing tasks
[INFO]     [mkdir] Created dir: /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/tmp
[INFO] Executed tasks
[INFO]
[INFO] --- maven-resources-plugin:3.2.0:testResources (default-testResources) @ active-directory ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] Copying 43 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ active-directory ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 10 source files to /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/test-classes
[INFO] /Users/matt/code/gh-jenkinsci/active-directory-plugin/src/test/java/hudson/plugins/active_directory/ActiveDirectoryAuthenticationProviderTest.java: Some input files use or override a deprecated API.
[INFO] /Users/matt/code/gh-jenkinsci/active-directory-plugin/src/test/java/hudson/plugins/active_directory/ActiveDirectoryAuthenticationProviderTest.java: Recompile with -Xlint:deprecation for details.
[INFO]
[INFO] --- maven-hpi-plugin:3.15:test-hpl (default-test-hpl) @ active-directory ---
[INFO] Generating /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/test-classes/the.hpl
Downloading from cert-snapshots: https://repo.jenkins-ci.org/cert-snapshots/com/sun/tools/1.8.0/tools-1.8.0.pom
[WARNING] Error resolving project artifact: Could not transfer artifact com.sun:tools:pom:1.8.0 from/to cert-snapshots (https://repo.jenkins-ci.org/cert-snapshots/): Transfer failed for https://repo.jenkins-ci.org/cert-snapshots/com/sun/tools/1.8.0/tools-1.8.0.pom 409 Conflict for project com.sun:tools:jar:1.8.0
[INFO]
[INFO] --- maven-hpi-plugin:3.15:resolve-test-dependencies (default-resolve-test-dependencies) @ active-directory ---
[WARNING] Error resolving project artifact: Failure to transfer com.sun:tools:pom:1.8.0 from https://repo.jenkins-ci.org/cert-snapshots/ was cached in the local repository, resolution will not be reattempted until the update interval of cert-snapshots has elapsed or updates are forced. Original error: Could not transfer artifact com.sun:tools:pom:1.8.0 from/to cert-snapshots (https://repo.jenkins-ci.org/cert-snapshots/): Transfer failed for https://repo.jenkins-ci.org/cert-snapshots/com/sun/tools/1.8.0/tools-1.8.0.pom 409 Conflict for project com.sun:tools:jar:1.8.0
[INFO]
[INFO] --- gmavenplus-plugin:1.10.0:compileTests (test-in-groovy) @ active-directory ---
[INFO] No sources specified for compilation. Skipping.
[INFO]
[INFO] --- maven-surefire-plugin:3.0.0-M4:test (default-test) @ active-directory ---
[INFO]
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running hudson.plugins.active_directory.docker.TheFlintstonesTest
=== Starting loadGroupFromAlias(hudson.plugins.active_directory.docker.TheFlintstonesTest)
   0.127 [id=13]	INFO	o.jvnet.hudson.test.WarExploder#explode: Exploding /Users/matt/.m2/repository/org/jenkins-ci/main/jenkins-war/2.235.5/jenkins-war-2.235.5.war into /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/jenkins-for-test
   3.081 [id=13]	INFO	o.jvnet.hudson.test.JenkinsRule#createWebServer: Running on http://localhost:61623/jenkins/
   4.920 [id=29]	INFO	jenkins.InitReactorRunner$1#onAttained: Started initialization
   5.576 [id=41]	WARNING	hudson.ClassicPluginStrategy#createClassJarFromWebInfClasses: Created /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/tmp/jenkins6341267302019045133/plugins/mailer/WEB-INF/lib/classes.jar; update plugin to a version created with a newer harness
   5.611 [id=41]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/tmp/jenkins6341267302019045133/plugins/matrix-auth.jpi
   5.667 [id=41]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/tmp/jenkins6341267302019045133/plugins/command-launcher.jpi
   5.710 [id=41]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/tmp/jenkins6341267302019045133/plugins/jdk-tool.jpi
   5.745 [id=41]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/tmp/jenkins6341267302019045133/plugins/trilead-api.jpi
   5.777 [id=41]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/tmp/jenkins6341267302019045133/plugins/script-security.jpi
   5.872 [id=41]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/tmp/jenkins6341267302019045133/plugins/windows-slaves.jpi
   5.968 [id=41]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/tmp/jenkins6341267302019045133/plugins/antisamy-markup-formatter.jpi
   6.026 [id=41]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/tmp/jenkins6341267302019045133/plugins/junit.jpi
   6.072 [id=41]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/tmp/jenkins6341267302019045133/plugins/bouncycastle-api.jpi
   6.177 [id=41]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/tmp/jenkins6341267302019045133/plugins/scm-api.jpi
   6.196 [id=41]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/tmp/jenkins6341267302019045133/plugins/workflow-step-api.jpi
   6.209 [id=41]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/tmp/jenkins6341267302019045133/plugins/structs.jpi
   6.226 [id=41]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/tmp/jenkins6341267302019045133/plugins/matrix-project.jpi
   6.273 [id=41]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/tmp/jenkins6341267302019045133/plugins/workflow-api.jpi
   6.423 [id=28]	INFO	jenkins.InitReactorRunner$1#onAttained: Listed all plugins
   6.545 [id=42]	INFO	j.b.a.SecurityProviderInitializer#addSecurityProvider: Initializing Bouncy Castle security provider.
   6.797 [id=42]	INFO	j.b.a.SecurityProviderInitializer#addSecurityProvider: Bouncy Castle security provider initialized.
  10.054 [id=31]	INFO	jenkins.InitReactorRunner$1#onAttained: Prepared all plugins
  10.071 [id=41]	INFO	jenkins.InitReactorRunner$1#onAttained: Started all plugins
  10.074 [id=35]	INFO	jenkins.InitReactorRunner$1#onAttained: Augmented all extensions
  11.734 [id=35]	INFO	jenkins.InitReactorRunner$1#onAttained: System config loaded
  11.735 [id=35]	INFO	jenkins.InitReactorRunner$1#onAttained: System config adapted
  11.820 [id=30]	INFO	jenkins.InitReactorRunner$1#onAttained: Loaded all jobs
  11.821 [id=42]	INFO	jenkins.InitReactorRunner$1#onAttained: Configuration for all jobs updated
  12.125 [id=28]	INFO	jenkins.InitReactorRunner$1#onAttained: Completed initialization
Building Docker image `docker build -t jenkins/ad-dc:a793f48985af /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/tmp/Dockerfile1147026841366562504dir`: logfile is at /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/tmp/docker-TheFlintstones-build3211770901883481536.log
Launching Docker container `docker run -d -p 127.0.0.1:135:135 -p 127.0.0.1:138:138 -p 127.0.0.1:445:445 -p 127.0.0.1:39:39 -p 127.0.0.1:464:464 -p 127.0.0.1:389:389 -p 127.0.0.1:3268:3268 -p 127.0.0.1:53:53/udp jenkins/ad-dc:a793f48985af`: logfile will be at /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/tmp/docker-TheFlintstones-run3198948238190233670.log
  48.295 [id=13]	WARNING	h.p.a.ActiveDirectoryUnixAuthenticationProvider$4#call: JENKINS-45576: `Rubbles` is an Exchange alias and aliases are not currently supported. Please use the group common name `The Rubbles` instead
  48.296 [id=13]	WARNING	h.p.a.ActiveDirectoryUnixAuthenticationProvider$4#call: Exhausted all configured domains and could not authenticate against any
  49.379 [id=13]	INFO	jenkins.model.Jenkins#cleanUp: Stopping Jenkins
  49.984 [id=13]	INFO	jenkins.model.Jenkins#cleanUp: Jenkins stopped
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 51.2 s - in hudson.plugins.active_directory.docker.TheFlintstonesTest

Line from /etc/hosts:

127.0.0.1 samdom.example.com
image

I have no idea why CI is failing.

jvz avatar Dec 10 '20 22:12 jvz

I will try to get time to review this.

I just launched all the test on my local environment and all the tests are passing in the master branch. However, there is one failure in your PR

[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running InjectedTest
[INFO] Tests run: 20, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 12.448 s - in InjectedTest
[INFO] Running hudson.plugins.active_directory.ActiveDirectoryAuthenticationProviderTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.012 s - in hudson.plugins.active_directory.ActiveDirectoryAuthenticationProviderTest
[INFO] Running hudson.plugins.active_directory.ActiveDirectoryJCasCCompatibilityTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.279 s - in hudson.plugins.active_directory.ActiveDirectoryJCasCCompatibilityTest
[INFO] Running hudson.plugins.active_directory.ActiveDirectorySecurityRealmTest
[INFO] Tests run: 16, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 31.468 s - in hudson.plugins.active_directory.ActiveDirectorySecurityRealmTest
[INFO] Running hudson.plugins.active_directory.RemoveIrrelevantGroupsTest
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 11.19 s - in hudson.plugins.active_directory.RemoveIrrelevantGroupsTest
[INFO] Running hudson.plugins.active_directory.WindowsAdsiModeUserCacheDisabledTest
[WARNING] Tests run: 1, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0.005 s - in hudson.plugins.active_directory.WindowsAdsiModeUserCacheDisabledTest
[INFO] Running hudson.plugins.active_directory.WindowsAdsiModeUserCacheEnabledTest
[WARNING] Tests run: 1, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0.004 s - in hudson.plugins.active_directory.WindowsAdsiModeUserCacheEnabledTest
[INFO] Running hudson.plugins.active_directory.docker.EntoEndUserCacheLookupDisabledTest
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 51.783 s - in hudson.plugins.active_directory.docker.EntoEndUserCacheLookupDisabledTest
[INFO] Running hudson.plugins.active_directory.docker.EntoEndUserCacheLookupEnabledTest
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 51.754 s - in hudson.plugins.active_directory.docker.EntoEndUserCacheLookupEnabledTest
[INFO] Running hudson.plugins.active_directory.docker.TheFlintstonesTest
[INFO] Tests run: 17, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 343.771 s - in hudson.plugins.active_directory.docker.TheFlintstonesTest
[INFO]
[INFO] Results:
[INFO]
[WARNING] Tests run: 64, Failures: 0, Errors: 0, Skipped: 2
[INFO]
[INFO]
[INFO] --- animal-sniffer-maven-plugin:1.19:check (check) @ active-directory ---
[INFO] Resolved signature org.codehaus.mojo.signature:java18 version as 1.0 from dependencyManagement
[INFO] Checking unresolved references to org.codehaus.mojo.signature:java18:1.0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  08:46 min
[INFO] Finished at: 2020-12-11T07:38:26+01:00
[INFO] ------------------------------------------------------------------------

fbelzunc avatar Dec 11 '20 07:12 fbelzunc

I isolated the cause of the test failure by first removing my changes to custom.sh which made the test pass again. Changing the ordering of the commands in it didn't make the tests pass, but then I increased the log capture count which made it pass. If the tests are still failing for you, then that's beyond my knowledge here as it's specific to that test and not this PR. I didn't want to copy the test and create a brand new one just to avoid a flaky test.

jvz avatar Dec 11 '20 15:12 jvz

@fbelzunc @jeffret-b I split out the new test and reverted my changes to the old test. Everything should be good to go now. Please review.

jvz avatar Dec 15 '20 18:12 jvz

Re-triggering due to docker build timeout.

jvz avatar Dec 15 '20 19:12 jvz

Not sure why the test aborts before it's finished building the image, so this may take a few tries to get it to finish building.

jvz avatar Dec 15 '20 19:12 jvz

@jeffret-b @fbelzunc tests passing now

jvz avatar Dec 15 '20 20:12 jvz

So this PR is ready to merge. However, based on some bug reports we got related to the LDAP change matching this AD change, there seem to be a plugin or two that also needs updating to properly handle the exceptions thrown by this PR. I'll link back to those here, then you can safely merge this when those are merged.

jvz avatar Feb 16 '21 16:02 jvz

https://github.com/jenkinsci/mailer-plugin/pull/104 for one issue surfaced from the LDAP PR that would likewise apply to this PR.

jvz avatar Feb 16 '21 19:02 jvz

And filed https://github.com/jenkinsci/email-ext-plugin/pull/277 for the other related issue. Once those are both merged, this PR is good to go.

jvz avatar Feb 16 '21 19:02 jvz