@@ -43,6 +43,15 @@ def test_returns_the_same_profile_if_profiles_identical(self):
4343 )
4444 assert combine_fleet_and_run_profiles (profile , profile ) == profile
4545
46+ def test_prefers_finite_idle_duration_over_off (self ):
47+ combined_profile = combine_fleet_and_run_profiles (
48+ Profile (idle_duration = 300 ),
49+ Profile (idle_duration = - 1 ),
50+ )
51+
52+ assert combined_profile is not None
53+ assert combined_profile .idle_duration == 300
54+
4655 @pytest .mark .parametrize (
4756 argnames = ["fleet_profile" , "run_profile" , "expected_profile" ],
4857 argvalues = [
@@ -218,27 +227,19 @@ def test_both_negative_returns_minimum(self):
218227 def test_both_zero_returns_zero (self ):
219228 assert _combine_idle_duration_optional (0 , 0 ) == 0
220229
221- def test_positive_and_negative_raises_error (self ):
222- with pytest .raises (
223- CombineError , match = "idle_duration values 3600 and -1 cannot be combined"
224- ):
225- _combine_idle_duration_optional (3600 , - 1 )
230+ def test_positive_and_negative_returns_positive (self ):
231+ assert _combine_idle_duration_optional (3600 , - 1 ) == 3600
226232
227- def test_negative_and_positive_raises_error (self ):
228- with pytest .raises (
229- CombineError , match = "idle_duration values -1 and 3600 cannot be combined"
230- ):
231- _combine_idle_duration_optional (- 1 , 3600 )
233+ def test_negative_and_positive_returns_positive (self ):
234+ assert _combine_idle_duration_optional (- 1 , 3600 ) == 3600
232235
233236 def test_zero_and_positive_returns_zero (self ):
234237 assert _combine_idle_duration_optional (0 , 3600 ) == 0
235238 assert _combine_idle_duration_optional (3600 , 0 ) == 0
236239
237- def test_zero_and_negative_raises_error (self ):
238- with pytest .raises (CombineError , match = "idle_duration values 0 and -1 cannot be combined" ):
239- _combine_idle_duration_optional (0 , - 1 )
240- with pytest .raises (CombineError , match = "idle_duration values -1 and 0 cannot be combined" ):
241- _combine_idle_duration_optional (- 1 , 0 )
240+ def test_zero_and_negative_returns_zero (self ):
241+ assert _combine_idle_duration_optional (0 , - 1 ) == 0
242+ assert _combine_idle_duration_optional (- 1 , 0 ) == 0
242243
243244
244245class TestCombineSpotPolicy :
0 commit comments