Only print necessary env vars in tests
What does this MR do?
Only print necessary env vars in tests
Why was this MR needed?
When using the env
or set
keyword it prints all the environments
that are available in the job. These can be problematic printing
environments that we shouldn't print. Update the tests to run an echo
on the specific variables that we are testing instead. This makes
running the tests safer since it won't print in every environment.
In !2951 (merged) we only allow certain environment variables, however, it's better to have multiple layers of protection rather than 1 just in case 1 of them regresses.
What's the best way to test this MR?
Make sure that NOT_HERE
environment variable isn't printed.
NOT_HERE=NOT_HERE go test -v -run TestBuildJobStatusEnvVars -tags integration ./executors/shell/ | grep 'NOT_HERE'
What are the relevant issue numbers?
Edited by Steve Xuereb