avocado icon indicating copy to clipboard operation
avocado copied to clipboard

Interrupt to run post test workers

Open AdamWHuffman opened this issue 2 years ago • 2 comments

I have implemented multiple pre and post test plugins to support various hosts.

When I run avocado run <test> -m <muxfile> for example, then I send an interrupt, I would like a way to run all of the post test workers so that my assets are cleaned up. These assets include hosts like ansible-created VMs that are left running.

An alternative is signal handlers inside of my plugins, but this causes quite a few issue as they must ignore the signals from the base avocado workers.

This may already be possible with configurations, but I have not yet found the option.

AdamWHuffman avatar Feb 22 '24 21:02 AdamWHuffman

Hi @AdamWHuffman, thank you for creating this issue. You are right, this hasn't been implemented in avocado yet. Right now, avocado will terminate all the tasks and won't run the post test ones on terminated signal.

I agree with you that we should support post test plugins for clean-ups. IMO, we can create PostTestCleanup interface from PostTest plugins which will ensure the same behaviour as TearDown method in avocado-instrumented tests for post-test plugins. @clebergnu what do you think?

richtja avatar Feb 26 '24 10:02 richtja

It's our understanding that Avocado currently does not offer the clean up for interrupted tests in a test-agnostic way (only avocado-isntrumented tests allow for that).

It'd a nice improvement, but not a bug per-se.

clebergnu avatar Jul 24 '24 15:07 clebergnu