Skip to content
This repository has been archived by the owner on Oct 8, 2024. It is now read-only.

Commit

Permalink
mp.setenv
Browse files Browse the repository at this point in the history
  • Loading branch information
PietroPasotti committed Aug 7, 2024
1 parent f9579ad commit 5f9cec0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tests/scenario/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


@pytest.fixture
def tempo_charm():
def tempo_charm(tmp_path):
with patch("charm.KubernetesServicePatch"):
with patch("lightkube.core.client.GenericSyncClient"):
yield TempoCharm
Expand Down
8 changes: 4 additions & 4 deletions tests/scenario/test_charm.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
from pathlib import Path
from unittest.mock import MagicMock
from unittest.mock import MagicMock, patch

import pytest
import yaml
Expand Down Expand Up @@ -186,18 +186,18 @@ def test_tracing_storage_is_configured_to_s3_if_s3_relation_filled(
assert new_config == expected_config


def test_ready_check_on_resume(context, tmp_path, caplog):
def test_ready_check_on_resume(context, tmp_path, caplog, monkeypatch):
# GIVEN the charm has no tempo-ready service
container, tempo = _tempo_mock_with_initial_config(tmp_path, tempo_ready_svc_exists=False)

state = State(leader=True, containers=[tempo])

# WHEN we receive a custom-notice event
with caplog.at_level("DEBUG"):
os.environ["SCENARIO_SKIP_CONSISTENCY_CHECKS"] = "1"
monkeypatch.setenv("SCENARIO_SKIP_CONSISTENCY_CHECKS", "1")
# scenario doesn't play nice in this very edge case
context.run(_BoundNotice(Notice(Tempo.tempo_ready_notice_key), tempo).event, state)
del os.environ["SCENARIO_SKIP_CONSISTENCY_CHECKS"]
monkeypatch.delenv("SCENARIO_SKIP_CONSISTENCY_CHECKS")

# THEN we get a debug-log but the charm doesn't error
assert "`tempo-ready` service cannot be stopped at this time (probably doesn't exist)." in {
Expand Down

0 comments on commit 5f9cec0

Please sign in to comment.