MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/cloud-sql-proxy / TestPProfServer

Function TestPProfServer

cmd/root_test.go:1446–1462  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1444}
1445
1446func TestPProfServer(t *testing.T) {
1447 c := NewCommand(WithDialer(&spyDialer{}))
1448 c.SilenceUsage = true
1449 c.SilenceErrors = true
1450 c.SetArgs([]string{"--debug", "--admin-port", "9191", "my-project:my-region:my-instance"})
1451 ctx, cancel := context.WithCancel(context.Background())
1452 defer cancel()
1453
1454 go c.ExecuteContext(ctx)
1455 resp, err := tryDial("GET", "http://localhost:9191/debug/pprof/")
1456 if err != nil {
1457 t.Fatalf("failed to dial endpoint: %v", err)
1458 }
1459 if resp.StatusCode != http.StatusOK {
1460 t.Fatalf("expected a 200 status, got = %v", resp.StatusCode)
1461 }
1462}
1463
1464func TestQuitQuitQuitHTTPPost(t *testing.T) {
1465 c := NewCommand(WithDialer(&spyDialer{}))

Callers

nothing calls this directly

Calls 3

NewCommandFunction · 0.85
WithDialerFunction · 0.85
tryDialFunction · 0.85

Tested by

no test coverage detected