Skip to content

Commit 4cd9cec

Browse files
committed
added tests for all combinations of icp, fcp start and stop points
1 parent b949c7b commit 4cd9cec

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed

tests/integration/test_config.py

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,3 +670,90 @@ async def test_invalid_starttask(one_conf, flow, scheduler, start):
670670
with pytest.raises(InputError, match='a///b'):
671671
async with start(schd):
672672
pass
673+
674+
675+
@pytest.mark.parametrize(
676+
'a, b, c, d, validation_fail, err',
677+
(
678+
('initial', 'start', 'stop', 'final', True, False),
679+
(
680+
'initial', 'start', 'final', 'stop', True,
681+
"Stop cycle point '20030101T0000Z' will have no effect as it"
682+
" is after the final cycle point '20020101T0000Z'."
683+
),
684+
# Not detectable from validate
685+
# ('initial', 'stop', 'start', 'final', False, "asdf"),
686+
# ('initial', 'stop', 'final', 'start', False, "asdf"),
687+
(
688+
'initial', 'final', 'start', 'stop', True,
689+
"Stop cycle point '20030101T0000Z' will have no effect as it"
690+
" is after the final cycle point '20010101T0000Z'."
691+
),
692+
(
693+
'initial', 'final', 'stop', 'start', True,
694+
"Stop cycle point '20020101T0000Z' will have no effect as it"
695+
" is after the final cycle point '20010101T0000Z'."
696+
),
697+
# ('start', 'initial', 'stop', 'final', True, "asdf"),
698+
(
699+
'start', 'initial', 'final', 'stop', True,
700+
"Stop cycle point '20030101T0000Z' will have no effect as it"
701+
" is after the final cycle point '20020101T0000Z'."
702+
),
703+
(
704+
'start', 'stop', 'initial', 'final', True,
705+
"Stop cycle point '20010101T0000Z' will have no effect as it"
706+
" is before the initial cycle point '20020101T0000Z'."
707+
),
708+
('start', 'stop', 'final', 'initial', True, WorkflowConfigError),
709+
('start', 'final', 'initial', 'stop', True, WorkflowConfigError),
710+
('start', 'final', 'stop', 'initial', True, WorkflowConfigError),
711+
(
712+
'stop', 'initial', 'start', 'final', True,
713+
"Stop cycle point '20000101T0000Z' will have no effect as it"
714+
" is before the initial cycle point '20010101T0000Z'."
715+
),
716+
(
717+
'stop', 'initial', 'final', 'start', True,
718+
"Stop cycle point '20000101T0000Z' will have no effect as it"
719+
" is before the initial cycle point '20010101T0000Z'."
720+
),
721+
(
722+
'stop', 'start', 'initial', 'final', True,
723+
"Stop cycle point '20000101T0000Z' will have no effect as it"
724+
" is before the initial cycle point '20020101T0000Z'."
725+
),
726+
('stop', 'start', 'final', 'initial', True, WorkflowConfigError),
727+
('stop', 'final', 'initial', 'start', True, WorkflowConfigError),
728+
('stop', 'final', 'start', 'initial', True, WorkflowConfigError),
729+
('final', 'initial', 'start', 'stop', True, WorkflowConfigError),
730+
('final', 'initial', 'stop', 'start', True, WorkflowConfigError),
731+
('final', 'start', 'initial', 'stop', True, WorkflowConfigError),
732+
('final', 'start', 'stop', 'initial', True, WorkflowConfigError),
733+
('final', 'stop', 'initial', 'start', True, WorkflowConfigError),
734+
('final', 'stop', 'start', 'initial', True, WorkflowConfigError),
735+
)
736+
)
737+
def test_milestone_cycle_points(
738+
a, b, c, d, validation_fail, err, flow, validate, scheduler, start, caplog
739+
):
740+
"""Ensure that all combinations of
741+
"""
742+
order = dict(zip((a, b, c, d), [2000, 2001, 2002, 2003]))
743+
744+
wid = flow({
745+
'scheduling': {
746+
'initial cycle point': order['initial'],
747+
'stop after cycle point': order['stop'],
748+
'final cycle point': order['final'],
749+
'graph': {'P1Y': 'foo'}
750+
},
751+
})
752+
if not err:
753+
validate(wid)
754+
elif isinstance(err, str):
755+
validate(wid)
756+
assert err in caplog.messages
757+
else:
758+
with pytest.raises(err):
759+
validate(wid)

0 commit comments

Comments
 (0)