Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/nightly-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ jobs:
uses: ./.github/workflows/shared-deploy-test.yml
with:
framework: sglang
profiles: '["agg"]'
profiles: '["agg", "agg_logging"]'
image_tag: ${{ needs.sglang-copy-to-acr.outputs.image_tag }}
namespace: ${{ needs.deploy-operator.outputs.namespace }}
vcluster_name: ${{ needs.deploy-operator.outputs.vcluster_name }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/post-merge-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ jobs:
uses: ./.github/workflows/shared-deploy-test.yml
with:
framework: sglang
profiles: '["agg", "agg_router"]'
profiles: '["agg", "agg_logging", "agg_router"]'
Comment thread
knarangN marked this conversation as resolved.
Resolved
image_tag: ${{ needs.sglang-copy-to-acr.outputs.image_tag }}
namespace: ${{ needs.deploy-operator.outputs.namespace }}
vcluster_name: ${{ needs.deploy-operator.outputs.vcluster_name }}
Expand Down
3 changes: 2 additions & 1 deletion tests/deploy/dgd_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,8 @@ def get_logging_config(self) -> dict:
Returns:
dict with 'jsonl_enabled' and 'log_level' keys
"""
envs = self._deployment_spec.get("spec", {}).get("envs", [])
env_key = "env" if self._schema == SCHEMA_V1BETA1 else "envs"
envs = self._deployment_spec.get("spec", {}).get(env_key, [])

jsonl_enabled = False
log_level = None
Expand Down
60 changes: 60 additions & 0 deletions tests/deploy/test_dgd.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"""

import asyncio
import json
import logging
import os
import subprocess
Expand Down Expand Up @@ -45,11 +46,58 @@
# This matches the validation threshold from the original shell-based deployment tests.
MIN_RESPONSE_CONTENT_LENGTH = 100
GAIE_MODEL_NAME = "Qwen/Qwen3-0.6B"
JSON_LOG_REQUIRED_FIELDS = frozenset({"time", "level", "target", "message"})
# The install script deploys the Gateway into agentgateway-system; the
# controller provisions the proxy Service in that same namespace.
GAIE_AGW_NAMESPACE = "agentgateway-system"


def normalize_log_lines(log_lines: Any) -> list[str]:
"""Return pod logs as a reusable list of lines."""
if isinstance(log_lines, str):
return log_lines.splitlines()
return list(log_lines)


def find_structured_json_log(log_lines: list[str]) -> Dict[str, Any] | None:
"""Return the first Dynamo JSONL record with the documented core fields."""
for line in log_lines:
try:
record = json.loads(line)
except (json.JSONDecodeError, TypeError):
continue

if isinstance(record, dict) and JSON_LOG_REQUIRED_FIELDS.issubset(record):
return record

return None


def validate_agg_logging_configuration(deployment_spec: DeploymentSpec) -> None:
"""Verify that the logging profile enables structured JSONL output."""
logging_config = deployment_spec.get_logging_config()
if not logging_config["jsonl_enabled"]:
pytest.fail("The agg_logging deployment profile must enable DYN_LOGGING_JSONL")


def validate_agg_logging_output(frontend_pod: Any, baseline_line_count: int) -> None:
"""Verify that inference emitted a new structured frontend log record."""
frontend_log_lines = normalize_log_lines(frontend_pod.logs(container="main"))
Comment thread
knarangN marked this conversation as resolved.
Resolved
new_log_lines = frontend_log_lines[baseline_line_count:]
json_log_record = find_structured_json_log(new_log_lines)
if json_log_record is None:
pytest.fail(
"The agg_logging deployment served inference but the frontend "
"did not emit a new structured Dynamo JSONL record"
)

logger.info(
"Validated structured JSON logging: target=%s message=%s",
json_log_record["target"],
json_log_record["message"],
)


def validate_chat_response(
response: requests.Response,
expected_model: str,
Expand Down Expand Up @@ -144,6 +192,7 @@ async def test_deployment(
# Extract identifying information from the target
framework = deployment_target.framework
profile = deployment_target.profile
validate_agg_logging = profile == "agg_logging"

# NIXL_ERR_BACKEND: vCluster CI nodes lack RDMA/UCX for inter-pod KV
# transfer. Prefill workers crash in NixlWrapper.create_backend.
Expand All @@ -168,6 +217,9 @@ async def test_deployment(
f"{framework}/{profile}"
)

if validate_agg_logging:
validate_agg_logging_configuration(deployment_spec)

logger.info(
f"Starting deployment test for {deployment_target.test_id} "
f"(source: {deployment_target.source}, model: {model}, namespace: {namespace})"
Expand Down Expand Up @@ -225,6 +277,11 @@ async def test_deployment(
"temperature": DEFAULT_TEMPERATURE,
"stream": False,
}
frontend_log_baseline = (
len(normalize_log_lines(frontend_pod.logs(container="main")))
if validate_agg_logging
else 0
)
response = send_request(
url, payload, timeout=float(DEFAULT_REQUEST_TIMEOUT), method="POST"
)
Expand All @@ -236,6 +293,9 @@ async def test_deployment(
min_content_length=MIN_RESPONSE_CONTENT_LENGTH,
)

if validate_agg_logging:
validate_agg_logging_output(frontend_pod, frontend_log_baseline)

logger.info(
f"Deployment test PASSED for {deployment_target.test_id} "
f"(source: {deployment_target.source}, model: {model}, namespace: {namespace})"
Expand Down
30 changes: 30 additions & 0 deletions tests/deploy/test_dgd_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

"""Unit tests for schema-aware DynamoGraphDeployment helpers."""

import pytest
import yaml

from tests.deploy.dgd_utils import DeploymentSpec

pytestmark = [pytest.mark.unit, pytest.mark.pre_merge, pytest.mark.gpu_0]


def test_logging_config_reads_existing_v1beta1_env(tmp_path) -> None:
"""Recognize JSONL logging already declared in a v1beta1 manifest."""
manifest = {
"apiVersion": "nvidia.com/v1beta1",
"kind": "DynamoGraphDeployment",
"metadata": {"name": "logging-test"},
"spec": {
"components": [],
"env": [{"name": "DYN_LOGGING_JSONL", "value": "1"}],
},
}
manifest_path = tmp_path / "deploy.yaml"
manifest_path.write_text(yaml.safe_dump(manifest))

deployment_spec = DeploymentSpec(str(manifest_path))

assert deployment_spec.get_logging_config()["jsonl_enabled"] is True
Loading