conftest.py 2.04 KB
Newer Older
1
2
3
4
5
6
7
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

"""Pytest configuration for GPU Memory Service tests."""

import pytest

8
from tests.utils.port_utils import allocate_port, deallocate_ports  # noqa: E402
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63


@pytest.fixture
def gms_ports():
    """Allocate ports for GMS tests.

    Returns a dict with ports for:
    - frontend: Frontend HTTP port
    - shadow_system: System port for the first shadow engine
    - shadow2_system: System port for the second shadow engine
    - primary_system: System port for primary engine (failover test only)
    - shadow_kv_event: KV event port for the first shadow engine (vLLM)
    - shadow2_kv_event: KV event port for the second shadow engine (vLLM)
    - primary_kv_event: KV event port for primary engine (vLLM)
    - shadow_nixl: NIXL side channel port for the first shadow engine (vLLM)
    - shadow2_nixl: NIXL side channel port for the second shadow engine (vLLM)
    - primary_nixl: NIXL side channel port for primary engine (vLLM)
    - shadow_sglang: SGLang HTTP port for the first shadow engine
    - shadow2_sglang: SGLang HTTP port for the second shadow engine
    - primary_sglang: SGLang HTTP port for primary engine
    """
    ports = [
        allocate_port(p)
        for p in [
            8200,
            8100,
            8101,
            8102,
            20080,
            20081,
            20082,
            20096,
            20097,
            20098,
            30000,
            30001,
            30002,
        ]
    ]
    yield {
        "frontend": ports[0],
        "shadow_system": ports[1],
        "primary_system": ports[2],
        "shadow2_system": ports[3],
        "shadow_kv_event": ports[4],
        "primary_kv_event": ports[5],
        "shadow2_kv_event": ports[6],
        "shadow_nixl": ports[7],
        "primary_nixl": ports[8],
        "shadow2_nixl": ports[9],
        "shadow_sglang": ports[10],
        "primary_sglang": ports[11],
        "shadow2_sglang": ports[12],
    }
    deallocate_ports(ports)