Skip to content

Commit bac3f9f

Browse files
committed
amend time-machine update in aws provider test and task-sdk tests
1 parent fc677be commit bac3f9f

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

providers/amazon/tests/unit/amazon/aws/sensors/test_s3.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -556,9 +556,9 @@ def test_poke_succeeds_on_upload_complete(self, time_machine):
556556
self.sensor.hook = mock.MagicMock()
557557
self.sensor.hook.list_keys.return_value = {"a"}
558558
assert not self.sensor.poke(dict())
559-
time_machine.coordinates.shift(10)
559+
time_machine.shift(10)
560560
assert not self.sensor.poke(dict())
561-
time_machine.coordinates.shift(10)
561+
time_machine.shift(10)
562562
assert self.sensor.poke(dict())
563563

564564
def test_fail_is_keys_unchanged(self):

task-sdk/tests/task_sdk/bases/test_sensor.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -175,15 +175,15 @@ def test_ok_with_reschedule(self, run_task, make_sensor, time_machine):
175175
assert msg.reschedule_date == date1 + timedelta(seconds=sensor.poke_interval)
176176

177177
# second poke returns False and task is re-scheduled
178-
time_machine.coordinates.shift(sensor.poke_interval)
178+
time_machine.shift(sensor.poke_interval)
179179
date2 = date1 + timedelta(seconds=sensor.poke_interval)
180180
state, msg, _ = run_task(task=sensor)
181181

182182
assert state == TaskInstanceState.UP_FOR_RESCHEDULE
183183
assert msg.reschedule_date == date2 + timedelta(seconds=sensor.poke_interval)
184184

185185
# third poke returns True and task succeeds
186-
time_machine.coordinates.shift(sensor.poke_interval)
186+
time_machine.shift(sensor.poke_interval)
187187
state, _, _ = run_task(task=sensor)
188188

189189
assert state == TaskInstanceState.SUCCESS
@@ -201,7 +201,7 @@ def test_fail_with_reschedule(self, run_task, make_sensor, time_machine, mock_su
201201
assert msg.reschedule_date == date1 + timedelta(seconds=sensor.poke_interval)
202202

203203
# second poke returns False, timeout occurs
204-
time_machine.coordinates.shift(sensor.poke_interval)
204+
time_machine.shift(sensor.poke_interval)
205205

206206
# Mocking values from DB/API-server
207207
mock_supervisor_comms.send.return_value = TaskRescheduleStartDate(start_date=date1)
@@ -223,7 +223,7 @@ def test_soft_fail_with_reschedule(self, run_task, make_sensor, time_machine, mo
223223
assert state == TaskInstanceState.UP_FOR_RESCHEDULE
224224

225225
# second poke returns False, timeout occurs
226-
time_machine.coordinates.shift(sensor.poke_interval)
226+
time_machine.shift(sensor.poke_interval)
227227

228228
# Mocking values from DB/API-server
229229
mock_supervisor_comms.send.return_value = TaskRescheduleStartDate(start_date=date1)
@@ -258,7 +258,7 @@ def run_duration():
258258
# loop poke returns false
259259
for _poke_count in range(1, false_count + 1):
260260
curr_date = curr_date + timedelta(seconds=new_interval)
261-
time_machine.coordinates.shift(new_interval)
261+
time_machine.shift(new_interval)
262262
state, msg, _ = run_task(sensor, context_update={"task_reschedule_count": _poke_count})
263263
assert state == TaskInstanceState.UP_FOR_RESCHEDULE
264264
old_interval = new_interval
@@ -268,7 +268,7 @@ def run_duration():
268268

269269
# last poke returns True and task succeeds
270270
curr_date = curr_date + timedelta(seconds=new_interval)
271-
time_machine.coordinates.shift(new_interval)
271+
time_machine.shift(new_interval)
272272

273273
state, msg, _ = run_task(sensor, context_update={"task_reschedule_count": false_count + 1})
274274
assert state == TaskInstanceState.SUCCESS

0 commit comments

Comments
 (0)