CI: add internal main digest deployment #18

Open
avm wants to merge 4 commits from feature/ecos-internal-main into main
2 changed files with 22 additions and 0 deletions
Showing only changes of commit 74d6181a63 - Show all commits

View File

@@ -151,6 +151,7 @@ class ReadinessView(APIView):
permission_classes = [AllowAny]
authentication_classes = []
throttle_classes = []
@swagger_auto_schema(
tags=[HEALTH_TAG],

View File

@@ -1,8 +1,19 @@
"""Tests for core views (health checks)"""
from unittest.mock import patch
from django.urls import reverse
from rest_framework import status
from rest_framework.test import APITestCase
from rest_framework.throttling import BaseThrottle
from rest_framework.views import APIView
class RejectAllThrottle(BaseThrottle):
"""Test throttle proving readiness ignores inherited API throttles."""
def allow_request(self, request, view):
return False
class HealthCheckViewTest(APITestCase):
@@ -66,6 +77,16 @@ class ReadinessViewTest(APITestCase):
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.data["status"], "ready")
def test_readiness_bypasses_inherited_api_throttles(self):
"""Readiness probes remain available when global throttles reject traffic."""
url = reverse("core:readiness")
with patch.object(APIView, "throttle_classes", [RejectAllThrottle]):
response = self.client.get(url)
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.data["status"], "ready")
class APIVersioningURLTest(APITestCase):
"""Tests for API versioning URL structure"""