e2e-framework icon indicating copy to clipboard operation
e2e-framework copied to clipboard

Execute "testenv.Finish" even when test panics

Open dapdelivery opened this issue 2 years ago • 7 comments
trafficstars

Currently we observe that "testenv.Finish" does not execute when the test ("testenv.Test") has a panic. Ideally, we want the testenv.Finish to execute regardless of test status (almost like a finally block of code in python) since we have cleanup written in this code block.

Also, is there a plan to add "BeforeTest" and "AfterTest" in the framework (not referring to BeforeEachTest or AfterEachTest) and the requirement would be "AfterTest" executes regardless of the test status as well.

dapdelivery avatar Mar 10 '23 06:03 dapdelivery

Could you elaborate a bit more on what the difference between Before/AfterTest and Before/AfterEachTest would be?

pranavb23 avatar Mar 18 '23 07:03 pranavb23

@harshanarayana this sounds like we need some recover logic to catch hard panics (not just testing.Fatal)

vladimirvivien avatar Apr 21 '23 17:04 vladimirvivien

A fix here may also be a fix for #188

vladimirvivien avatar Apr 21 '23 17:04 vladimirvivien

@dapdelivery It would be nice if you could provide a simple example of this use case.

matrus2 avatar Jun 23 '23 14:06 matrus2

I confirm that if you get panic inside a test it will not run the testenv.Finish. In this case there is no way of running any cleanup when a panic occurs. I think this is related to the missing upstream functionality described here

adabuleanu avatar Dec 15 '23 21:12 adabuleanu

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Mar 17 '24 12:03 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle rotten
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot avatar Apr 16 '24 12:04 k8s-triage-robot