]> git.proxmox.com Git - pve-storage.git/blobdiff - test/archive_info_test.pm
diskmanage: add helper for udev workaround
[pve-storage.git] / test / archive_info_test.pm
index 5e5ca8a93512b72ea5eecaa79bdf61656a3b18de..7e84b6a6cc203858b2349c2f6187f6ffde026285 100644 (file)
@@ -18,10 +18,42 @@ my $vmid = 16110;
 # most of them are created further below
 my $tests = [
     # backup archives
+    {
+       description => 'Backup archive, lxc, tgz, future millenium',
+       archive     => "backup/vzdump-lxc-$vmid-3070_01_01-00_00_00.tgz",
+       expected    => {
+           'filename'     => "vzdump-lxc-$vmid-3070_01_01-00_00_00.tgz",
+           'logfilename'  => "vzdump-lxc-$vmid-3070_01_01-00_00_00.log",
+           'type'         => 'lxc',
+           'format'       => 'tar',
+           'decompressor' => ['tar', '-z'],
+           'compression'  => 'gz',
+           'vmid'         => $vmid,
+           'ctime'        => 60*60*24 * (365*1100 + 267),
+           'is_std_name'  => 1,
+       },
+    },
+    {
+       description => 'Backup archive, lxc, tgz, very old',
+       archive     => "backup/vzdump-lxc-$vmid-1970_01_01-02_00_30.tgz",
+       expected    => {
+           'filename'     => "vzdump-lxc-$vmid-1970_01_01-02_00_30.tgz",
+           'logfilename'  => "vzdump-lxc-$vmid-1970_01_01-02_00_30.log",
+           'type'         => 'lxc',
+           'format'       => 'tar',
+           'decompressor' => ['tar', '-z'],
+           'compression'  => 'gz',
+           'vmid'         => $vmid,
+           'ctime'        => 60*60*2 + 30,
+           'is_std_name'  => 1,
+       },
+    },
     {
        description => 'Backup archive, lxc, tgz',
        archive     => "backup/vzdump-lxc-$vmid-2020_03_30-21_39_30.tgz",
        expected    => {
+           'filename'     => "vzdump-lxc-$vmid-2020_03_30-21_39_30.tgz",
+           'logfilename'  => "vzdump-lxc-$vmid-2020_03_30-21_39_30.log",
            'type'         => 'lxc',
            'format'       => 'tar',
            'decompressor' => ['tar', '-z'],
@@ -35,6 +67,8 @@ my $tests = [
        description => 'Backup archive, openvz, tgz',
        archive     => "backup/vzdump-openvz-$vmid-2020_03_30-21_39_30.tgz",
        expected    => {
+           'filename'     => "vzdump-openvz-$vmid-2020_03_30-21_39_30.tgz",
+           'logfilename'  => "vzdump-openvz-$vmid-2020_03_30-21_39_30.log",
            'type'         => 'openvz',
            'format'       => 'tar',
            'decompressor' => ['tar', '-z'],
@@ -44,10 +78,26 @@ my $tests = [
            'is_std_name'  => 1,
        },
     },
+    {
+       description => 'Backup archive, custom dump directory, qemu, tgz',
+       archive     => "/here/be/Back-ups/vzdump-qemu-$vmid-2020_03_30-21_39_30.tgz",
+       expected    => {
+           'filename'     => "vzdump-qemu-$vmid-2020_03_30-21_39_30.tgz",
+           'logfilename'  => "vzdump-qemu-$vmid-2020_03_30-21_39_30.log",
+           'type'         => 'qemu',
+           'format'       => 'tar',
+           'decompressor' => ['tar', '-z'],
+           'compression'  => 'gz',
+           'vmid'         => $vmid,
+           'ctime'        => 1585604370,
+           'is_std_name'  => 1,
+       },
+    },
     {
        description => 'Backup archive, none, tgz',
        archive     => "backup/vzdump-qemu-$vmid-whatever-the-name_is_here.tgz",
        expected    => {
+           'filename'     => "vzdump-qemu-$vmid-whatever-the-name_is_here.tgz",
            'type'         => 'qemu',
            'format'       => 'tar',
            'decompressor' => ['tar', '-z'],
@@ -86,6 +136,8 @@ for my $virt (sort keys %$bkp_suffix) {
            description => "Backup archive, $virt, $format.$suffix",
            archive     => "backup/vzdump-$virt-$vmid-2020_03_30-21_12_40.$format.$suffix",
            expected    => {
+               'filename'     => "vzdump-$virt-$vmid-2020_03_30-21_12_40.$format.$suffix",
+               'logfilename'  => "vzdump-$virt-$vmid-2020_03_30-21_12_40.log",
                'type'         => "$virt",
                'format'       => "$format",
                'decompressor' => $decomp->{$suffix},