mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2024-12-12 10:04:29 +02:00
7d92434295
* Fail in RunEndToEndTest if collector stop fails * Use testing T.Cleanup to check shut downs * Add goroutine leak detection * Fix TestExporterShutdown go leak The shutdown tests checking if a context error is honored did not completely clean up the resources used by the client after the error was evaluated. Update the connection client to handle multiple calls to shutdown and make a second call to these clients that must succeed so the test does not have abandoned goroutines. * Fix leak in TestNew_WithTimeout The mockTraceService did not delay with its lock being held. This resulted in the mockCollector stopping and being able to acquire the lock. It was assumed that no export was taking place because of this and the mockTraceService was abandoned without cleaning up resources it held and goroutines it had spawned. This reworks the export blocking logic to block on a channel read. This will make the block more deterministic and not depend on the scheduler timing. Additionally, this blocking is moved inside the lock acquire. Meaning code will deadlock if the block is not released before a shutdown (something the developer will immediately be aware of when they submit a bad patch), and will ensure all resources are released before shutdown. Replace TestNew_WithTimeout with TestExportSpansTimeoutHonored which directly tests if a span export errors when the timeout is reached. This is the only unique thing that TestNew_WithTimeout, but it also tests the non-error path. That non-error path is tested in many other tests. * Guard otlptracehttp client stopCh when stopping In normal operations the exporter is guaranteed to only ever call the client Stop method once. However in testing we need to call this multiple times when checking it returns an error in particular context. Add a lightweight sync.Once to the closing of the stopCh to ensure tests do not panic when cleaning up. * Release export block after export Prevent deadlock in TestExportSpansTimeoutHonored. |
||
---|---|---|
.. | ||
otlpmetric | ||
otlptrace |