(t *testing.T)
| 55 | } |
| 56 | |
| 57 | func startORCAServer(t *testing.T) *orcaServer { |
| 58 | t.Helper() |
| 59 | |
| 60 | smr := orca.NewServerMetricsRecorder() |
| 61 | ts := NewTestServer(NewTestServerOptions{MetricsRecorder: smr}) |
| 62 | |
| 63 | stub := &stubserver.StubServer{ |
| 64 | UnaryCallF: func(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error) { |
| 65 | return ts.UnaryCall(ctx, in) |
| 66 | }, |
| 67 | FullDuplexCallF: func(stream testgrpc.TestService_FullDuplexCallServer) error { |
| 68 | return ts.FullDuplexCall(stream) |
| 69 | }, |
| 70 | } |
| 71 | |
| 72 | sopts := []grpc.ServerOption{orca.CallMetricsServerOption(nil)} |
| 73 | |
| 74 | oso := orca.ServiceOptions{ |
| 75 | ServerMetricsProvider: smr, |
| 76 | MinReportingInterval: time.Second, |
| 77 | } |
| 78 | internal.ORCAAllowAnyMinReportingInterval.(func(so *orca.ServiceOptions))(&oso) |
| 79 | sopts = append(sopts, stubserver.RegisterServiceServerOption(func(s grpc.ServiceRegistrar) { |
| 80 | if err := orca.Register(s, oso); err != nil { |
| 81 | t.Fatalf("Failed to register ORCA service: %v", err) |
| 82 | } |
| 83 | })) |
| 84 | |
| 85 | if err := stub.StartServer(sopts...); err != nil { |
| 86 | t.Fatalf("Error starting server: %v", err) |
| 87 | } |
| 88 | t.Cleanup(stub.Stop) |
| 89 | |
| 90 | return &orcaServer{ |
| 91 | StubServer: stub, |
| 92 | metricsRecorder: smr, |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | func orcaSvcConfig() string { |
| 97 | return `{"loadBalancingConfig": [{"test_backend_metrics_load_balancer": {}}]}` |
no test coverage detected