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>
Signed-off-by: Phil Henderson <phillip.henderson@hpe.com>
| * unitTestArgs Map of arguments to pass to unitTest; defaults to an empty Map. | ||
| * unitTestPostArgs Map of arguments to pass to unitTestPost() for the stage | ||
| * archiveArtifactsArgs Map of arguments to pass to archiveArtifacts() for the stage |
There was a problem hiding this comment.
| * unitTestArgs Map of arguments to pass to unitTest; defaults to an empty Map. | |
| * unitTestPostArgs Map of arguments to pass to unitTestPost() for the stage | |
| * archiveArtifactsArgs Map of arguments to pass to archiveArtifacts() for the stage | |
| * unitTestArgs Map of arguments to pass to unitTest; defaults to an empty Map. | |
| * unitTestPostArgs Map of arguments to pass to unitTestPost() for the stage; defaults to an empty Map. | |
| * archiveArtifactsArgs Map of arguments to pass to archiveArtifacts() for the stage; defaults to an empty Map. |
| if (!unitTestArgs.containsKey('inst_rpms')) { | ||
| /* groovylint-disable-next-line DuplicateStringLiteral */ | ||
| unitTestArgs['inst_rpms'] = unitPackages(target: distro) + ' daos-client-tests' | ||
| } |
There was a problem hiding this comment.
Why do we add ' daos-client-test'?
The actual Jenkins file does not require it:
stage('Unit Test') {
...
steps {
job_step_update(
unitTest(timeout_time: 60,
unstash_opt: true,
inst_repos: daosRepos(),
inst_rpms: unitPackages(target: 'el9'),
image_version: 'el9.7',
)
)
}
...
}
| if (!unitTestArgs.containsKey('inst_rpms')) { | |
| /* groovylint-disable-next-line DuplicateStringLiteral */ | |
| unitTestArgs['inst_rpms'] = unitPackages(target: distro) + ' daos-client-tests' | |
| } | |
| if (!unitTestArgs.containsKey('inst_rpms')) { | |
| /* groovylint-disable-next-line DuplicateStringLiteral */ | |
| unitTestArgs['inst_rpms'] = unitPackages(target: distro) | |
| } |
There was a problem hiding this comment.
This is needed for the Fault Injection Testing stage, where scriptedUnitTestStage() is being used.
There was a problem hiding this comment.
The problem I see here (and in previous comments) is that we start using the scriptedUnitTestStage() method not for default unit test behavior but for an exceptional.
If Fault Injection requires some parameters different than default ones (e.g. additional daos-client-tests) they should be provided in Jenkinsfile (or via different wrapper function).
There was a problem hiding this comment.
I do agree with @grom72 here. IMO it's better to not hardcode this kind of thing into pipeline-lib
There was a problem hiding this comment.
The tricky part is that methods like unitPackages() rely on parseStageInfo() and parseStageInfo relies on the environment variables like the stage name being set. Since this method returns the stage definition to be run, the stage name is not yet set to the stage we're going to run, so the return value of unitPackages() cannot be passed as an input - in its current form. We would essentially need to replace all the parseStageInfo() outputs with required inputs into a bunch of groovy methods. Then we could call:
scriptedUnitTestStage(
...
inst_rpms: unitPackages(target: distro, script: 'ci/unit/required_packages.sh') + ' daos-client-tests',
....
)
This is something I think is better tackled in another PR - one where we could also consider using scriptedUnitTestStage() for the other stages that use unitTest().
Skip-daos-build-and-test: true Signed-off-by: Phil Henderson <phillip.henderson@hpe.com>
Skip-daos-build-and-test: true Signed-off-by: Phil Henderson <phillip.henderson@hpe.com>
Skip-daos-build-and-test: true Signed-off-by: Phil Henderson <phillip.henderson@hpe.com>
Skip-daos-build-and-test: true Signed-off-by: Phil Henderson <phillip.henderson@hpe.com>
Skip-daos-build-and-test: true Signed-off-by: Phil Henderson <phillip.henderson@hpe.com>
Skip-daos-build-and-test: true Signed-off-by: Phil Henderson <phillip.henderson@hpe.com>
Skip-daos-build-and-test: true Signed-off-by: Phil Henderson <phillip.henderson@hpe.com>
THe env.UNIT_TEST handling was bypassing the ability to check the tags for test matches in the stage. Skip-daos-build-and-test: true Signed-off-by: Phil Henderson <phillip.henderson@hpe.com>
Skip-daos-build-and-test: true Signed-off-by: Phil Henderson <phillip.henderson@hpe.com>
Skip-daos-build-and-test: true Signed-off-by: Phil Henderson <phillip.henderson@hpe.com>
Skip-daos-build-and-test: true Signed-off-by: Phil Henderson <phillip.henderson@hpe.com>
|
The removal of the |
| /* groovylint-disable-next-line MethodSize */ | ||
| Map call(Map kwargs = [:]) { | ||
| String name = kwargs.get('name', 'Unknown Functional Test Stage') | ||
| String name = kwargs.get('name', '') |
There was a problem hiding this comment.
Why empty string instead of null?
| Boolean runStage = kwargs.get('runStage', true) as Boolean | ||
| String label = kwargs.get('label') | ||
| String testBranch = kwargs.get('testBranch', '') | ||
| Map jobStatus = kwargs.get('jobStatus', null) ?: [:] |
There was a problem hiding this comment.
Is this not the same?
| Map jobStatus = kwargs.get('jobStatus', null) ?: [:] | |
| Map jobStatus = kwargs.get('jobStatus', [:]) |
There was a problem hiding this comment.
Not exactly:
def kwargs = [jobStatus: false]
// #1 Returns [:] (same result for null, 0, or '' jobStatus value or an missing jobStatus key)
kwargs.get('jobStatus', null) ?: [:]
// #2 Returns false ([:] is only returned if the 'jobStatus' key is not assigned in kwargs, regardless of its value)
kwargs.get('jobStatus', [:])
There was a problem hiding this comment.
Why would we have [jobStatus: false] if it is supposed to be a map? This seems like we are masking other issues?
Adding the scriptedTestRpmStage() method to provide a scripted stage definition for the Test RPM
stages and the scriptedUnitTestStage() method to provide a scripted stage definition for the Fault
Injection Testing stage. Fixing skipping Functional test stages when builds are re-run and the stage
previously passed.