Skip to content

Commit 2d7a91a

Browse files
committed
change liquid cooling UT as hw-mgmt require the reading of counter
Signed-off-by: Yuanzhe, Liu <[email protected]>
1 parent 414ab47 commit 2d7a91a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

platform/mellanox/mlnx-platform-api/tests/test_liquid_cooling.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import sys
33
from unittest import mock
44
from sonic_platform.liquid_cooling import LiquidCooling, LeakageSensor
5+
from sonic_platform.utils import read_int_from_file
56

67
def test_leakage_sensor_init():
78
sensor = LeakageSensor("leakage1", "/test/path")
@@ -31,7 +32,8 @@ def test_leakage_sensor_is_leak():
3132
def test_liquid_cooling_init():
3233
with mock.patch('os.path.exists') as mock_exists, \
3334
mock.patch('os.path.join', side_effect=lambda *args: "/".join(args)) as mock_join, \
34-
mock.patch('glob.glob') as mock_glob:
35+
mock.patch('glob.glob') as mock_glob, \
36+
mock.patch('sonic_platform.utils.read_int_from_file', return_value=4) as mock_read_int:
3537

3638
# Setup mock to simulate 4 leakage sensors
3739
mock_exists.side_effect = [True, True, True, True]
@@ -45,7 +47,7 @@ def test_liquid_cooling_init():
4547
liquid_cooling = LiquidCooling()
4648

4749
# Verify the number of sensors initialized
48-
assert liquid_cooling.leakage_sensors_num == 4
50+
assert liquid_cooling.get_leak_sensor_num() == 4
4951

5052

5153
with mock.patch.object(liquid_cooling.leakage_sensors[3], 'is_leak', return_value=False) as mock_sensor1:

0 commit comments

Comments
 (0)