You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The TestEnvironment::GetRecordedOptionalVariable method reads the value of the environment variable, which may be null when not defined. That value is then passed into the RecordedVariableOptions when specified which attempts to parse the value using the ConnectionString type, causing an exception when validated due to the connection string value itself being null.
Optional environment variables do not need to be set and do not result in an exception when null.
Using GetRecordedOptionalVariable with an optional environment variable is safe.
Implementation Thoughts
It looks as if the most appropriate place to adjust behavior would either be within the TestEnvironment, where null or empty values are not passed to the RecordedVariableOptions or within the options, adding a null or empty check before processing the connection string. I'm not sure of the intent for having overrides or extensions to RecordedVariableOptions where it may be desirable to invoke regardless of value.
The text was updated successfully, but these errors were encountered:
ghost
added
the
needs-triage
Workflow: This is a new issue that needs to be triaged to the appropriate team.
label
Sep 3, 2020
The intent of RecordedVariableOptions is for consumers to be able to describe what secrets are inside the value of the variable so we can sanitize them before storing it.
In this case skipping the entire code-path when no variable exists seems the right thing to do.
Observed Behavior
The
TestEnvironment::GetRecordedOptionalVariable
method reads the value of the environment variable, which may benull
when not defined. That value is then passed into theRecordedVariableOptions
when specified which attempts to parse the value using theConnectionString
type, causing an exception when validated due to the connection string value itself being null.This was observed in the Service Bus library, when it's
ServiceBusTestEnvironment::OverrideServiceBusConnectionString
is not set.Expected Behavior
null
.GetRecordedOptionalVariable
with an optional environment variable is safe.Implementation Thoughts
It looks as if the most appropriate place to adjust behavior would either be within the
TestEnvironment
, where null or empty values are not passed to theRecordedVariableOptions
or within the options, adding a null or empty check before processing the connection string. I'm not sure of the intent for having overrides or extensions toRecordedVariableOptions
where it may be desirable to invoke regardless of value.The text was updated successfully, but these errors were encountered: