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

Function TestLocalCmdNamespace

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

Source from the content-addressed store, hash-verified

210}
211
212func TestLocalCmdNamespace(t *testing.T) {
213 manifestYAML := `---
214apiVersion: v1
215kind: ConfigMap
216metadata:
217 name: test-config
218data:
219 key: value
220`
221 argsFile := t.TempDir() + "/args"
222 setupFakeHelm(t, "capture_args", manifestYAML, argsFile, "")
223
224 chart1 := t.TempDir()
225 chart2 := t.TempDir()
226
227 cmd := localCmd()
228 cmd.SetArgs([]string{chart1, chart2, "--namespace", "myns"})
229
230 err := cmd.Execute()
231 if err != nil {
232 t.Fatalf("Expected no error but got: %v", err)
233 }
234
235 args1, err := os.ReadFile(argsFile)
236 if err != nil {
237 t.Fatalf("Expected fake helm args file to be readable, but got: %v", err)
238 }
239 if !strings.Contains(string(args1), "--namespace myns") {
240 t.Errorf("Expected --namespace myns in helm template args, got: %q", string(args1))
241 }
242}
243
244func TestLocalCmdHelmTemplateError(t *testing.T) {
245 setupFakeHelm(t, "error", "", "", "")

Callers

nothing calls this directly

Calls 2

setupFakeHelmFunction · 0.85
localCmdFunction · 0.85

Tested by

no test coverage detected