Add a better test for service environment variables. Fix bugs.

Closes https://github.com/GoogleCloudPlatform/kubernetes/issues/876
done.