Local policies faulty spec
This bug was caused by resource names in tests. Short strings like "r1" were sometimes randomly generated in metadata's token. Making these names long, as well as using an underscore, will prevent this from happening again.
Edited by Jan Meizner