(t *testing.T)
| 103 | } |
| 104 | |
| 105 | func TestLocalCmdWithChanges(t *testing.T) { |
| 106 | manifest1 := `--- |
| 107 | apiVersion: v1 |
| 108 | kind: ConfigMap |
| 109 | metadata: |
| 110 | name: test-config |
| 111 | namespace: default |
| 112 | data: |
| 113 | key: value1 |
| 114 | ` |
| 115 | manifest2 := `--- |
| 116 | apiVersion: v1 |
| 117 | kind: ConfigMap |
| 118 | metadata: |
| 119 | name: test-config |
| 120 | namespace: default |
| 121 | data: |
| 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 | |
| 147 | func TestLocalCmdDetailedExitCode(t *testing.T) { |
| 148 | manifest1 := `--- |
nothing calls this directly
no test coverage detected