Skip to content

feat(config): add docker-tests e2e for OTEL_CONFIG_FILE plumbing #5318

@MikeGoldsmith

Description

@MikeGoldsmith

Motivation

#5271 wires OTEL_CONFIG_FILE through _OTelSDKConfigurator._configure so the SDK loads and applies a declarative YAML/JSON file when the env var is set. The unit tests in tests/_configuration/test_configurator_file_routing.py cover the routing logic in isolation (mocked _initialize_components, configure_sdk, load_config_file), but nothing exercises the full path against a real running collector.

Picked up from @xrmx's review:

LGTM, what do you think of adding a test in a followup PR (in docker-tests?) to check that the plumbing is working e2e?

Proposed test shape

Add a new subdirectory under tests/opentelemetry-docker-tests/tests/ (alongside otlpexporter/ and opencensus/) that:

  1. Reuses the existing OTLP collector container from docker-compose.yml.
  2. Writes a minimal declarative config YAML pointing the OTLP span exporter at the collector endpoint.
  3. Launches a Python process with OTEL_CONFIG_FILE=/path/to/that.yaml (and no other OTEL_* vars), instantiates _OTelSDKConfigurator(), emits a span via the global tracer, and shuts down.
  4. Asserts the collector received the expected span.

This proves the chain: env-var detection → load_config_file → schema validation → _dict_to_dataclassconfigure_sdk → per-signal factories → OTLP exporter → wire.

Useful follow-ons in the same suite:

  • Same for metric and log signals.
  • Negative path: invalid YAML → process exits non-zero with ConfigurationError.
  • Env-var fallback: OTEL_CONFIG_FILE unset + OTEL_TRACES_EXPORTER=otlp still works (verifies the routing doesn't break the existing env-var path).

Related

Refs #3631

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions