swupd-client icon indicating copy to clipboard operation
swupd-client copied to clipboard

Testlib: provide a function to clean up all target-dir

Open castulo opened this issue 4 years ago • 2 comments

For some tests it make sense to use a global_setup to create the update content once, but we need a way to really clean up the target system between tests. So the proposal is to create a function that removes the target-dir entirely and recreates a new, empty one. We could then create the update content in a global_setup, and we could cleanup the target-dir during a teardown, making the global_setup more accessible for more tests.

castulo avatar Apr 20 '20 21:04 castulo

This won't solve the problem because any change in the test_env outside of target-dir will be propagated. I don't like the idea on having a global environment that sometimes is used and sometimes is not. The behavior of tests are already too different if we use test_setup() or global_setup() to create the test environment.

otaviobp avatar Apr 20 '20 21:04 otaviobp

This won't solve the problem because any change in the test_env outside of target-dir will be propagated. I don't like the idea on having a global environment that sometimes is used and sometimes is not. The behavior of tests are already too different if we use test_setup() or global_setup() to create the test environment.

It will solve the problem for some cases. For example, if you create a test environment with some bundles, and then you have a bunch of tests that are validating adding bundles the you can use it, because you are not changing anything from the original update content, you are just changing the system where you are installing to. If in a test you need something that changes the update content but should not change for the other tests then yes, this won't work. But I think is responsibility of the test designer to know when they can or can't use this for a test. It seems pretty obvious to me.

castulo avatar Apr 20 '20 22:04 castulo