Skip to content

Make sure stub_env keys and values are always String

Gabriel Mazetto requested to merge brodock/make-stub-env-always-use-string into master

What does this MR do and why?

We use stub_env in many places in our codebase, which currently accepts any type of value and object as both key or value.

ENV can only provide keys and values as String. If we have a certain code that expects and Integer and don't preemptively do typecast, we could end-up having specs stubbing and Integer, which could lead to a false positive. In production that code path will fail, but our tests will never be able to catch that.

The best approach is to fort stub_env to always convert keys and values to String, so if anywhere in the codebase we have this type of oversight, tests will break as they should.

How to set up and validate locally

If tests goes green, this worked.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Fixes #384468 #118661 (closed)

Edited by Gabriel Mazetto

Merge request reports

Loading