Allow valid agent types in PCT context #660
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While trying to add the Kubernetes plugins to
jenkinsci/bom
in jenkinsci/bom#2417 I got some test failures of the form:The existing test logic had tried to deal with this case by defining a
legalAgentTypes
field, but it was flawed in a few ways:AbstractModelDefTest#configsWithErrors
:unknownBareAgentType
used it but notunknownAgentType
legalAgentTypes
fromAbstractModelDefTest#configsWithErrors
was flawed and yielding the empty string (thus making the test pass erroneously) because Jenkins had not been started when populating the list during JUnit parameterized test initializationThis PR fixes all three mistakes by:
legalAgentTypes
inAbstractModelDefTest#configsWithErrors
, since that is too early for it to be usedlegalAgentTypes
use it in the test itself, after Jenkins startup (currently this list includesErrorsEndpointOpsTest
,ErrorsJSONParserTest
, andValidatorTest
)Testing done
To test this PR I reproduced the original problem by adding the Kubernetes plugins to the test classpath and verified the BOM error occurred. Next I applied the changes from this PR and verified the problem was fixed. Then I removed the Kubernetes plugins from the test classpath and verified the tests still passed in the non-PCT scenario.