]>
git.proxmox.com Git - pve-storage.git/blob - test/filesystem_path_test.pm
c1b6d905766c44a5fd6640945e5150e727ab6843
1 package PVE
::Storage
::TestFilesystemPath
;
11 my $path = '/some/path';
13 # each array entry is a test that consists of the following keys:
14 # volname => image name that is passed to parse_volname
15 # snapname => to test the die condition
16 # expected => the array of return values; or the die message
19 volname
=> '1234/vm-1234-disk-0.raw',
22 "$path/images/1234/vm-1234-disk-0.raw",
28 volname
=> '1234/vm-1234-disk-0.raw',
29 snapname
=> 'my_snap',
30 expected
=> "can't snapshot this image format\n"
33 volname
=> '1234/vm-1234-disk-0.qcow2',
36 "$path/images/1234/vm-1234-disk-0.qcow2",
42 volname
=> '1234/vm-1234-disk-0.qcow2',
43 snapname
=> 'my_snap',
45 "$path/images/1234/vm-1234-disk-0.qcow2",
51 volname
=> 'iso/my-awesome-proxmox.iso',
54 "$path/template/iso/my-awesome-proxmox.iso",
60 volname
=> "backup/vzdump-qemu-1234-2020_03_30-21_12_40.vma",
63 "$path/dump/vzdump-qemu-1234-2020_03_30-21_12_40.vma",
70 plan tests
=> scalar @$tests;
72 foreach my $tt (@$tests) {
73 my $volname = $tt->{volname
};
74 my $snapname = $tt->{snapname
};
75 my $expected = $tt->{expected
};
76 my $scfg = { path
=> $path };
80 $got = [ PVE
::Storage
::Plugin-
>filesystem_path($scfg, $volname, $snapname) ];
84 is_deeply
($got, $expected, "wantarray: filesystem_path for $volname")
85 || diag
(explain
($got));