Hello Igniters,

I'd like to discuss the way we treat system properties in our test codebase.
It's a common pattern where we set system property in "beforeTestsStarted"
and clear it in "afterTestsStopped". Purest example that I've found is class
"RedisProtocolGetAllAsArrayTest".

There are similar things with "beforeTest"/"afterTest" or huge
"try/finally" blocks
right in test methods.

I think that all this code can be avoided and solution might look like this:

@Test
@WithSystemProperty(key = IGNITE_PROPERTY_NAME, value = "true")
public void testSomething() throws Exception {
    ...
}

Same annotation might be used on class, this way new system property will
be applied to all test methods in the class.

I already created the issue for this change [1] and PR with demo [2]. It
contains
implementation of annotation processing and a few migrated tests. If you
like
the idea then I will migrate all the other tests on the same mechanism.

What do you think?

[1] https://issues.apache.org/jira/browse/IGNITE-11323
[2] https://github.com/apache/ignite/pull/6109

-- 
Sincerely yours,
Ivan Bessonov

Reply via email to