Opened 4 years ago

Last modified 3 years ago

#21139 new enhancement

[PATCH] BasicPreferences Test Isolation — at Version 1

Reported by: taylor.smock Owned by: team
Priority: normal Milestone: Longterm
Component: Unit tests Version:
Keywords: junit5 Cc:

Description (last modified by taylor.smock)

This is a followup of comment:13:ticket:21064 (Don-vip):

Thanks! For this ticket I'll stick with the simple solution, even if not ideal. Isolating unit tests is a long-term task.

As in comment:12:ticket:21064, the two patches attached to this ticket do the following:

  • attachment:21139.patch​ iterates through all loaded classes (I make an assumption that we only have one classloader), and sets all AbstractProperty preferences fields to the new preferences. This uses reflection to fiddle with final fields, which has some pitfalls.
  • attachment:21139.2.patch​ is the same as attachment:21139.patch​, except it additionally resets the preferences fields to null. This is better from a test isolation view, but I can almost guarantee that additional tests will fail.

Change History (3)

by taylor.smock, 4 years ago

Attachment: 21139.patch added

Reset all static AbstractProperty preferences fields to the new Config.

by taylor.smock, 4 years ago

Attachment: 21139.2.patch added

Additionally reset static AbstractProperty preference fields to null after each test (this may cause other test failures)

comment:1 by taylor.smock, 4 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.