Skip to content

Commit

Permalink
test: adjusted to make it more meaningful and to pass
Browse files Browse the repository at this point in the history
  • Loading branch information
jessesimpson36 committed Dec 31, 2024
1 parent e71de8c commit 7ec0b14
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
1 change: 0 additions & 1 deletion pkg/engine/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,6 @@ func determineIfFormattedErrorIsAcceptable(formattedErr error, originalErr error
}

equivalenceRating := (float64(matchCount) / float64(len(formattedErrTokens))) * 100
fmt.Printf("Rating: %f\n", equivalenceRating)
if equivalenceRating >= 80 {
return formattedErr
}
Expand Down
15 changes: 12 additions & 3 deletions pkg/engine/engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1318,6 +1318,17 @@ func TestNestedHelpersProducesMultilineStacktrace(t *testing.T) {
},
}

expectedErrorMessage := `NestedHelperFunctions/templates/svc.yaml:1:9
executing "NestedHelperFunctions/templates/svc.yaml" at <include "nested_helper.name" .>:
error calling include:
NestedHelperFunctions/templates/_helpers_1.tpl:1:39
executing "nested_helper.name" at <include "common.names.get_name" .>:
error calling include:
NestedHelperFunctions/charts/common/templates/_helpers_2.tpl:1:50
executing "common.names.get_name" at <.Release.Name>:
nil pointer evaluating interface {}.Name
`

v := chartutil.Values{}

val, _ := chartutil.CoalesceValues(c, v)
Expand All @@ -1327,7 +1338,5 @@ func TestNestedHelpersProducesMultilineStacktrace(t *testing.T) {
_, err := Render(c, vals)

assert.NotNil(t, err)
if err != nil {
t.Errorf("Failed to render templates: %s", err)
}
assert.Equal(t, expectedErrorMessage, err.Error())
}

0 comments on commit 7ec0b14

Please sign in to comment.