fix: preserve HiCache load-back allocator headroom
This commit is contained in:
@@ -39,6 +39,7 @@ from sglang.srt.mem_cache.base_prefix_cache import (
|
||||
MatchPrefixParams,
|
||||
)
|
||||
from sglang.srt.mem_cache.radix_cache import RadixCache, RadixKey, TreeNode
|
||||
from sglang.test.test_utils import CustomTestCase
|
||||
|
||||
# Test constants
|
||||
DEFAULT_PAGE_SIZE = 4
|
||||
@@ -235,6 +236,16 @@ class TestTreeNode(unittest.TestCase):
|
||||
self.assertFalse(node2 < node1)
|
||||
|
||||
|
||||
class TestTreeNodeChildren(CustomTestCase):
|
||||
def test_missing_child_access_does_not_create_orphan_node(self):
|
||||
node = TreeNode()
|
||||
|
||||
with self.assertRaises(KeyError):
|
||||
_ = node.children["missing"]
|
||||
|
||||
self.assertEqual(node.children, {})
|
||||
|
||||
|
||||
class TestRadixCache(unittest.TestCase):
|
||||
"""Test cases for RadixCache class."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user