Skip to content

Commit 3467456

Browse files
committed
add more tests for slurmctld functions
1 parent af7f04b commit 3467456

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

tests/integration/test_slurmctld.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,54 @@ def test_load_config():
5656
assert conf.cgroup_config
5757
assert conf.accounting_gather_config
5858
assert conf.mpi_config
59+
60+
61+
def test_debug_flags():
62+
slurmctld.clear_debug_flags()
63+
64+
slurmctld.add_debug_flags([])
65+
assert slurmctld.get_debug_flags() == []
66+
67+
slurmctld.add_debug_flags(["CpuFrequency", "Backfill"])
68+
assert slurmctld.get_debug_flags() == ["Backfill", "CpuFrequency"]
69+
70+
slurmctld.add_debug_flags(["Agent"])
71+
assert slurmctld.get_debug_flags() == ["Agent", "Backfill", "CpuFrequency"]
72+
73+
slurmctld.remove_debug_flags(["CpuFrequency"])
74+
assert slurmctld.get_debug_flags() == ["Agent", "Backfill"]
75+
76+
slurmctld.clear_debug_flags()
77+
assert slurmctld.get_debug_flags() == []
78+
79+
80+
def test_log_level():
81+
slurmctld.set_log_level("debug5")
82+
assert slurmctld.get_log_level() == "debug5"
83+
84+
slurmctld.set_log_level("debug2")
85+
assert slurmctld.get_log_level() == "debug2"
86+
87+
with pytest.raises(pyslurm.RPCError,
88+
match=r"Invalid Log*"):
89+
slurmctld.set_log_level("invalid")
90+
91+
92+
def test_scheduler_log_level():
93+
assert not slurmctld.is_scheduler_logging_enabled()
94+
95+
96+
def test_fair_share_dampening_factor():
97+
slurmctld.set_fair_share_dampening_factor(100)
98+
assert slurmctld.get_fair_share_dampening_factor() == 100
99+
100+
slurmctld.set_fair_share_dampening_factor(1)
101+
assert slurmctld.get_fair_share_dampening_factor() == 1
102+
103+
with pytest.raises(pyslurm.RPCError,
104+
match=r"Invalid Dampening*"):
105+
slurmctld.set_fair_share_dampening_factor(0)
106+
107+
with pytest.raises(pyslurm.RPCError,
108+
match=r"Invalid Dampening*"):
109+
slurmctld.set_fair_share_dampening_factor(99999999)

0 commit comments

Comments
 (0)