-
Notifications
You must be signed in to change notification settings - Fork 140
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
Modify resolution of global variables to avoid errors on plain strings #208
Modify resolution of global variables to avoid errors on plain strings #208
Conversation
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.
Just a couple comments that need to be updated
pkg/config/config_test.go
Outdated
var testkey = "testkey" | ||
var testkey1 = "testkey1" | ||
var testkey2 = "testkey2" | ||
var testkey3 = "testkey3" | ||
bc := getBlueprintConfigForTest() | ||
ctyMap := make(map[string]cty.Value) | ||
err = bc.Config.ResolveGlobalVariables(ctyMap) | ||
c.Assert(err, IsNil) | ||
|
||
// confirm that a plain string (non-variable) is unchanged and errors |
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.
and errors -> and doesn't return an error
Or just remove it, whichever you prefer
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.
I have updated this comment to match the test.
pkg/config/config_test.go
Outdated
c.Assert(err, NotNil) | ||
c.Assert(ctyMap[testkey], Equals, testCtyString) | ||
c.Assert(err, IsNil) | ||
c.Assert(ctyMap[testkey1], Equals, testCtyString) | ||
|
||
// confirm that a literal, but not global, variable is unchanged and errors |
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.
Same here
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.
I have updated this comment to match the test.
@heyealex I think you meant to assign this back to me. I fixed the comments you asked to be changed and also updated a comment on the function itself to match the new behavior. |
pkg/config/config_test.go
Outdated
bc := getBlueprintConfigForTest() | ||
ctyMap := make(map[string]cty.Value) | ||
err = bc.Config.ResolveGlobalVariables(ctyMap) | ||
c.Assert(err, IsNil) | ||
|
||
// confirm that a plain string (non-variable) is unchanged and errors | ||
// confirm plain string is unchanged and does no/ error |
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.
typo: no/ -> not
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.
Yeesh. Fixed.
I would like to squash the last commit on top of the related commit on this branch. So you can review by informally saying LGTM and then I'll do that and you can approve the final branch. Force pushing now can confuse the review process. |
* do not error when encountering string values that are not literal global variables * this ensures all values _except_ literal global variables are left unmodified * modify unit test to test a maps of size greater than 1 and mixed types (plain strings and global variables); issue went uncaught because iteration over maps does not have a guaranteed order and the code continued to succeed in limited testing
Submission Checklist
pre-commit install
make tests
change?
guides?