Skip to content

Commit 0eb4e83

Browse files
committed
Give the synced running task a start event in the tasks sync spec
The spec creates a task directly in RUNNING state and then completes it. A real running task always has a TASK_STARTED event; without one, the new stop-event code logs a warning, and the spec's strict logger double rejects it. Create the start event so the test data matches production.
1 parent 9c51aad commit 0eb4e83

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

spec/unit/lib/cloud_controller/diego/tasks_sync_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,10 @@ def exceptions
351351
context 'and the newly started task completes before the iteration completes', isolation: :truncation do
352352
# Can't use transactions for isolation because we're using multiple threads
353353
let!(:cc_task) { create(:task_model, guid: 'some-task-guid', state: TaskModel::RUNNING_STATE) }
354+
# A real running task always has a start event; without it, the
355+
# update to SUCCEEDED skips the stop event and logs a warning that
356+
# the strict logger double rejects.
357+
let!(:cc_task_start_event) { create(:app_usage_event, task_guid: cc_task.guid, state: 'TASK_STARTED') }
354358
let(:bbs_tasks) { [] }
355359

356360
before do

0 commit comments

Comments
 (0)