Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CA-402921: Relax VIF constraint for PVS proxy #6189

Merged
merged 4 commits into from
Dec 19, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
CA-402921: Update PVS-proxy tests
Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
  • Loading branch information
robhoes committed Dec 18, 2024
commit 2f2ee291641bb7e281533eeb0e6905c989bc7c00
31 changes: 27 additions & 4 deletions ocaml/tests/test_pvs_proxy.ml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,28 @@ let test_create_ok () =
"test_create_ok testing get_VIF" vIF
(Db.PVS_proxy.get_VIF ~__context ~self:pvs_proxy)

let test_create_invalid_device () =
let test_create_ok_lowest_device_number () =
let __context = T.make_test_database () in
let site = T.make_pvs_site ~__context () in
let vIF = T.make_vif ~__context ~device:"1" () in
Alcotest.check_raises "test_create_invalid_device should raise invalid_device"
Api_errors.(Server_error (invalid_device, ["1"]))
let _vIF' = T.make_vif ~__context ~device:"2" () in
let pvs_proxy = Xapi_pvs_proxy.create ~__context ~site ~vIF in
Alcotest.(check (Alcotest_comparators.ref ()))
"test_create_ok testing get_site" site
(Db.PVS_proxy.get_site ~__context ~self:pvs_proxy) ;
Alcotest.(check (Alcotest_comparators.ref ()))
"test_create_ok testing get_VIF" vIF
(Db.PVS_proxy.get_VIF ~__context ~self:pvs_proxy)

let test_create_not_lowest_device_number () =
let __context = T.make_test_database () in
let site = T.make_pvs_site ~__context () in
let _vIF' = T.make_vif ~__context ~device:"0" () in
let vIF = T.make_vif ~__context ~device:"1" () in
Alcotest.check_raises
"test_create_not_lowest_device_number should raise \
pvs_vif_must_be_first_device"
Api_errors.(Server_error (pvs_vif_must_be_first_device, []))
(fun () -> ignore (Xapi_pvs_proxy.create ~__context ~site ~vIF))

let test_create_invalid_site () =
Expand Down Expand Up @@ -103,7 +119,14 @@ let test =
[
("test_unlicensed", `Quick, test_unlicensed)
; ("test_create_ok", `Quick, test_create_ok)
; ("test_create_invalid_device", `Quick, test_create_invalid_device)
; ( "test_create_ok_lowest_device_number"
, `Quick
, test_create_ok_lowest_device_number
)
; ( "test_create_not_lowest_device_number"
, `Quick
, test_create_not_lowest_device_number
)
; ("test_create_invalid_site", `Quick, test_create_invalid_site)
; ("test_create_invalid_vif", `Quick, test_create_invalid_vif)
; ("test_destroy", `Quick, test_destroy)
Expand Down