DAOS-19247 test: Support scripted Test stages#526
Conversation
Add support for scripted fault injection and RPM test stages. Signed-off-by: Phil Henderson <phillip.henderson@hpe.com>
|
Testing new functionality in daos-stack/daos#18597 |
Signed-off-by: Phil Henderson <phillip.henderson@hpe.com>
|
Downstream testing skipped as it will not test the new groovy code. New code verified as part of daos-stack/daos#18597 |
Signed-off-by: Phil Henderson <phillip.henderson@hpe.com>
Signed-off-by: Phil Henderson <phillip.henderson@hpe.com>
Signed-off-by: Phil Henderson <phillip.henderson@hpe.com>
Signed-off-by: Phil Henderson <phillip.henderson@hpe.com>
Signed-off-by: Phil Henderson <phillip.henderson@hpe.com>
| * | ||
| * @param kwargs Map containing the following optional arguments (empty strings yield defaults): | ||
| * name test stage name | ||
| * runStage whether or not to run the test stage |
There was a problem hiding this comment.
| * runStage whether or not to run the test stage | |
| * runStage whether or not to run the test stage; defaults to true |
| * name test stage name | ||
| * runStage whether or not to run the test stage | ||
| * label test stage default cluster label | ||
| * testBranch if specified, checkout sources from this branch before running tests |
There was a problem hiding this comment.
| * testBranch if specified, checkout sources from this branch before running tests | |
| * testBranch if specified, checkout sources from this branch before running tests; defaults to '' |
Signed-off-by: Phil Henderson <phillip.henderson@hpe.com>
Signed-off-by: Phil Henderson <phillip.henderson@hpe.com>
Signed-off-by: Phil Henderson <phillip.henderson@hpe.com>
| 'test_script': kwargs.get('testScript', ''), | ||
| 'with_valgrind': kwargs.get('withValgrind', ''), | ||
| 'always_script': kwargs.get('alwaysScript', ''), | ||
| 'test_results': kwargs.get('testResults', 'nlt-junit.xml'), |
There was a problem hiding this comment.
Isn't it the case that unitTest expects testResults instead of test_results?
pipeline-lib/vars/unitTest.groovy
Line 234 in cb6b602
| 'test_results': kwargs.get('testResults', 'nlt-junit.xml'), | |
| 'testResults': kwargs.get('testResults', 'nlt-junit.xml'), |
| * @param kwargs Map containing the following optional arguments (empty strings yield defaults): | ||
| * name test stage name | ||
| * runStage whether or not to run the test stage | ||
| * label test stage default cluster label | ||
| * testBranch if specified, checkout sources from this branch before running tests | ||
| * jobStatus Map of status for each stage in the job/build | ||
| * distro the distro to use for the test stage, e.g. 'el9'; defaults to '' | ||
| * timeoutTime unitTest() timeout time in minutes; defaults to 60 | ||
| * instRepos unitTest() inst_repos argument; defaults to daosRepos() | ||
| * testScript unitTest() test_script argument; defaults to '' | ||
| * withValgrind unitTest() with_valgrind argument; defaults to '' | ||
| * alwaysScript unitTest() always_script argument, e.g. | ||
| * 'ci/unit/test_nlt_post.sh'; defaults to '' | ||
| * testResults unitTest() test_results argument; defaults to 'nlt-junit.xml' | ||
| * unstashOpt unitTest() unstash_opt argument; defaults to true | ||
| * unstashTests unitTest() unstash_tests argument; defaults to false | ||
| * instRpms unitTest() inst_rpms argument; defaults to | ||
| * unitPackages(target: distro) + ' daos-client-tests' | ||
| * imageVersion unitTest() image_version argument, e.g 'el9.7'; defaults to '' | ||
| * provEnvVars unitTest() prov_env_vars argument; defaults to '' | ||
| * unitTestPostArgs Map of arguments to pass to unitTestPost() for the stage | ||
| * archiveArtifactsArgs Map of arguments to pass to archiveArtifacts() for the stage | ||
| * @return a scripted stage to run in a pipeline |
There was a problem hiding this comment.
Shouldn't we let the unitTest() function determine the default settings?
| */ | ||
| Map call(Map kwargs = [:]) { | ||
| // General parameters | ||
| String name = kwargs.get('name', 'Unknown Unit Test Stage') |
There was a problem hiding this comment.
Should we have name as mandatory parameter and fail fast if not provided?
| Map unitTestArgs = [ | ||
| 'timeout_time': kwargs.get('timeoutTime', 60), | ||
| 'inst_repos': kwargs.get('instRepos', daosRepos(distro)), | ||
| 'test_script': kwargs.get('testScript', ''), | ||
| 'with_valgrind': kwargs.get('withValgrind', ''), | ||
| 'always_script': kwargs.get('alwaysScript', ''), | ||
| 'test_results': kwargs.get('testResults', 'nlt-junit.xml'), | ||
| 'unstash_opt': kwargs.get('unstashOpt', true), | ||
| 'unstash_tests': kwargs.get('unstashTests', false), | ||
| 'inst_rpms': kwargs.get('instRpms', unitPackages(target: distro) + ' daos-client-tests'), | ||
| 'image_version': kwargs.get('imageVersion', ''), | ||
| 'prov_env_vars': kwargs.get('provEnvVars', '') | ||
| ] |
There was a problem hiding this comment.
If we have same names here as in unitTest() we can just iterate over kwargs to create the map automatically:
| Map unitTestArgs = [ | |
| 'timeout_time': kwargs.get('timeoutTime', 60), | |
| 'inst_repos': kwargs.get('instRepos', daosRepos(distro)), | |
| 'test_script': kwargs.get('testScript', ''), | |
| 'with_valgrind': kwargs.get('withValgrind', ''), | |
| 'always_script': kwargs.get('alwaysScript', ''), | |
| 'test_results': kwargs.get('testResults', 'nlt-junit.xml'), | |
| 'unstash_opt': kwargs.get('unstashOpt', true), | |
| 'unstash_tests': kwargs.get('unstashTests', false), | |
| 'inst_rpms': kwargs.get('instRpms', unitPackages(target: distro) + ' daos-client-tests'), | |
| 'image_version': kwargs.get('imageVersion', ''), | |
| 'prov_env_vars': kwargs.get('provEnvVars', '') | |
| ] | |
| Set wrapperKeys = [ | |
| 'name', | |
| 'runStage', | |
| 'label', | |
| 'testBranch', | |
| 'jobStatus', | |
| 'distro', | |
| 'unitTestPostArgs', | |
| 'archiveArtifactsArgs' | |
| ] as Set | |
| Map unitTestArgs = new LinkedHashMap(kwargs) | |
| unitTestArgs.keySet().removeAll(wrapperKeys) |
If you want to introduce new names the following structure can be easier to read:
Map keyMap = [
timeoutTime : 'timeout_time',
instRepos : 'inst_repos',
testScript : 'test_script',
withValgrind: 'with_valgrind',
alwaysScript: 'always_script',
testResults : 'test_results',
unstashOpt : 'unstash_opt',
unstashTests: 'unstash_tests',
instRpms : 'inst_rpms',
imageVersion: 'image_version',
provEnvVars : 'prov_env_vars'
]
Map unitTestArgs = [:]
keyMap.each { inKey, outKey ->
if (kwargs.containsKey(inKey)) {
unitTestArgs[outKey] = kwargs[inKey]
}
}
| 'test_script': kwargs.get('testScript', ''), | ||
| 'with_valgrind': kwargs.get('withValgrind', ''), | ||
| 'always_script': kwargs.get('alwaysScript', ''), | ||
| 'test_results': kwargs.get('testResults', 'nlt-junit.xml'), |
There was a problem hiding this comment.
Is it a proper default?
The primary goal of this function will be to handle unit tests. NLT and FI is a special case.
Add support for scripted fault injection and RPM test stages.