Skip to content

Commit

Permalink
Update helm_test.go
Browse files Browse the repository at this point in the history
  • Loading branch information
dbw7 committed Mar 13, 2024
1 parent 7291e75 commit 4214ecb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/helm/helm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,17 +291,21 @@ func TestTemplateCommand(t *testing.T) {
}

func TestParseChartContents_InvalidPayload(t *testing.T) {
contents := "---abc"
contents := `---
# Source
invalid-resource
`

resources, err := parseChartContents(contents)
require.Error(t, err)

assert.ErrorContains(t, err, "invalid resource")
assert.ErrorContains(t, err, "yaml: unmarshal errors:\n line 2: cannot unmarshal !!str `invalid...` into map[string]interface {}")
assert.Nil(t, resources)
}

func TestParseChartContents(t *testing.T) {
contents := `
# Source
apiVersion: helm.cattle.io/v1
kind: HelmChart
metadata:
Expand All @@ -311,6 +315,7 @@ spec:
repo: https://suse-edge.github.io/charts
chart: metallb
---
# Source
apiVersion: v1
kind: Namespace
metadata:
Expand Down

0 comments on commit 4214ecb

Please sign in to comment.