-
Notifications
You must be signed in to change notification settings - Fork 136
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
Bug fix: have data.list("/") read from root of library #661
Conversation
Signed-off-by: Garrett Cheadle <[email protected]>
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.
LGTM. Thank you for the thorough approach, here.
Comments are just for your consideration.
If/When you're happy, good to merge.
pkg/cmd/template/cmd_test.go
Outdated
@@ -210,6 +210,94 @@ data: #@ data.read("/funcs/data")`) | |||
assert.Equal(t, expectedYAMLTplData, string(file.Bytes())) | |||
} | |||
|
|||
func TestDataListRelativeToRootInDataValuesAndSchema(t *testing.T) { |
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.
These tests give me a lot of confidence that our "absolute path" loading works in both schema and data values -flavored templates. 👍🏻 Thank you for investing in this.
As I look around at the test files in pkg/cmd/template
... their ranks are growing. cmd_test.go
is almost a KLOC.
If you haven't already thought about this, I'm wondering if these tests would be more "at home" in one of these test files:
cmd_root_library_test.go
cmd_data_values_test.go
@@ -97,7 +98,7 @@ func (pp DataValuesSchemaPreProcessing) collectSchemaDocs(schemaFiles []*FileInL | |||
} | |||
|
|||
func (pp DataValuesSchemaPreProcessing) extractSchemaDocs(schemaFile *FileInLibrary) ([]*yamlmeta.Document, error) { | |||
libraryCtx := LibraryExecutionContext{Current: schemaFile.Library, Root: NewRootLibrary(nil)} | |||
libraryCtx := LibraryExecutionContext{Current: schemaFile.Library, Root: pp.rootLibrary} |
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.
How about how minimizing the differences between Data Values and Data Values Schema processing makes this sweetly obvious that making the exact same change in both flows is the right move? ⭐
No description provided.