Following is a short summary of this contribution:
A new LDAP plugin Selenium test is added (plugins/no_docker/ LdapPluginNoDockerTest.java):
• Unlike the existing Selenium test which requires Dock act as a LDAP container, this one runs with real corporate LDAP server.
• Necessary information required for running test (server config info, user info) can be set through command line (details is explained in Javadoc).
• A new LdapEnv class is introduced to process environment variables passed from terminal.
ActiveDirectryTest is refactored since the new LDAP test shares same user story.
• A new method “authorizeUserAsAdmin” is extracted after refactoring. It is put in “/org/jenkinsci/test/acceptance/plugins/matrix_auth/ProjectBasedMatrixAuthorizationStrategy.java”.
• This methods simply authorizes given user as admin. It is extracted as this process is common to multiple test cases and classes.
• It will be cool if in the future we have methods similar to “authorizeUserAsAdmin” but in a higher abstract level (e.g. a method that authorize/ de-authorize user(s) one or multiple roles)
Code changed in jenkins
User: Bowen Cheng
Path:
src/main/java/org/jenkinsci/test/acceptance/plugins/active_directory/ActiveDirectorySecurity.java
src/main/java/org/jenkinsci/test/acceptance/plugins/ldap/LdapEnv.java
src/main/java/org/jenkinsci/test/acceptance/utils/pluginTests/SecurityConfigUtils.java
src/main/java/org/jenkinsci/test/acceptance/utils/pluginTests/SecurityDisabler.java
src/test/java/plugins/ActiveDirectoryTest.java
src/test/java/plugins/no_docker/LdapPluginNoDockerTest.java
http://jenkins-ci.org/commit/acceptance-test-harness/2c87fd8530c83bee5dc61caab1b8051d76ec9c6a
Log:
JENKINS-25576A Ldap plugin test that runs with LDAP server is added.There was only one Ldap plugin test which requires Docker to run. The
newly created LdapPluginNoDockerTest runs without Docker but with a
real LDAP server. Detailed configuration information can be set through
environment variables.
Because LdapPluginNoDockerTest has similar test stories with
ActiveDirectoryTest, ActiveDirectoryTest is refactored to reduce
duplicate code.
Change-Id: If729ceb05eb96a0b3abfc33fa141b748a0ba461a