public abstract class RoundTripAbstractTest extends Object
configResource() implemented.
2. Check it was configured correctly.
3. Check the configuration is valid via Web UI.
4. Apply the configuration via Web UI.
5. Write the configuration to $JENKINS_HOME/jenkins.yaml.
6. Restart Jenkins.
7. Check the stringInLogExpected() is set during the restart.
All the plugin author needs to do is override the methods providing:
1. The resource with the yaml configuration of the plugin in case they use their own name for the file.
2. A way to validate the configuration is established.
3. A string that should be present in the logs (casc logger) that guarantees the config is loaded. Usually a weird
text configured.| Modifier and Type | Field and Description |
|---|---|
org.jvnet.hudson.test.LoggerRule |
logging |
org.jvnet.hudson.test.RestartableJenkinsRule |
r |
org.junit.rules.TemporaryFolder |
tempFolder |
| Constructor and Description |
|---|
RoundTripAbstractTest() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
assertConfiguredAsExpected(org.jvnet.hudson.test.RestartableJenkinsRule j,
String configContent)
A method to assert if the configuration was correctly loaded.
|
protected String |
configResource()
Return the resource path (yaml file) to be loaded.
|
void |
roundTripTest()
1.
|
protected abstract String |
stringInLogExpected()
Return the string that should be in the logs of the JCasC logger to verify it's configured after a restart.
|
public org.jvnet.hudson.test.RestartableJenkinsRule r
public org.junit.rules.TemporaryFolder tempFolder
public org.jvnet.hudson.test.LoggerRule logging
protected abstract void assertConfiguredAsExpected(org.jvnet.hudson.test.RestartableJenkinsRule j,
String configContent)
j - a RestartableJenkinsRule instance.configContent - expected configuration.protected String configResource()
protected abstract String stringInLogExpected()
public void roundTripTest()
throws IOException
configResource() implemented.
2. Check it was configured correctly.
3. Check the configuration is valid via Web UI.
4. Apply the configuration via Web UI.
5. Write the configuration to $JENKINS_HOME/jenkins.yaml.
6. Restart Jenkins.
7. Check the stringInLogExpected() is set during the restart.IOException - If an exception is thrown managing resources or files.Copyright © 2016–2022. All rights reserved.