console test: look for Availability's rows, not a bare "502"
TestAppErrorsPage failed if the substring "502" appeared anywhere on the errors page. Random page content (a CSRF token, an asset digest, a nonce) contains it now and then, so the test failed by chance on CI (#1161; twice in a row on main at 40d5273, again at 61ed548). It now looks for the rows Availability would print: "502 GET /.env", "502 GET /phpinfo.php" and the refused-wake name, beside "wake failed" and "phpinfo". Letting Availability rows onto the errors page still fails all five checks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+4
−1
internal/console/apierrors_test.go+4 −1
CI passed — run details
diff --git a/internal/console/apierrors_test.go b/internal/console/apierrors_test.go| index fe9996790..656d74494 100644 |
| --- a/internal/console/apierrors_test.go |
| +++ b/internal/console/apierrors_test.go |
| @@ -241,7 +241,10 @@ func TestAppErrorsPage(t *testing.T) { |
| t.Errorf("page missing %q", want) |
| } |
| } |
| - for _, not := range []string{"wake failed", "502", "phpinfo"} { |
| + // Availability's rows, by what the page would print for them. Not a bare |
| + // "502": a CSRF token, asset digest or nonce on the page contains it now |
| + // and then, which failed this test by chance on CI (#1161). |
| + for _, not := range []string{"wake failed", "502 GET /.env", "502 GET /phpinfo.php", apperr.AvailabilityName(502, apperr.CauseRefused), "phpinfo"} { |
| if strings.Contains(body, not) { |
| t.Errorf("errors page shows Availability's %q", not) |
| } |