(t *testing.T, opts ...ServerOption)
| 28 | } |
| 29 | |
| 30 | func newTestServerWithOptions(t *testing.T, opts ...ServerOption) *Server { |
| 31 | t.Helper() |
| 32 | |
| 33 | gin.SetMode(gin.TestMode) |
| 34 | |
| 35 | tmpDir := t.TempDir() |
| 36 | authDir := filepath.Join(tmpDir, "auth") |
| 37 | if err := os.MkdirAll(authDir, 0o700); err != nil { |
| 38 | t.Fatalf("failed to create auth dir: %v", err) |
| 39 | } |
| 40 | |
| 41 | cfg := &proxyconfig.Config{ |
| 42 | SDKConfig: sdkconfig.SDKConfig{ |
| 43 | APIKeys: []string{"test-key"}, |
| 44 | }, |
| 45 | Port: 0, |
| 46 | AuthDir: authDir, |
| 47 | Debug: true, |
| 48 | LoggingToFile: false, |
| 49 | UsageStatisticsEnabled: false, |
| 50 | } |
| 51 | |
| 52 | authManager := auth.NewManager(nil, nil, nil) |
| 53 | accessManager := sdkaccess.NewManager() |
| 54 | |
| 55 | configPath := filepath.Join(tmpDir, "config.yaml") |
| 56 | return NewServer(cfg, authManager, accessManager, configPath, opts...) |
| 57 | } |
| 58 | |
| 59 | func TestHealthz(t *testing.T) { |
| 60 | server := newTestServer(t) |
no test coverage detected