Skip to content

Commit d6cc066

Browse files
committed
Fix expectation with VM lock events
VM lock introduced new events for VM operations
1 parent a517f53 commit d6cc066

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

src/spec/integration/cli_events_spec.rb

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,21 @@ def first_part_of_test
3535
expect(stable_data).to all(include('task_id' => /[0-9]{1,3}|-|^$/))
3636
expect(stable_data).to all(include('id' => /[0-9]{1,3} <- [0-9]{1,3}|[0-9]{1,3}|^$/))
3737

38-
expect(flexible_data).to contain_exactly(
38+
vm_lock_events = flexible_data.select { |e| e['object_type'] == 'lock' && e['object_name'].match?(/\Alock:vm:/) }
39+
non_vm_lock_data = flexible_data.reject { |e| e['object_type'] == 'lock' && e['object_name'].match?(/\Alock:vm:/) }
40+
41+
expect(vm_lock_events).to all(include(
42+
'object_type' => 'lock',
43+
'object_name' => /\Alock:vm:[0-9]{1,6}\z/,
44+
'action' => /acquire|release/,
45+
'context' => '',
46+
'deployment' => '',
47+
'instance' => '',
48+
'error' => '',
49+
))
50+
expect(vm_lock_events.count { |e| e['action'] == 'acquire' }).to eq(vm_lock_events.count { |e| e['action'] == 'release' })
51+
52+
expect(non_vm_lock_data).to contain_exactly(
3953
{'action' => 'start', 'object_type' => 'worker', 'object_name' => 'worker_0', 'deployment' => '', 'instance' => '', 'context' => '', 'error' => ''},
4054
{'action' => 'start', 'object_type' => 'worker', 'object_name' => 'worker_1', 'deployment' => '', 'instance' => '', 'context' => '', 'error' => ''},
4155
{'action' => 'start', 'object_type' => 'worker', 'object_name' => 'worker_2', 'deployment' => '', 'instance' => '', 'context' => '', 'error' => ''},

src/spec/integration/events_access_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,21 @@ def run_events_cmd(env)
3434
output, exit_code = run_events_cmd(team_client_read_env)
3535

3636
expect(exit_code).to eq(0)
37-
expect(output).to include '39 events'
37+
expect(output).to include '43 events'
3838
end
3939

4040
it 'bosh.teams.X.admin should be able to see all events in the director' do
4141
output, exit_code = run_events_cmd(team_client_admin_env)
4242

4343
expect(exit_code).to eq(0)
44-
expect(output).to include '39 events'
44+
expect(output).to include '43 events'
4545
end
4646

4747
it 'bosh.X.admin should be able to see all events in the director' do
4848
output, exit_code = run_events_cmd(director_client_env)
4949

5050
expect(exit_code).to eq(0)
51-
expect(output).to include '39 events'
51+
expect(output).to include '43 events'
5252
end
5353

5454
it 'no-access should not be able to see all events in the director' do

0 commit comments

Comments
 (0)