From eb9091db7b69d93646be68c97cc294cab8115442 Mon Sep 17 00:00:00 2001 From: Nishad Mathur Date: Wed, 25 Mar 2026 15:01:51 -0700 Subject: [PATCH] Fix non-deterministic event ordering in CreateVmStep unit test Models::Event.first without ORDER BY returns non-deterministic results in PostgreSQL. After the dynamic-disks PR added many new event-creating tests, the sequence counter changes caused PostgreSQL to return the ensure-block event instead of the initial event. ai-assisted=yes [TNZ-60576] [Doppler] Bosh KTLO Signed-off-by: Matthew Kocher Co-authored-by: Matthew Kocher --- .../bosh/director/deployment_plan/steps/create_vm_step_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bosh-director/spec/unit/bosh/director/deployment_plan/steps/create_vm_step_spec.rb b/src/bosh-director/spec/unit/bosh/director/deployment_plan/steps/create_vm_step_spec.rb index 4f73841d84..6e084f2afa 100644 --- a/src/bosh-director/spec/unit/bosh/director/deployment_plan/steps/create_vm_step_spec.rb +++ b/src/bosh-director/spec/unit/bosh/director/deployment_plan/steps/create_vm_step_spec.rb @@ -429,7 +429,7 @@ module Steps subject.perform(report) end.to change { Models::Event.count }.from(0).to(2) - event1 = Models::Event.first + event1 = Models::Event.order(:id).first expect(event1.user).to eq('user') expect(event1.action).to eq('create') expect(event1.object_type).to eq('vm')