Skip to content

Commit b122c68

Browse files
committed
Adjust tests after other_operation_in_progress refactoring
quality-gate: Reduce expected List.hd count test_clustering: test for the blocking operation to be reported Signed-off-by: Andrii Sultanov <[email protected]>
1 parent aa251a2 commit b122c68

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

ocaml/tests/test_clustering.ml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -581,11 +581,21 @@ let test_disallow_unplug_during_cluster_host_create () =
581581
let key = Context.get_task_id __context |> Ref.string_of in
582582
Db.Cluster.add_to_current_operations ~__context ~self:cluster ~key ~value
583583
in
584-
let check_disallow_unplug_false_fails self msg =
584+
let check_disallow_unplug_false_fails self op msg =
585+
let op_ref, _ =
586+
List.hd (Db.Cluster.get_current_operations ~__context ~self:cluster)
587+
in
585588
Alcotest.check_raises msg
586589
Api_errors.(
587590
Server_error
588-
(other_operation_in_progress, ["Cluster"; Ref.string_of cluster])
591+
( other_operation_in_progress
592+
, [
593+
"Cluster"
594+
; Ref.string_of cluster
595+
; API.cluster_operation_to_string op
596+
; op_ref
597+
]
598+
)
589599
)
590600
(fun () -> Xapi_pif.set_disallow_unplug ~__context ~self ~value:false)
591601
in
@@ -598,14 +608,14 @@ let test_disallow_unplug_during_cluster_host_create () =
598608
let test_with_current op =
599609
Xapi_pif.set_disallow_unplug ~__context ~self:pIF ~value:true ;
600610
add_op op ;
601-
check_disallow_unplug_false_fails pIF
611+
check_disallow_unplug_false_fails pIF op
602612
"disallow_unplug cannot be set to false during cluster_host creation or \
603613
enable on same PIF" ;
604614
let other_pif = T.make_pif ~__context ~network ~host () in
605615
check_successful_disallow_unplug true other_pif
606616
"Should always be able to set disallow_unplug:true regardless of \
607617
clustering operations" ;
608-
check_disallow_unplug_false_fails other_pif
618+
check_disallow_unplug_false_fails other_pif op
609619
"disallow_unplug cannot be set to false during cluster_host creation or \
610620
enable on any PIF" ;
611621
let key = Context.get_task_id __context |> Ref.string_of in

quality-gate.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -e
44

55
list-hd () {
6-
N=279
6+
N=274
77
LIST_HD=$(git grep -r --count 'List.hd' -- **/*.ml | cut -d ':' -f 2 | paste -sd+ - | bc)
88
if [ "$LIST_HD" -eq "$N" ]; then
99
echo "OK counted $LIST_HD List.hd usages"

0 commit comments

Comments
 (0)