Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(test): remove framework-behavior temporal server tests (#66339)

Georges-Antoine Assid4ef9618884f
diff --git a/posthog/temporal/tests/common/test_combined_metrics_server.py b/posthog/temporal/tests/common/test_combined_metrics_server.py
index 5295a48f9fc1..87d79c464804 100644
--- a/posthog/temporal/tests/common/test_combined_metrics_server.py
+++ b/posthog/temporal/tests/common/test_combined_metrics_server.py
@@ -1,5 +1,4 @@
import time
-import socket
import threading
from http.server import BaseHTTPRequestHandler, HTTPServer
@@ -164,26 +163,6 @@ temporal_long_request_latency_bucket{namespace="default",operation="PollActivity
finally:
await server.stop()
- @pytest.mark.asyncio
- async def test_returns_404_for_unknown_paths(self, isolated_registry):
- temporal_port = get_free_port()
- metrics_port = get_free_port()
-
- server = CombinedMetricsServer(
- port=metrics_port,
- temporal_metrics_url=f"http://127.0.0.1:{temporal_port}/metrics",
- registry=isolated_registry,
- )
- await server.start()
-
- try:
- url = f"http://127.0.0.1:{metrics_port}/unknown"
- async with ClientSession() as session:
- async with session.get(url) as response:
- assert response.status == 404
- finally:
- await server.stop()
-
@pytest.mark.asyncio
async def test_root_path_serves_metrics(self, test_counter, isolated_registry):
temporal_port = get_free_port()
@@ -521,14 +500,3 @@ test_gauge 100.0
# Should not raise any exception
await server.stop()
await server.stop() # Multiple stops should also be safe
-
-
-class TestGetFreePort:
- def test_returns_available_port(self):
- port = get_free_port()
- assert isinstance(port, int)
- assert port > 0
-
- # Verify the port is actually available
- with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
- s.bind(("127.0.0.1", port))
diff --git a/posthog/temporal/tests/common/test_health_server.py b/posthog/temporal/tests/common/test_health_server.py
index 3f0db2d96060..7ad7702b5cc1 100644
--- a/posthog/temporal/tests/common/test_health_server.py
+++ b/posthog/temporal/tests/common/test_health_server.py
@@ -1,5 +1,4 @@
import time
-import asyncio
from contextlib import asynccontextmanager
from datetime import timedelta
@@ -115,15 +114,6 @@ class TestHealthCheckServer:
data = await response.json()
assert data["status"] == "healthy"
- async def test_unknown_path_returns_404(self):
- """Test that unknown paths return 404."""
-
- tracker = LivenessTracker()
- async with create_server(tracker):
- async with ClientSession() as session:
- async with session.get("http://localhost:18001/unknown") as response:
- assert response.status == 404
-
async def test_server_can_be_started_and_stopped(self):
"""Test that server can be cleanly started and stopped."""
@@ -164,26 +154,6 @@ class TestHealthCheckServer:
server = HealthCheckServer(port=18003, liveness_tracker=tracker, max_idle_seconds=2.0)
await server.stop() # Should not raise
- async def test_healthz_handles_concurrent_requests(self):
- """Test that the server can handle multiple concurrent health checks."""
-
- tracker = LivenessTracker()
- async with create_server(tracker):
- tracker.record_activity_execution()
-
- async def check_health():
- async with ClientSession() as session:
- async with session.get("http://localhost:18001/healthz") as response:
- assert response.status == 200
- return await response.json()
-
- # Make 10 concurrent requests
- results = await asyncio.gather(*[check_health() for _ in range(10)])
-
- # All should succeed
- assert len(results) == 10
- assert all(r["status"] == "healthy" for r in results)
-
async def test_idle_time_accuracy(self):
"""Test that idle_time is calculated accurately."""
@@ -246,23 +216,3 @@ class TestHealthCheckServer:
assert response.status == 200
data = await response.json()
assert data["idle_seconds"] < 1.0
-
- async def test_different_max_idle_thresholds(self):
- """Test that different max_idle_seconds values work correctly."""
-
- tracker = LivenessTracker()
- # Create server with very short threshold
- server = HealthCheckServer(port=18004, liveness_tracker=tracker, max_idle_seconds=0.5)
- await server.start()
-
- try:
- tracker.record_activity_execution()
- await asyncio.sleep(0.7)
-
- async with ClientSession() as session:
- async with session.get("http://localhost:18004/healthz") as response:
- assert response.status == 503
- data = await response.json()
- assert data["max_idle_seconds"] == 0.5
- finally:
- await server.stop()