(t *testing.T)
| 208 | } |
| 209 | |
| 210 | func TestSanitizeErrorMessage_GhAwVariables(t *testing.T) { |
| 211 | tests := []struct { |
| 212 | name string |
| 213 | message string |
| 214 | expected string |
| 215 | }{ |
| 216 | { |
| 217 | name: "GH_AW_SKIP_NPX_VALIDATION not redacted", |
| 218 | message: "Alternatively, disable validation by setting GH_AW_SKIP_NPX_VALIDATION=true", |
| 219 | expected: "Alternatively, disable validation by setting GH_AW_SKIP_NPX_VALIDATION=true", |
| 220 | }, |
| 221 | { |
| 222 | name: "GH_AW_SKIP_UV_VALIDATION not redacted", |
| 223 | message: "Alternatively, disable validation by setting GH_AW_SKIP_UV_VALIDATION=true", |
| 224 | expected: "Alternatively, disable validation by setting GH_AW_SKIP_UV_VALIDATION=true", |
| 225 | }, |
| 226 | { |
| 227 | name: "GH_AW_SKIP_PIP_VALIDATION not redacted", |
| 228 | message: "Alternatively, disable validation by setting GH_AW_SKIP_PIP_VALIDATION=true", |
| 229 | expected: "Alternatively, disable validation by setting GH_AW_SKIP_PIP_VALIDATION=true", |
| 230 | }, |
| 231 | { |
| 232 | name: "generic GH_AW prefix not redacted", |
| 233 | message: "Set GH_AW_SOME_OPTION to configure this feature", |
| 234 | expected: "Set GH_AW_SOME_OPTION to configure this feature", |
| 235 | }, |
| 236 | { |
| 237 | name: "non-GH_AW still redacted", |
| 238 | message: "Error accessing MY_SECRET_KEY", |
| 239 | expected: "Error accessing [REDACTED]", |
| 240 | }, |
| 241 | } |
| 242 | |
| 243 | for _, tt := range tests { |
| 244 | t.Run(tt.name, func(t *testing.T) { |
| 245 | result := SanitizeErrorMessage(tt.message) |
| 246 | assertSanitizeResult(t, "SanitizeErrorMessage", tt.message, result, tt.expected) |
| 247 | }) |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | func TestSanitizeErrorMessage_RealWorldExamples(t *testing.T) { |
| 252 | tests := []struct { |
nothing calls this directly
no test coverage detected