setupObservabilitySystemWithConfig sets up the observability system with the specified config, and returns a function which cleans up the observability system.
(cfg *config)
| 103 | // specified config, and returns a function which cleans up the observability |
| 104 | // system. |
| 105 | func setupObservabilitySystemWithConfig(cfg *config) (func(), error) { |
| 106 | validConfigJSON, err := json.Marshal(cfg) |
| 107 | if err != nil { |
| 108 | return nil, fmt.Errorf("failed to convert config to JSON: %v", err) |
| 109 | } |
| 110 | oldObservabilityConfig := envconfig.ObservabilityConfig |
| 111 | envconfig.ObservabilityConfig = string(validConfigJSON) |
| 112 | ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout) |
| 113 | defer cancel() |
| 114 | err = Start(ctx) |
| 115 | cleanup := func() { |
| 116 | End() |
| 117 | envconfig.ObservabilityConfig = oldObservabilityConfig |
| 118 | } |
| 119 | if err != nil { |
| 120 | return cleanup, fmt.Errorf("error in Start: %v", err) |
| 121 | } |
| 122 | return cleanup, nil |
| 123 | } |
| 124 | |
| 125 | // TestClientRPCEventsLogAll tests the observability system configured with a |
| 126 | // client RPC event that logs every call. It performs a Unary and Bidirectional |
no test coverage detected