Skip to content

Commit

Permalink
fmt (#442)
Browse files Browse the repository at this point in the history
  • Loading branch information
PietroPasotti authored Jan 31, 2025
1 parent 24cbf9c commit 50e9ff7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
16 changes: 9 additions & 7 deletions tests/scenario/conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from unittest.mock import PropertyMock, patch

import pytest
from charms.tempo_coordinator_k8s.v0.charm_tracing import charm_tracing_disabled
from ops import pebble
from scenario import Container, Context, ExecOutput, Model, Mount

Expand All @@ -11,13 +12,14 @@

@pytest.fixture
def traefik_charm():
with patch("lightkube.core.client.GenericSyncClient"):
with patch(
"charm.TraefikIngressCharm._get_loadbalancer_status",
new_callable=PropertyMock,
return_value=MOCK_LB_ADDRESS,
):
yield TraefikIngressCharm
with charm_tracing_disabled():
with patch("lightkube.core.client.GenericSyncClient"):
with patch(
"charm.TraefikIngressCharm._get_loadbalancer_status",
new_callable=PropertyMock,
return_value=MOCK_LB_ADDRESS,
):
yield TraefikIngressCharm


@pytest.fixture
Expand Down
7 changes: 6 additions & 1 deletion tests/scenario/test_tracing_integration.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import os
from unittest.mock import patch

import opentelemetry
import pytest
import yaml
from charms.tempo_coordinator_k8s.v0.charm_tracing import charm_tracing_disabled
from charms.tempo_coordinator_k8s.v0.charm_tracing import (
CHARM_TRACING_ENABLED,
charm_tracing_disabled,
)
from charms.tempo_coordinator_k8s.v0.tracing import ProtocolType, Receiver, TracingProviderAppData
from scenario import Relation, State

Expand Down Expand Up @@ -50,6 +54,7 @@ def test_charm_trace_collection(traefik_ctx, traefik_container, caplog, charm_tr
"opentelemetry.exporter.otlp.proto.http.trace_exporter.OTLPSpanExporter.export"
) as f:
f.return_value = opentelemetry.sdk.trace.export.SpanExportResult.SUCCESS
os.environ[CHARM_TRACING_ENABLED] = "1"
# WHEN traefik receives <any event>
traefik_ctx.run(charm_tracing_relation.changed_event, state_in)

Expand Down

0 comments on commit 50e9ff7

Please # to comment.