mirror of
https://github.com/hanzoai/cloud.git
synced 2026-11-23 21:00:04 +00:00
Adds sdk/sqltest, sdk/sqlcheck and sdk/driver/{postgres,kv,s3} with the
tests they unlock. postgres.Declare names the subsystems that live on
hanzo-sql; the host declares them at start.
Claude-Session: https://claude.ai/code/session_015XYKLn69gF4x75RWePpDBV
27 lines
557 B
Go
27 lines
557 B
Go
package cloud
|
|
|
|
import (
|
|
"io"
|
|
"net/http"
|
|
"net/http/httptest"
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/zap-proto/zip"
|
|
)
|
|
|
|
func cacheDo(t *testing.T, app *zip.App, method, target string, headers map[string]string) (*http.Response, string) {
|
|
t.Helper()
|
|
req := httptest.NewRequest(method, target, nil)
|
|
for k, v := range headers {
|
|
req.Header.Set(k, v)
|
|
}
|
|
resp, err := app.Test(req, zip.TestConfig{Timeout: 30 * time.Second, FailOnTimeout: true})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
defer resp.Body.Close()
|
|
b, _ := io.ReadAll(resp.Body)
|
|
return resp, string(b)
|
|
}
|