Make tests independent of environment
(cherry picked from commit 83e5ce265718e4f6e9bc60c0c1b7c1a45fd0a972)