@@ -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? ( /\A lock:vm:/ ) }
39+ non_vm_lock_data = flexible_data . reject { |e | e [ 'object_type' ] == 'lock' && e [ 'object_name' ] . match? ( /\A lock:vm:/ ) }
40+
41+ expect ( vm_lock_events ) . to all ( include (
42+ 'object_type' => 'lock' ,
43+ 'object_name' => /\A lock: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' => '' } ,
0 commit comments