-
Notifications
You must be signed in to change notification settings - Fork 536
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2bd7c3e
commit 3462d5f
Showing
2 changed files
with
25 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
"""Tests for GPU label formatting in Kubernetes integration. | ||
Tests verify correct GPU detection from Kubernetes labels. | ||
""" | ||
import pytest | ||
|
||
from sky.provision.kubernetes.utils import GFDLabelFormatter | ||
|
||
|
||
def test_gfd_label_formatter(): | ||
"""Test word boundary regex matching in GFDLabelFormatter.""" | ||
# Test various GPU name patterns | ||
test_cases = [ | ||
('NVIDIA-L4-24GB', 'L4'), | ||
('NVIDIA-L40-48GB', 'L40'), | ||
('NVIDIA-L400', 'L400'), # Should not match L4 or L40 | ||
('NVIDIA-L4', 'L4'), | ||
('L40-GPU', 'L40'), | ||
] | ||
for input_value, expected in test_cases: | ||
result = GFDLabelFormatter.get_accelerator_from_label_value(input_value) | ||
assert result == expected, f'Failed for {input_value}' |