-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Adding test for pkg/chart/v2/util AsMap() #11064
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: main
Are you sure you want to change the base?
Conversation
eec39a6
to
c597c6e
Compare
update golangci-lint from version 1.43.0 to the latest linter version 1.46.2. Fixed linting issues: Remove newline from error string in internal/test/test.go and remove redundant nil / len(0) check from asMap() function in pkg/chartutil/values.go. Guard this function by a unit test. Signed-off-by: Felix Becker <git@felixbecker.name>
c597c6e
to
89d2d67
Compare
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
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.
@devfbe Do you mind pushing again to kick off CircleCI as uncle to restart it on my side?
Ping @devfbe |
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.
@devfbe this is quite an old one, and most of this PR is no longer applicable. However, TestAsMap()
could still be added if you want to update this PR, or if someone else wants to take this on. I'll rename the PR accordingly.
@@ -68,7 +68,7 @@ func (v Values) Table(name string) (Values, error) { | |||
// | |||
// It protects against nil map panics. | |||
func (v Values) AsMap() map[string]interface{} { | |||
if v == nil || len(v) == 0 { | |||
if len(v) == 0 { |
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 code is already in main now
@@ -13,7 +13,7 @@ jobs: | |||
|
|||
environment: | |||
GOCACHE: "/tmp/go/cache" | |||
GOLANGCI_LINT_VERSION: "1.43.0" | |||
GOLANGCI_LINT_VERSION: "1.46.2" |
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.
We have moved from CircleCI to GitHub actions. These upgrades are now handled by dependabot (example PR #30535)
@@ -25,6 +25,22 @@ import ( | |||
"helm.sh/helm/v3/pkg/chart" | |||
) | |||
|
|||
func TestAsMap(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.
One thing from this PR we do not have is a function like this to test AsMap()
. This could still be added if you want to update this PR. The new file location is https://github.com/helm/helm/blob/main/pkg/chart/v2/util/values_test.go.
@@ -79,7 +79,7 @@ func compare(actual []byte, filename string) error { | |||
} | |||
expected = normalize(expected) | |||
if !bytes.Equal(expected, actual) { | |||
return errors.Errorf("does not match golden file %s\n\nWANT:\n'%s'\n\nGOT:\n'%s'\n", filename, expected, actual) | |||
return errors.Errorf("does not match golden file %s\n\nWANT:\n'%s'\n\nGOT:\n'%s'", filename, expected, actual) |
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 change is already in main
Update golangci-lint from to latest version:
Update golangci-lint from version 1.43.0 to the latest linter version 1.46.2.
This is the latest version of golangci-lint which finds new (small) errors in the source code. This linting issues have been fixed in this merge request, too.
Fixed linting issues:
Remove newline from error string in internal/test/test.go
and remove redundant nil / len(0) check from asMap() function
in pkg/chartutil/values.go. Guard this function by a unit test.
Special notes for your reviewer:
Only linting issues fixed, added unit tests for changed logic to ensure nothing breaks.
If applicable: