Permalink
Browse files

Merge pull request #1128 from johnelse/unit-test-refactor-clearwater

CLEARWATER: Refactor unit tests for consistency
  • Loading branch information...
2 parents 8669fbc + 8b6b9fb commit c11254839ccca86de51e94c3916dcc19182be471 @johnelse johnelse committed Apr 3, 2013
Showing with 28 additions and 30 deletions.
  1. +3 −28 ocaml/test/suite.ml
  2. +9 −0 ocaml/test/test_basic.ml
  3. +7 −1 ocaml/test/test_pool_db_backup.ml
  4. +9 −1 ocaml/test/test_xapi_db_upgrade.ml
View
@@ -14,37 +14,12 @@
open OUnit
-let test_basic =
- let open Test_basic in
- "test_basic" >:::
- [
- "test_always_pass" >:: test_always_pass ;
- "test_always_fail" >:: test_always_fail ;
- "test_mock_db" >:: test_mock_db ;
- "test_assert_licensed_storage_motion" >:: test_assert_licensed_storage_motion ;
- ]
-
-let test_db_backup =
- "test_db_backup" >:::
- [
- "test_prepare_restore" >:: Test_pool_db_backup.test_prepare_restore;
- ]
-
-let test_db_upgrade =
- let open Test_xapi_db_upgrade in
- "test_db_upgrade" >:::
- [
- "upgrade_vm_memory_for_dmc" >:: upgrade_vm_memory_for_dmc;
- "upgrade_bios" >:: upgrade_bios;
- "update_snapshots" >:: update_snapshots;
- ]
-
let base_suite =
"base_suite" >:::
[
- test_basic;
- test_db_backup;
- test_db_upgrade;
+ Test_basic.test;
+ Test_pool_db_backup.test;
+ Test_xapi_db_upgrade.test;
]
let _ = run_test_tt_main base_suite
View
@@ -34,3 +34,12 @@ let test_assert_licensed_storage_motion () = skip "TODO" ;
let licensed = try Xapi_vm_migrate.assert_licensed_storage_motion ~__context; true
with _ -> false in
assert_bool "Not licensed for SXM" licensed
+
+let test =
+ "test_basic" >:::
+ [
+ "test_always_pass" >:: test_always_pass ;
+ "test_always_fail" >:: test_always_fail ;
+ "test_mock_db" >:: test_mock_db ;
+ "test_assert_licensed_storage_motion" >:: test_assert_licensed_storage_motion ;
+ ]
@@ -47,4 +47,10 @@ let test_prepare_restore () =
(* new_context should have correct master dom0 uuid *)
let dom0 = List.hd (Db.Host.get_resident_VMs ~__context:new_context ~self:master) in
let dom0_uuid = Db.VM.get_uuid ~__context:new_context ~self:dom0 in
- assert_equal ~msg:"test_prepare_restore: master dom0 uuid wrong" dom0_uuid my_control_uuid;
+ assert_equal ~msg:"test_prepare_restore: master dom0 uuid wrong" dom0_uuid my_control_uuid
+
+let test =
+ "test_db_backup" >:::
+ [
+ "test_prepare_restore" >:: test_prepare_restore;
+ ]
@@ -95,4 +95,12 @@ let update_snapshots () =
(* b_snap2.parent = b_snap *)
assert_equal ~msg:"b_snap2.parent <> b_snap"
- (Db.VM.get_parent ~__context ~self:b_snap2)b_snap;
+ (Db.VM.get_parent ~__context ~self:b_snap2)b_snap
+
+let test =
+ "test_db_upgrade" >:::
+ [
+ "upgrade_vm_memory_for_dmc" >:: upgrade_vm_memory_for_dmc;
+ "upgrade_bios" >:: upgrade_bios;
+ "update_snapshots" >:: update_snapshots;
+ ]

0 comments on commit c112548

Please sign in to comment.