-
Notifications
You must be signed in to change notification settings - Fork 280
[bug fix] Fix unavailable public variables when creating tests #717
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
[bug fix] Fix unavailable public variables when creating tests #717
Conversation
…ent-version Add TFS 2017 Update 3 agent version.
Deep Dive on Building Custom Build or Deploy Tasks
* Add task.json schema file * Allow any "connectedService:" type of input * Added the "id" field
…cefiles Allow multiple resource files
Properly escape property value to handle non string types
* Error on multiline secret * v2.3.0
…er/azure-pipelines-task-lib into fix-unavailable-variables-in-tests
@egor-bryzgalov Could you please have a look at this? I'm not sure if this PR contains the required stuff to be merged :D |
@damccorm If there is anything I can clarify in the review process I am willing to help =) |
@@ -243,7 +243,11 @@ export function _getVariable(name: string): string | undefined { | |||
} | |||
else { | |||
// get the public value | |||
varval = process.env[key]; | |||
if (_startsWith(key, 'VSTS_TASKVARIABLE_')) { | |||
varval = _knownVariableMap[key].value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add null check here - so undefined value will be returned for this case, but not an exception being thrown? (the same as for process.env[key])
@bartier I'm still not confident about necessity of these changes - why we can't just use |
@anatolybolshakov Could you please give an example of using setAnswers to achieve that? I'm not sure what field of |
Closes #716
Currently, it's not possible to create public mock variables using the function
setVariableName('key', 'value', false)
from a TaskMockRunner. This PR attempts to fix this, so it handles the public task variables whenVariableInfo[]
should be returned by the functiongetVariables()
.Example:
Consider this test idea:
If our task needs to access a public variable using
getVariables
, it only gets the secrets (in this example only EGG).I added a test to validate this case, so I hope this PR could be merged as soon as possible =)