Skip to content

Commit 972200d

Browse files
committed
refactor(test): migrate lint tests to use reusable fixtures
Migrates 10 test functions in lint_test.go to use testdata fixtures instead of inline file creation, following the pattern established in image_extraction_test.go. Changes: - Add helper functions: getTestDataPath, copyFixtureToTemp - Create testdata/lint/ with 39 fixture files across 8 scenarios - Migrate tests: TestLint_VerboseFlag, TestLint_ChartValidationError, TestLint_AutodiscoveryWithMixedManifests, and 7 others - Reduce test file: 2,355 → 1,888 lines (20% reduction) - Reduce os.WriteFile calls: 74 → 42 (43% reduction) Fixtures created: - simple-chart/ - Basic chart for simple tests - multi-chart-project/ - Multiple charts scenario - chart-missing-helmchart/ - Validation error tests - orphaned-helmchart/ - Validation warning tests - mixed-manifests-autodiscovery/ - Mixed resource types - mixed-manifests-yaml-yml/ - Mixed file extensions (.yaml/.yml) - hidden-dirs-test/ - Hidden directory testing (.github) - configs/ - 6 reusable config templates Remaining inline tests use dynamic paths, test error scenarios, or are minimal configs where fixtures would add overhead. All tests pass.
1 parent c577b61 commit 972200d

File tree

39 files changed

+427
-584
lines changed

39 files changed

+427
-584
lines changed

cli/cmd/lint_test.go

Lines changed: 117 additions & 584 deletions
Large diffs are not rendered by default.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
charts:
2+
- path: chart
3+
manifests:
4+
- manifests/*.yaml
5+
repl-lint:
6+
linters:
7+
helm:
8+
disabled: true
9+
preflight:
10+
disabled: true
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: v2
2+
name: test-app
3+
version: 1.0.0
4+
description: Test chart without matching HelmChart manifest
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Empty manifests directory - no HelmChart manifest
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
repl-lint:
2+
version: 1
3+
linters:
4+
helm: {}
5+
preflight: {}
6+
support-bundle: {}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
repl-lint:
2+
linters:
3+
helm: {}
4+
preflight:
5+
disabled: true
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
charts: []
2+
manifests: []
3+
preflights: []
4+
repl-lint:
5+
linters:
6+
helm: {}
7+
preflight:
8+
disabled: true
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
repl-lint:
2+
tools:
3+
helm: "latest"
4+
preflight: "latest"
5+
support-bundle: "latest"
6+
linters:
7+
helm: {}
8+
preflight:
9+
disabled: true
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
repl-lint:
2+
tools:
3+
helm: "3.14.4"
4+
preflight: "0.123.9"
5+
support-bundle: "0.123.9"
6+
linters:
7+
helm: {}
8+
preflight:
9+
disabled: true
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
manifests:
2+
- manifests/*.yaml
3+
repl-lint:
4+
linters:
5+
helm: {}
6+
preflight: {}

0 commit comments

Comments
 (0)