Fixes#6560
## Summary
Adds tests for the `InstallTraceBridge` function to verify that the
`octrace.DefaultTracer` is correctly set when the function is called
with various configuration options.
## Changes
- Added `TestInstallTraceBridge` test function in
`bridge/opencensus/trace_test.go`
- Tests cover multiple scenarios:
- Installation with default options
- Installation with custom tracer provider
- Installation with tracer provider and exporter
- Verifies that `octrace.DefaultTracer` is properly updated.
- Verifies that the installed tracer can create functional spans.
- Ensures proper cleanup of global state after tests.
## Test Results
```bash
=== RUN TestInstallTraceBridge
=== RUN TestInstallTraceBridge/install_with_default_options
=== RUN TestInstallTraceBridge/install_with_custom_tracer_provider
=== RUN TestInstallTraceBridge/install_with_tracer_provider_with_exporter
--- PASS: TestInstallTraceBridge (0.00s)
```
---------
Co-authored-by: Damien Mathieu <42@dmathieu.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: dmathieu <damien.mathieu@elastic.co>
## Description
Adds tests for the `OTelSpanContextToOC` func in the `opencensus bridge`
as requested in issue #6561.
## Changes
- Added `TestOTelSpanContextToOC` function with four test cases:
- Empty span context conversion
- Sampled span context conversion
- Not sampled span context conversion
- Span context with tracestate conversion
## Testing
The test verifies that the following fields are correctly converted:
- TraceID
- SpanID
- TraceOptions (sampled/not sampled)
- Tracestate (when present)
All existing tests continue to pass.
## Fixes
Closes#6561
---------
Co-authored-by: Damien Mathieu <42@dmathieu.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Fixes#6562
I ignored `tracestate` for the following note in the Issue.
> The full depth of conversion for each field is out of scope. That is
left for unit-tests of the oc2otel package.
---------
Signed-off-by: t-kikuc <tkikuchi07f@gmail.com>