MCPcopy Index your code
hub / github.com/databus23/helm-diff / TestLocalCmdWithChanges

Function TestLocalCmdWithChanges

cmd/local_test.go:105–145  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

103}
104
105func TestLocalCmdWithChanges(t *testing.T) {
106 manifest1 := `---
107apiVersion: v1
108kind: ConfigMap
109metadata:
110 name: test-config
111 namespace: default
112data:
113 key: value1
114`
115 manifest2 := `---
116apiVersion: v1
117kind: ConfigMap
118metadata:
119 name: test-config
120 namespace: default
121data:
122 key: value2
123`
124 setupFakeHelmDual(t, manifest1, manifest2)
125
126 chart1 := t.TempDir()
127 chart2 := t.TempDir()
128
129 output, err := captureStdout(func() {
130 cmd := localCmd()
131 cmd.SetArgs([]string{chart1, chart2})
132
133 if execErr := cmd.Execute(); execErr != nil {
134 t.Errorf("Expected no error but got: %v", execErr)
135 }
136 })
137
138 if err != nil {
139 t.Fatalf("Failed to capture stdout: %v", err)
140 }
141
142 if !strings.Contains(output, "value1") || !strings.Contains(output, "value2") {
143 t.Errorf("Expected diff output containing value1 and value2, got: %q", output)
144 }
145}
146
147func TestLocalCmdDetailedExitCode(t *testing.T) {
148 manifest1 := `---

Callers

nothing calls this directly

Calls 3

setupFakeHelmDualFunction · 0.85
captureStdoutFunction · 0.85
localCmdFunction · 0.85

Tested by

no test coverage detected