Wire RUNNER_AUTH_TOKEN through dev/test/main Compose, validate uploads with extension whitelist and content sniffing, add readiness soak script and short PG loop test, and require runner token in prod when URL is set. Co-authored-by: Cursor <cursoragent@cursor.com>
34 lines
737 B
Go
34 lines
737 B
Go
package server_test
|
|
|
|
import (
|
|
"net/http"
|
|
"net/http/httptest"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestPhase5_SoakReadinessLoop_Short(t *testing.T) {
|
|
pool := openPGPoolWithMigrations(t)
|
|
if pool == nil {
|
|
return
|
|
}
|
|
defer pool.Close()
|
|
|
|
handler, _ := setupPGGovernanceServer(t, pool)
|
|
const iterations = 8
|
|
var failures int
|
|
for i := 0; i < iterations; i++ {
|
|
req := httptest.NewRequest(http.MethodGet, "/api/v1/ready", nil)
|
|
rec := httptest.NewRecorder()
|
|
handler.ServeHTTP(rec, req)
|
|
if rec.Code != http.StatusOK {
|
|
failures++
|
|
t.Logf("iteration %d: ready=%d body=%s", i, rec.Code, rec.Body.String())
|
|
}
|
|
time.Sleep(50 * time.Millisecond)
|
|
}
|
|
if failures > 0 {
|
|
t.Fatalf("readiness soak failures=%d/%d", failures, iterations)
|
|
}
|
|
}
|