Fixing test flakiness

The global application whitelist was getting set in a test but not cleaned up.
This was the reason tests were failing in some environments depending in which order the tests were run.