Fix flakey env var tests

Map iteration order isn't guaranteed, but deterministic env var order is desired so we sort by env var name.