Skip to content

Add teardown actions and stable action order #169

@arcivanov

Description

@arcivanov

There is a need to cleanup around tasks. For example there has to be a way to start a server, run integration tests and stop the server if a failure occurs. Not being able to stop a server leaves processes hanging around, requires a cleanup and makes it very hard to debug failures.

Therefore:

  1. Add an attribute to @after, called teardown. The attribute is False by default.
    • If an exception occurs anywhere in @before or in a task or in any of the @after actions, the exception is recorded, then all @after actions with teardown=True are executed
    • While executing teardown @after actions, the errors raised therein are suppressed. The executing actions log their errors without raising them.
    • Once all teardown @after actions are executed the originating error is raised.
  2. Use ordered dictionaries in ExecutionManager to make sure that the order the actions are registered in is the order that actions are executed in. This is important to ensure that behaviors are predictable as far as cleanup order.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions