-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve test config change handling (#164) #177
base: main
Are you sure you want to change the base?
Conversation
f59a966
to
92b5f33
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- use multiple
@QueryParameter
withinTestConfig.groovy
to show the user the relationship between both parameters andKEEP
FormValidation doCheckTbcPath(@QueryParameter("tbcPath") String tbcPatch, @QueryParameter("tcfPath") String tcfPath) { // check implememntation to WARN the user if one of the parameter is KEEP and the other is not }
- using the snippet generator it is not possible to set tbc or tcf empty, find a way to make it possible so the user can unload the configuration via snippet generator (Hint: use Optional Block)
src/test/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/RunPackageStepIT.groovy
Outdated
Show resolved
Hide resolved
src/test/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/steps/RunPackageStepIT.groovy
Show resolved
Hide resolved
- remove keep - ajust jelly, avdanvedDocs, and tests
7ea33e4
to
d315fb2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- currently the snippet generator allows both
ttRunPackage testCasePath: 'test.pkg', testConfig: [forceConfigurationReload: true, tbcPath: 'test.tbc', tcfPath: 'test.tcf']
- this should be tested
...in/resources/de/tracetronic/jenkins/plugins/ecutestexecution/configs/TestConfig/config.jelly
Outdated
Show resolved
Hide resolved
...in/resources/de/tracetronic/jenkins/plugins/ecutestexecution/configs/TestConfig/config.jelly
Outdated
Show resolved
Hide resolved
...in/resources/de/tracetronic/jenkins/plugins/ecutestexecution/configs/TestConfig/config.jelly
Outdated
Show resolved
Hide resolved
...sources/de/tracetronic/jenkins/plugins/ecutestexecution/configs/TestConfig/config.properties
Outdated
Show resolved
Hide resolved
- ensure either load configuration or keep configuration in snippet generator - adjust jelly and properties file - sync tests
src/main/groovy/de/tracetronic/jenkins/plugins/ecutestexecution/configs/TestConfig.groovy
Outdated
Show resolved
Hide resolved
@@ -39,10 +35,17 @@ class TestConfig extends AbstractDescribableImpl<TestConfig> implements Expandab | |||
} | |||
|
|||
TestConfig(TestConfig config) { | |||
this.forceConfigurationReload = config.forceConfigurationReload | |||
//setting paths and constants to empty in case forceConfigurationReload is set to true | |||
if(this.forceConfigurationReload) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the trigger should be the configOption intead
....
private static transient String configOption
...
TestConfig(TestConfig config) {
this()
this.forceConfigurationReload = config.forceConfigurationReload
if (configOption != 'keepConfig') {
this.tbcPath = config.getTbcPath()
this.tcfPath = config.getTcfPath()
this.constants = config.getConstants()
}
}
@DataBoundSetter
void setConfigOption(String value) {
configOption = value
}
static String getConfigOption() {
return configOption ?: 'loadConfig'
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- had to remove
static
from the configOption getter, otherwise tests likeconfig round trip
would have thrown:java.lang.NoSuchMethodException: Property 'configOption' has no getter method in class 'class de.tracetronic.jenkins.plugins.ecutestexecution.configs.TestConfig'
- had to set
forceConfigurtionReload
to false in if branch, otherwise a combination in the snippetGenerator of[forceConfigurationReload: true, tbcPath: 'test.tbc', tcfPath: 'test.tcf']
would have been possible
- enhance configOption handler in TestConfig - sync tests
@Override | ||
String toString() { | ||
""" | ||
-> tbcPath: ${tbcPath} | ||
-> tcfPath: ${tcfPath} | ||
-> forceConfigurationReload: ${forceConfigurationReload} | ||
-> constants: ${constants.each { it }} | ||
-> configOption: ${configOption} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing tests for console log information
this.tbcPath = config.getTbcPath() | ||
this.tcfPath = config.getTcfPath() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep tbc and tcf path empty should unload the current loaded configuration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ups
- provide console log for configOption and sync related tests - provide test for behavior of keeping tbc/tcf paths empty
jenkins.assertLogContains("Response Code: HTTP/1.1 200 OK", run) | ||
jenkins.assertLogContains("Executing package 'test.pkg'...", run) | ||
jenkins.assertLogContains("Response Code: HTTP/1.1 200 OK", run) | ||
jenkins.assertLogContains("\"tbc\": {\"tbcPath\": \"test.tbc\"}, \"tcf\": {\"tcfPath\": \"test.tcf\"}", run) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i guess that should be a 'not' contains
Resolves #164