Commit graph

3168 commits

Author SHA1 Message Date
Jesse Simpson
e0a67b1028
test: use more realistic unit-test scenario by not relying on Release.Name
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
2025-04-24 19:20:27 -04:00
Jesse Simpson
d10c5f6429
style: trim space from formatted error messages
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
2025-04-24 19:20:27 -04:00
Jesse Simpson
0e0a8cc765
fix: address no-template-associated type of error
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
2025-04-24 19:20:26 -04:00
Jesse Simpson
013f27c294
fix: use errors.New instead of fmt.Errorf
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
2025-04-24 19:17:28 -04:00
Jesse Simpson
868cdc261f
refactor: reduce flow-control operations
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
2025-04-24 19:17:28 -04:00
Jesse Simpson
48922e21d1
refactor: use struct equality instead of comparing each composition
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
2025-04-24 19:17:28 -04:00
Jesse Simpson
ac98e977c3
refactor: switch to while loop instead of for to reduce unnecessary variables
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
2025-04-24 19:17:28 -04:00
Jesse Simpson
65084371c9
refactor: replace if MatchString with FindStringSubMatch
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
2025-04-24 19:17:28 -04:00
Jesse Simpson
782f6c6409
refactor: shorten regex subexp syntax
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
2025-04-24 19:17:28 -04:00
Jesse Simpson
4b9a9ecaf6
refactor: rename function and add doc-string
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
2025-04-24 19:17:28 -04:00
Jesse Simpson
4f63c73353
refactor: remove impractical safety check
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
2025-04-24 19:17:28 -04:00
Jesse Simpson
5202820f2f
refactor: define regexs at package scope
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
2025-04-24 19:17:28 -04:00
Jesse Simpson
cbdc22128e
refactor: use strings.Builder instead of string concatenation
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
2025-04-24 19:17:28 -04:00
Jesse Simpson
cdcf1bc601
style: remove unnecessary break
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
2025-04-24 19:17:28 -04:00
Jesse Simpson
3cc4cb60ba
refactor: prevent duplicates being inserted rather than post-filtering
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
2025-04-24 19:17:28 -04:00
Jesse Simpson
deea4a0d0e
refactor: remove more unnecessary format calls
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
2025-04-24 19:17:28 -04:00
Jesse Simpson
0a7dd4b269
test: adjust failing test on extra whitespace
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
2025-04-24 19:17:28 -04:00
Jesse Simpson
13b232e061
refactor: make use of regexs for err parsing
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
2025-04-24 19:17:28 -04:00
Jesse Simpson
daf4c34879
fix: use originalErr instead of formatting original error
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
2025-04-24 19:17:28 -04:00
Jesse Simpson
98da3e28b6
fix: add some index checking and fixed a test that relied on type-checking
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
2025-04-24 19:17:28 -04:00
Jesse Simpson
80d7a1b33f
style: make format
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
2025-04-24 19:17:28 -04:00
Jesse Simpson
edf0f7be59
test: adjust formatting for error in test
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
2025-04-24 19:17:28 -04:00
Jesse Simpson
487f72b822
fix: added protection against while-true condition in unbounded for loop
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
2025-04-24 19:17:28 -04:00
Jesse Simpson
6bb836374b
test: adjusted to make it more meaningful and to pass
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
2025-04-24 19:17:28 -04:00
Jesse Simpson
383a758aec
fix: add quality checks to ensure formatted error doesnt remove important info
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
2025-04-24 19:17:28 -04:00
Jesse Simpson
d8bec4e30f
fix: remove comparison from old error message to new
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
2025-04-24 19:17:28 -04:00
Jesse Simpson
c481470985
style: renamed i variable for consistency
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
2025-04-24 19:17:28 -04:00
Jesse Simpson
2e3f6dce28
fix: save to fileLocation rather than fileLocations[i] which gets overwritten
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
2025-04-24 19:17:28 -04:00
Jesse Simpson
f09bbb8ab8
style: consolidate for loops
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
2025-04-24 19:17:28 -04:00
Jesse Simpson
1357db4db1
style: removed variable only used once
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
2025-04-24 19:17:28 -04:00
Jesse Simpson
a56daca82b
style: use interface functions instead of inline logic
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
2025-04-24 19:17:28 -04:00
Jesse Simpson
87f9e2dc45
style: create String function for TraceableError representing one chunk of a stacktrace
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
2025-04-24 19:17:28 -04:00
Jesse Simpson
6cd0c0082a
fix: split up the multiline errors to be more vertical
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
2025-04-24 19:17:28 -04:00
Jesse Simpson
cc477e9f79
fix: adjust test to not require external chart
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
2025-04-24 19:17:26 -04:00
Jesse Simpson
14f902c245
wip: draft at making cleaner stacktraces
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
2025-04-24 19:16:09 -04:00
George Jenkins
ecf1730689
Merge pull request #13460 from justenstall/stdlib-errors-2
fix: replace "github.com/pkg/errors" with stdlib "errors" package
2025-04-23 15:47:35 -07:00
Justen Stall
4905a61026
Merge branch 'main' into stdlib-errors-2
Signed-off-by: Justen Stall <39888103+justenstall@users.noreply.github.com>
2025-04-23 15:58:33 -04:00
Matt Farina
fcd37bcea7
Merge pull request #30783 from rpolishchuk/investigate-TestValidateChartIconPresence
fix: chart icon presence test
2025-04-23 20:58:14 +01:00
Robert Sirchia
d9bc0a948c
Merge pull request #30777 from ryanhockstad/merge-fix
fix: null merge. closes #30587
2025-04-23 15:07:54 -04:00
Scott Rigby
a911aa2112
Merge pull request #9175 from dastrobu/copy-dependencies-on-aliasing
fix: copy dependencies on aliasing to avoid sharing chart references on multiply aliased dependencies
2025-04-23 14:40:51 -04:00
Daniel Strobusch
b183eccfc4
copy dependency metadata on aliasing to avoid sharing imported values
imported values are stored in dependency objects, which breaks if a chart dependency is shared among multiple aliases.
By copying the dependency objects in the metadata values can be imported correctly.

Supersedes #10174

Signed-off-by: Daniel Strobusch <1847260+dastrobu@users.noreply.github.com>
2025-04-23 11:32:45 +02:00
Daniel Strobusch
df7befd208
copy dependencies on aliasing to avoid sharing chart references on multiply aliased dependencies
Dependencies keep a reference on their parent chart, which breaks if a chart reference is shared among multiple aliases.
By copying the dependencies, parent information can be set correctly to render the templates as expected later on.

Note that this change will make ChartFullPath return a different path for sub-subcharts. It will contain the alias names instead of the path to the chart files which makes it consistent with paths to templates on the subchart level.

Closes #9150

Signed-off-by: Daniel Strobusch <1847260+dastrobu@users.noreply.github.com>
2025-04-23 11:16:05 +02:00
Stephen Murray
1682895636 ref(helm): Export Chart Not Found error
Closes #30746

Signed-off-by: Stephen Murray <stephenmurrayengineer@gmail.com>
2025-04-22 20:29:38 +01:00
Rostyslav Polishchuk
1c8d1e375f fix: chart icon presence test
The `TestValidateChartIconPresence` test fails when run after
`TestValidateChartIconURL` as they both are using a global
variable `badChart.Icon`

```
: go test -v -test.shuffle 1 -run '^(TestValidateChartIconPresence|TestValidateChartIconURL)$' ./pkg/lint/rules/
-test.shuffle 1
=== RUN   TestValidateChartIconURL
--- PASS: TestValidateChartIconURL (0.00s)
=== RUN   TestValidateChartIconPresence
    chartfile_test.go:171: validateChartIconPresence to return a linter error, got no error
--- FAIL: TestValidateChartIconPresence (0.00s)
FAIL
FAIL    helm.sh/helm/v4/pkg/lint/rules  0.051s
FAIL

: go test -v -test.shuffle 2 -run '^(TestValidateChartIconPresence|TestValidateChartIconURL)$' ./pkg/lint/rules/
-test.shuffle 2
=== RUN   TestValidateChartIconPresence
--- PASS: TestValidateChartIconPresence (0.00s)
=== RUN   TestValidateChartIconURL
--- PASS: TestValidateChartIconURL (0.00s)
PASS
ok      helm.sh/helm/v4/pkg/lint/rules  0.050s
```

This commit:

1. Remove dependency on global variable
2. Explicitly set the state of the test object.

Signed-off-by: Rostyslav Polishchuk <rostyslavp@google.com>
2025-04-22 18:56:13 +00:00
Justen Stall
fc6c5e5edb
remove WaitAndGetCompletedPodPhase function
Signed-off-by: Justen Stall <39888103+justenstall@users.noreply.github.com>
2025-04-21 17:19:48 -04:00
Justen Stall
73545f9a3e
one more test output
Signed-off-by: Justen Stall <39888103+justenstall@users.noreply.github.com>
2025-04-21 16:08:21 -04:00
Justen Stall
4a6092bd6c
update another test output
Signed-off-by: Justen Stall <39888103+justenstall@users.noreply.github.com>
2025-04-21 16:04:28 -04:00
Justen Stall
7a316c8d51
update expected error message in install test
Signed-off-by: Justen Stall <39888103+justenstall@users.noreply.github.com>
2025-04-21 15:57:54 -04:00
Matthieu MOREL
d3eeb2c942 chore: remove github.com/hashicorp/go-multierror dependency
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-04-21 19:27:15 +02:00
Justen Stall
3877ec9049
fix golangci-lint issues
Signed-off-by: Justen Stall <39888103+justenstall@users.noreply.github.com>
2025-04-21 12:44:40 -04:00