diff --git a/tests/integration/test_xtrigger_mgr.py b/tests/integration/test_xtrigger_mgr.py index d0b9765979c..07abbdac24d 100644 --- a/tests/integration/test_xtrigger_mgr.py +++ b/tests/integration/test_xtrigger_mgr.py @@ -17,7 +17,7 @@ """ -async def test_2_xtriggers(flow, start, scheduler): +async def test_2_xtriggers(flow, start, scheduler, monkeypatch): """Test that if an itask has 2 wall_clock triggers with different offsets that xtrigger manager gets both of them. @@ -26,6 +26,12 @@ async def test_2_xtriggers(flow, start, scheduler): n.b. Clock 3 exists to check the memoization path is followed, and causing this test to give greater coverage. """ + task_point = 1588636800 # 2020-05-05 + ten_years_ahead = 1904169600 # 2030-05-05 + monkeypatch.setattr( + 'cylc.flow.xtriggers.wall_clock.time', + lambda: ten_years_ahead - 1 + ) id_ = flow({ 'scheduler': { 'allow implicit tasks': True @@ -49,6 +55,13 @@ async def test_2_xtriggers(flow, start, scheduler): clock_2_ctx = schd.xtrigger_mgr.get_xtrig_ctx(foo_proxy, 'clock_2') clock_3_ctx = schd.xtrigger_mgr.get_xtrig_ctx(foo_proxy, 'clock_2') - assert clock_1_ctx.func_kwargs['trigger_time'] == 1588636800 - assert clock_2_ctx.func_kwargs['trigger_time'] == 1904169600 - assert clock_3_ctx.func_kwargs['trigger_time'] == 1904169600 + assert clock_1_ctx.func_kwargs['trigger_time'] == task_point + assert clock_2_ctx.func_kwargs['trigger_time'] == ten_years_ahead + assert clock_3_ctx.func_kwargs['trigger_time'] == ten_years_ahead + + schd.xtrigger_mgr.call_xtriggers_async(foo_proxy) + assert foo_proxy.state.xtriggers == { + 'clock_1': True, + 'clock_2': False, + 'clock_3': False, + }