Build and Push Docker Container / build-and-push (push) Successful in 2m18s
- Register Zenith 1.1 with balanced duel verdicts and forced-outcome overrides. - Prioritize permanent-trail space in Constrictor and health-aware hazard routes. - Deduct executor queue delays and return fallback directions on move timeouts. - Correlate response headers, replay timings, and sampled structured trace logs. - Move shared metrics publication off the response path without losing local counts. - Allow configurable tournament opponents and add a psql helper recipe. - Preserve empty latency values through compact replay encoding and migration. - Update Arena game links and use default assets for missing customizations. - Cover strategy, HTTP lifecycle, tracing, replay codecs, and dashboard behavior. - Validate with 260 passing Python tests, 4 skips, and 2 passing JavaScript tests.
30 lines
1.0 KiB
Python
30 lines
1.0 KiB
Python
import unittest
|
|
from unittest.mock import Mock, patch
|
|
from server.services.move_trace import MoveTrace
|
|
|
|
class TestMoveTrace(unittest.TestCase):
|
|
def test_snapshot_is_independent_and_stage_survives_exception(self):
|
|
trace = MoveTrace('test-game', 1)
|
|
with self.assertRaises(ValueError):
|
|
with trace.stage('test'):
|
|
raise ValueError()
|
|
snapshot = trace.snapshot()
|
|
snapshot['test_ms'] = -1
|
|
self.assertGreaterEqual(trace.snapshot()['test_ms'], 0)
|
|
|
|
def test_timeout_logged_even_when_sampling_disabled(self):
|
|
trace = MoveTrace('test-game', 2)
|
|
trace.set(timed_out=True)
|
|
logger = Mock()
|
|
with patch.dict('os.environ', {'MOVE_TRACE_SAMPLE_EVERY':'0'}):
|
|
trace.log(logger)
|
|
logger.info.assert_called_once()
|
|
self.assertIn(trace.id, logger.info.call_args.args[1])
|
|
|
|
def test_fast_requests_not_logged_when_disabled(self):
|
|
trace = MoveTrace('test-game', 2)
|
|
logger = Mock()
|
|
with patch.dict('os.environ', {'MOVE_TRACE_SAMPLE_EVERY':'0'}):
|
|
trace.log(logger)
|
|
logger.info.assert_not_called()
|