-
Notifications
You must be signed in to change notification settings - Fork 877
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
Allow empty maps for yaml (#907) #908
Conversation
assert.Nil(t, err) | ||
assert.Equal(t, "{}\n", string(bytes)) | ||
} | ||
|
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.
This fails like this:
--- FAIL: TestEmpty3 (0.00s)
store_test.go:206:
Error Trace: store_test.go:206
Error: Expected nil, but got: &errors.errorString{s:"Error marshaling to yaml: yaml: expected SCALAR, SEQUENCE-START, MAPPING-START, or ALIAS, but got document end"}
Test: TestEmpty3
store_test.go:207:
Error Trace: store_test.go:207
Error: Not equal:
expected: "{}\n"
actual : ""
Diff:
--- Expected
+++ Actual
@@ -1,2 +1 @@
-{}
Test: TestEmpty3
FAIL
coverage: 69.5% of statements
FAIL go.mozilla.org/sops/v3/stores/yaml 0.066s
FAIL
I wanted to demonstrate that in CI, but the test failed fast for #882.
@@ -361,11 +361,7 @@ func (store *Store) EmitPlainFile(branches sops.TreeBranches) ([]byte, error) { | |||
mapping.Kind = yaml.MappingNode | |||
// Marshal branch to global mapping node | |||
store.appendTreeBranch(branch, &mapping) | |||
if len(mapping.Content) == 0 { | |||
doc.HeadComment = mapping.HeadComment |
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.
This branch always cause an error as far as I know, and is useless.
|
(You probably have to close+reopen to re-run CI.) |
@ajvb could you please re-run CI for this one (probably closing+reopening is required)? I think it's still ready for merging, but it would be good to see a new test run :) |
Merged latest develop. |
Fixes #907
This allows following usage in sops-3.7.x, just like in sops-3.6.x and earlier.