PingCAP-QE / ci

Continue intergration tests
Apache License 2.0
19 stars 96 forks source link

feat: try to collect failure log after test timeout #2986

Closed purelind closed 3 weeks ago

purelind commented 3 weeks ago

try to collect failure log after test timeout

ti-chi-bot[bot] commented 3 weeks ago

I have already done a preliminary review for you, and I hope to help you do a better job.

Based on the pull request title and description, it seems that the author is trying to implement a feature to collect failure logs after a test timeout. Looking at the diff, it seems that the change is only in the pull_lightning_integration_test.groovy file. The change is in the post section where the failure keyword is replaced with unsuccessful.

The change seems to be in the right direction as it is trying to collect logs after a test timeout. However, the change from failure to unsuccessful needs to be reviewed more carefully. The failure keyword is used to catch all types of failures, including build failures, test failures, and other types of failures. The unsuccessful keyword, on the other hand, is only used to catch test failures.

It is possible that the change from failure to unsuccessful might cause some logs to be missed if the failure is not a test failure. So, it is recommended to test the change thoroughly before merging it.

One possible fix would be to keep the failure keyword and add an additional step to catch test failures. For example, the following code can be added to catch test failures:

post {
  // Catch test failures
  always {
    junit 'target/surefire-reports/*.xml'
  }

  // Collect logs
  failure {
    sh label: "collect logs", script: """
      ls /tmp/lightning_test
      tar -cvzf log-${TEST_GROUP}.tar.gz \$(find /tmp/lightning_test/ -type f -name "*.log")
    """
  }
}

This way, all types of failures will be caught, and the logs will be collected after any type of failure.

purelind commented 3 weeks ago

/hold

wait for relay test link https://do.pingcap.net/jenkins/blue/organizations/jenkins/pingcap%2Ftidb%2Fpull_lightning_integration_test/detail/pull_lightning_integration_test/842/pipeline

ti-chi-bot[bot] commented 3 weeks ago

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - **[pipelines/OWNERS](https://github.com/PingCAP-QE/ci/blob/main/pipelines/OWNERS)** Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
purelind commented 3 weeks ago

/unhold