Skip to content
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

Bugfix on retrieving plugin test types #271

Merged
merged 8 commits into from
Feb 10, 2021

Conversation

imonteroperez
Copy link
Contributor

@imonteroperez imonteroperez commented Feb 8, 2021

This PR provides a bugfix on generating the report of failed tests based on its type

Context

Problem statement

  • Once used this new support, detected that PCT plugin report was not properly showing all the test failures
  • @bmunozm did a preliminary analysis and detected this via bisect that reason was about mentioned PR
  • Example of invalid result with google-compute-engine plugin:
[...]
executed classname tests: [com.google.jenkins.plugins.computeengine.SharedVpcNetworkConfigurationTest, com.google.jenkins.plugins.computeengine.AcceleratorConfigurationTest, com.google.jenkins.plugins.computeengine.GoogleKeyPairTest, com.google.jenkins.plugins.computeengine.ConfigAsCodeTest, com.google.jenkins.plugins.computeengine.InstanceConfigurationTest, com.google.jenkins.plugins.computeengine.AutofilledNetworkConfigurationTest, com.google.jenkins.plugins.computeengine.CleanLostNodesWorkTest, com.google.jenkins.plugins.computeengine.ComputeEngineCloudTest]
[INFO] -------------------------------------------------------
[INFO] Solving test names
[INFO] -------------------------------------------------------
[WARNING] No test reports found!
[...]

before

  • Example of expected result for google-compute-engine plugin:
[...]
executed classname tests: [com.google.jenkins.plugins.computeengine.SharedVpcNetworkConfigurationTest, com.google.jenkins.plugins.computeengine.AcceleratorConfigurationTest, com.google.jenkins.plugins.computeengine.GoogleKeyPairTest, com.google.jenkins.plugins.computeengine.ConfigAsCodeTest, com.google.jenkins.plugins.computeengine.InstanceConfigurationTest, com.google.jenkins.plugins.computeengine.AutofilledNetworkConfigurationTest, com.google.jenkins.plugins.computeengine.CleanLostNodesWorkTest, com.google.jenkins.plugins.computeengine.ComputeEngineCloudTest]
[INFO] -------------------------------------------------------
[INFO] Solving test names
[INFO] -------------------------------------------------------
[INFO] Reading /pct/tmp/work/google-compute-engine/target/surefire-reports
[INFO] Extracted 4 testnames from /pct/tmp/work/google-compute-engine/target/surefire-reports/TEST-com.google.jenkins.plugins.computeengine.SharedVpcNetworkConfigurationTest.xml
[INFO] Extracted 2 testnames from /pct/tmp/work/google-compute-engine/target/surefire-reports/TEST-com.google.jenkins.plugins.computeengine.AcceleratorConfigurationTest.xml
[INFO] Extracted 1 testnames from /pct/tmp/work/google-compute-engine/target/surefire-reports/TEST-com.google.jenkins.plugins.computeengine.GoogleKeyPairTest.xml
[INFO] Extracted 2 testnames from /pct/tmp/work/google-compute-engine/target/surefire-reports/TEST-com.google.jenkins.plugins.computeengine.ConfigAsCodeTest.xml
[INFO] Extracted 6 testnames from /pct/tmp/work/google-compute-engine/target/surefire-reports/TEST-com.google.jenkins.plugins.computeengine.InstanceConfigurationTest.xml
[INFO] Extracted 9 testnames from /pct/tmp/work/google-compute-engine/target/surefire-reports/TEST-com.google.jenkins.plugins.computeengine.AutofilledNetworkConfigurationTest.xml
[INFO] Extracted 5 testnames from /pct/tmp/work/google-compute-engine/target/surefire-reports/TEST-com.google.jenkins.plugins.computeengine.CleanLostNodesWorkTest.xml
[INFO] Extracted 6 testnames from /pct/tmp/work/google-compute-engine/target/surefire-reports/TEST-com.google.jenkins.plugins.computeengine.ComputeEngineCloudTest.xml
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Executed: 34
[INFO] - com.google.jenkins.plugins.computeengine.AcceleratorConfigurationTest.clientCalls
[INFO] - com.google.jenkins.plugins.computeengine.AcceleratorConfigurationTest.construction
[INFO] - com.google.jenkins.plugins.computeengine.AutofilledNetworkConfigurationTest.testConstructor
[INFO] - com.google.jenkins.plugins.computeengine.AutofilledNetworkConfigurationTest.testDoCheckNetworkItemsEmpty
[INFO] - com.google.jenkins.plugins.computeengine.AutofilledNetworkConfigurationTest.testDoCheckNetworkItemsValid
[INFO] - com.google.jenkins.plugins.computeengine.AutofilledNetworkConfigurationTest.testDoCheckSubnetworkItemsEmpty
[INFO] - com.google.jenkins.plugins.computeengine.AutofilledNetworkConfigurationTest.testDoCheckSubnetworkItemsValid
[INFO] - com.google.jenkins.plugins.computeengine.AutofilledNetworkConfigurationTest.testDoFillNetworkItems
[INFO] - com.google.jenkins.plugins.computeengine.AutofilledNetworkConfigurationTest.testDoFillSubnetworkItemsEmptyRegion
[INFO] - com.google.jenkins.plugins.computeengine.AutofilledNetworkConfigurationTest.testDoFillSubnetworkItemsNoSubnetworks
[INFO] - com.google.jenkins.plugins.computeengine.AutofilledNetworkConfigurationTest.testDoFillSubnetworkItemsValid
[INFO] - com.google.jenkins.plugins.computeengine.CleanLostNodesWorkTest.shouldCleanLostInstance
[INFO] - com.google.jenkins.plugins.computeengine.CleanLostNodesWorkTest.shouldNotCleanAnyInstance
[INFO] - com.google.jenkins.plugins.computeengine.CleanLostNodesWorkTest.shouldNotCleanStoppingInstance
[INFO] - com.google.jenkins.plugins.computeengine.CleanLostNodesWorkTest.shouldRegisterCleanNodeWorker
[INFO] - com.google.jenkins.plugins.computeengine.CleanLostNodesWorkTest.shouldRunWithoutClouds
[INFO] - com.google.jenkins.plugins.computeengine.ComputeEngineCloudTest.construction
[INFO] - com.google.jenkins.plugins.computeengine.ComputeEngineCloudTest.descriptorFillCredentials
[INFO] - com.google.jenkins.plugins.computeengine.ComputeEngineCloudTest.descriptorProjectValidation
[INFO] - com.google.jenkins.plugins.computeengine.ComputeEngineCloudTest.getConfigurationsByLabelMulti
[INFO] - com.google.jenkins.plugins.computeengine.ComputeEngineCloudTest.getConfigurationsByLabelSimple
[INFO] - com.google.jenkins.plugins.computeengine.ComputeEngineCloudTest.instanceIdWasGenerated
[INFO] - com.google.jenkins.plugins.computeengine.ConfigAsCodeTest.shouldCreateCloudInstanceFromCode
[INFO] - com.google.jenkins.plugins.computeengine.ConfigAsCodeTest.shouldCreateGCEClientFromCode
[INFO] - com.google.jenkins.plugins.computeengine.GoogleKeyPairTest.KeyPairGeneration
[INFO] - com.google.jenkins.plugins.computeengine.InstanceConfigurationTest.descriptorBootDiskSizeValidation
[INFO] - com.google.jenkins.plugins.computeengine.InstanceConfigurationTest.testClient
[INFO] - com.google.jenkins.plugins.computeengine.InstanceConfigurationTest.testConfigRoundtrip
[INFO] - com.google.jenkins.plugins.computeengine.InstanceConfigurationTest.testInstanceMetadata
[INFO] - com.google.jenkins.plugins.computeengine.InstanceConfigurationTest.testInstanceModel
[INFO] - com.google.jenkins.plugins.computeengine.SharedVpcNetworkConfigurationTest.construction
[INFO] - com.google.jenkins.plugins.computeengine.SharedVpcNetworkConfigurationTest.descriptorProjectId
[INFO] - com.google.jenkins.plugins.computeengine.SharedVpcNetworkConfigurationTest.descriptorRegion
[INFO] - com.google.jenkins.plugins.computeengine.SharedVpcNetworkConfigurationTest.descriptorSubnetwork
[INFO] 
[INFO] Failed: 1
[INFO] - com.google.jenkins.plugins.computeengine.InstanceConfigurationTest.unnecessary Mockito stubbings
[...]

Solution and implementation details

  • Detected wrongly null injection of types values to the solver
  • Injected types as part of the userProperties map inside the config provided to the runner
  • Results obtained as expected
  • Example of generated report:
<entry>
  <pluginInfos>
    <pluginName>google-compute-engine</pluginName>
    <pluginVersion>4.3.3</pluginVersion>
    <pluginUrl>jar:file:/pct/tmp/jenkins.war!/WEB-INF/plugins/google-compute-engine.hpi</pluginUrl>
  </pluginInfos>
  <list>
    <compatResult>
      [...]
      <status>TEST_FAILURES</status>
      [...]
      <testDetails class="sorted-set">
        <string>com.google.jenkins.plugins.computeengine.AcceleratorConfigurationTest.clientCalls</string>
        <string>com.google.jenkins.plugins.computeengine.AcceleratorConfigurationTest.construction</string>
        <string>com.google.jenkins.plugins.computeengine.AutofilledNetworkConfigurationTest.testConstructor</string>
        <string>com.google.jenkins.plugins.computeengine.AutofilledNetworkConfigurationTest.testDoCheckNetworkItemsEmpty</string>
        <string>com.google.jenkins.plugins.computeengine.AutofilledNetworkConfigurationTest.testDoCheckNetworkItemsValid</string>
        <string>com.google.jenkins.plugins.computeengine.AutofilledNetworkConfigurationTest.testDoCheckSubnetworkItemsEmpty</string>
        <string>com.google.jenkins.plugins.computeengine.AutofilledNetworkConfigurationTest.testDoCheckSubnetworkItemsValid</string>
        <string>com.google.jenkins.plugins.computeengine.AutofilledNetworkConfigurationTest.testDoFillNetworkItems</string>
        <string>com.google.jenkins.plugins.computeengine.AutofilledNetworkConfigurationTest.testDoFillSubnetworkItemsEmptyRegion</string>
        <string>com.google.jenkins.plugins.computeengine.AutofilledNetworkConfigurationTest.testDoFillSubnetworkItemsNoSubnetworks</string>
        <string>com.google.jenkins.plugins.computeengine.AutofilledNetworkConfigurationTest.testDoFillSubnetworkItemsValid</string>
        <string>com.google.jenkins.plugins.computeengine.CleanLostNodesWorkTest.shouldCleanLostInstance</string>
        <string>com.google.jenkins.plugins.computeengine.CleanLostNodesWorkTest.shouldNotCleanAnyInstance</string>
        <string>com.google.jenkins.plugins.computeengine.CleanLostNodesWorkTest.shouldNotCleanStoppingInstance</string>
        <string>com.google.jenkins.plugins.computeengine.CleanLostNodesWorkTest.shouldRegisterCleanNodeWorker</string>
        <string>com.google.jenkins.plugins.computeengine.CleanLostNodesWorkTest.shouldRunWithoutClouds</string>
        <string>com.google.jenkins.plugins.computeengine.ComputeEngineCloudTest.construction</string>
        <string>com.google.jenkins.plugins.computeengine.ComputeEngineCloudTest.descriptorFillCredentials</string>
        <string>com.google.jenkins.plugins.computeengine.ComputeEngineCloudTest.descriptorProjectValidation</string>
        <string>com.google.jenkins.plugins.computeengine.ComputeEngineCloudTest.getConfigurationsByLabelMulti</string>
        <string>com.google.jenkins.plugins.computeengine.ComputeEngineCloudTest.getConfigurationsByLabelSimple</string>
        <string>com.google.jenkins.plugins.computeengine.ComputeEngineCloudTest.instanceIdWasGenerated</string>
        <string>com.google.jenkins.plugins.computeengine.ConfigAsCodeTest.shouldCreateCloudInstanceFromCode</string>
        <string>com.google.jenkins.plugins.computeengine.ConfigAsCodeTest.shouldCreateGCEClientFromCode</string>
        <string>com.google.jenkins.plugins.computeengine.GoogleKeyPairTest.KeyPairGeneration</string>
        <string>com.google.jenkins.plugins.computeengine.InstanceConfigurationTest.descriptorBootDiskSizeValidation</string>
        <string>com.google.jenkins.plugins.computeengine.InstanceConfigurationTest.testClient</string>
        <string>com.google.jenkins.plugins.computeengine.InstanceConfigurationTest.testConfigRoundtrip</string>
        <string>com.google.jenkins.plugins.computeengine.InstanceConfigurationTest.testInstanceMetadata</string>
        <string>com.google.jenkins.plugins.computeengine.InstanceConfigurationTest.testInstanceModel</string>
        <string>com.google.jenkins.plugins.computeengine.InstanceConfigurationTest.unnecessary Mockito stubbings</string>
        <string>com.google.jenkins.plugins.computeengine.SharedVpcNetworkConfigurationTest.construction</string>
        <string>com.google.jenkins.plugins.computeengine.SharedVpcNetworkConfigurationTest.descriptorProjectId</string>
        <string>com.google.jenkins.plugins.computeengine.SharedVpcNetworkConfigurationTest.descriptorRegion</string>
        <string>com.google.jenkins.plugins.computeengine.SharedVpcNetworkConfigurationTest.descriptorSubnetwork</string>
      </testDetails>
      [...]
    </compatResult>
  </list>
</entry>

after
@raul-arabaolaza @bmunozm @batmat

@batmat
Copy link
Member

batmat commented Feb 8, 2021

IIUC, if we missed this regression, I would love to see a test reproducing this issue.
Can we add an IT inside https://github.com/jenkinsci/plugin-compat-tester/blob/master/Jenkinsfile#L55 so we cover this case?
Thanks

@@ -113,4 +113,17 @@ public void run(Config config, File baseDirectory, File buildLogFile, String...
}
}

private Set<String> getTypes(Config config) {
if (config == null || config.userProperties == null || !config.userProperties.containsKey("types")) {
return null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default to surefire?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to use surefire as default here: 9f198e6

@imonteroperez
Copy link
Contributor Author

IIUC, if we missed this regression, I would love to see a test reproducing this issue.
Can we add an IT inside https://github.com/jenkinsci/plugin-compat-tester/blob/master/Jenkinsfile#L55 so we cover this case?
Thanks

@batmat added an IT on 28ec40c but seems Jenkinsfile updates are not evaluated in the PR builder right? https://ci.jenkins.io/blue/organizations/jenkins/jenkinsci-libraries%2Fplugin-compat-tester/detail/PR-271/5/pipeline/

@batmat
Copy link
Member

batmat commented Feb 8, 2021

@imonteroperez I've refiled your IT as #272

TBH, for next times, I think you should be made an official maintainer, given that's not your first PR and you've got a special interest to make this repository work nicely :):

https://github.com/jenkinsci/plugin-compat-tester/pulls?q=is%3Apr+author%3Aimonteroperez

And same goes probably for @bmunozm BTW, given https://github.com/jenkinsci/plugin-compat-tester/pulls?q=is%3Apr+author%3Abmunozm

@raul-arabaolaza @oleg-nenashev @jglick as currently declared maintainers, would some of you approve this? Thanks

@jglick
Copy link
Member

jglick commented Feb 8, 2021

as currently declared maintainers

I contribute on occasion but would not consider myself a maintainer.

@imonteroperez
Copy link
Contributor Author

@imonteroperez I've refiled your IT as #272

TBH, for next times, I think you should be made an official maintainer, given that's not your first PR and you've got a special interest to make this repository work nicely :):

https://github.com/jenkinsci/plugin-compat-tester/pulls?q=is%3Apr+author%3Aimonteroperez

And same goes probably for @bmunozm BTW, given https://github.com/jenkinsci/plugin-compat-tester/pulls?q=is%3Apr+author%3Abmunozm

@raul-arabaolaza @oleg-nenashev @jglick as currently declared maintainers, would some of you approve this? Thanks

IT worked as expected now: https://ci.jenkins.io/blue/organizations/jenkins/jenkinsci-libraries%2Fplugin-compat-tester/detail/PR-272/4/pipeline/171/

@raul-arabaolaza raul-arabaolaza merged commit df60aee into jenkinsci:master Feb 10, 2021
@raul-arabaolaza
Copy link
Contributor

@imonteroperez I've refiled your IT as #272

TBH, for next times, I think you should be made an official maintainer, given that's not your first PR and you've got a special interest to make this repository work nicely :):

https://github.com/jenkinsci/plugin-compat-tester/pulls?q=is%3Apr+author%3Aimonteroperez

And same goes probably for @bmunozm BTW, given https://github.com/jenkinsci/plugin-compat-tester/pulls?q=is%3Apr+author%3Abmunozm

@raul-arabaolaza @oleg-nenashev @jglick as currently declared maintainers, would some of you approve this? Thanks

I do agree, both Bea and Ilde are as much as contributors as I am myself.

@batmat
Copy link
Member

batmat commented Feb 10, 2021

OK, I'll add them then. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants