]>
git.proxmox.com Git - pve-manager.git/blob - test/OSD_test.pl
10 use PVE
::API2
::Ceph
::OSD
;
19 children
=> [ 0,1,2,3 ],
23 children
=> [ 4,5,6,7 ],
27 children
=> [ 8,9,10,11 ],
33 # Check if all the grep and casts are correct
34 my @belong_to_B = ( 4,5 );
35 my @not_belong_to_B = ( -1,1,10,15 );
36 foreach (@belong_to_B) {
38 PVE
::API2
::Ceph
::OSD
::osd_belongs_to_node
($tree, 'pveB', $_),
40 "OSD $_ belongs to node pveB",
43 foreach (@not_belong_to_B) {
45 PVE
::API2
::Ceph
::OSD
::osd_belongs_to_node
($tree, 'pveB', $_),
47 "OSD $_ does not belong to node pveB",
52 my $double_nodes_tree = {
62 eval { PVE
::API2
::Ceph
::OSD
::osd_belongs_to_node
($double_nodes_tree, 'pveA') };
63 like
($@, qr/not be more than one/, "Die if node occurs too often");
65 my $tree_without_nodes = {
68 eval { PVE
::API2
::Ceph
::OSD
::osd_belongs_to_node
(undef) };
69 like
($@, qr/No tree nodes/, "Die if tree has no nodes");
72 done_testing
(@belong_to_B + @not_belong_to_B + 2);