Imported Upstream version 3.3.3
[debian/amanda] / installcheck / Amanda_Changer_multi.pl
index 138fe93b692348e5df25e9e9036fb6d09756ff2e..fa77969bfce0e6c01f31d82af46b85edecc871ac 100644 (file)
@@ -1,8 +1,9 @@
-# Copyright (c) 2008, 2009, 2010 Zmanda, Inc.  All Rights Reserved.
+# Copyright (c) 2008-2012 Zmanda, Inc.  All Rights Reserved.
 #
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 as published
-# by the Free Software Foundation.
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
 #
 # This program is distributed in the hope that it will be useful, but
 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
@@ -16,7 +17,7 @@
 # Contact information: Zmanda Inc, 465 S. Mathilda Ave., Suite 300
 # Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
 
-use Test::More tests => 18;
+use Test::More tests => 19;
 use File::Path;
 use strict;
 use warnings;
@@ -71,6 +72,7 @@ reset_taperoot(5);
 
 my $chg = Amanda::Changer->new("chg-multi:file:$taperoot/slot{0,1,2,3,4}");
 die($chg) if $chg->isa("Amanda::Changer::Error");
+is($chg->have_inventory(), '1', "changer have inventory");
 {
     my @slots = ();
     my @reservations = ();
@@ -377,29 +379,28 @@ Amanda::MainLoop::run();
            is_deeply($inv, [
              { slot => 1, state => Amanda::Changer::SLOT_FULL,
                device_status => $DEVICE_STATUS_DEVICE_ERROR,
+               device_error  => "Error checking directory $taperoot/slot0/data/: No such file or directory",
                f_type => undef, label => undef,
                reserved => 0 },
              { slot => 2, state => Amanda::Changer::SLOT_FULL,
-               device_status => ($DEVICE_STATUS_DEVICE_ERROR |
-                                 $DEVICE_STATUS_VOLUME_UNLABELED |
-                                 $DEVICE_STATUS_VOLUME_ERROR),
-               f_type => undef, label => undef,
+               device_status => $DEVICE_STATUS_VOLUME_UNLABELED,
+               device_error  => "File 0 not found",
+               f_type => $Amanda::Header::F_EMPTY, label => undef,
                reserved => 0 },
              { slot => 3, state => Amanda::Changer::SLOT_FULL,
-               device_status => ($DEVICE_STATUS_DEVICE_ERROR |
-                                 $DEVICE_STATUS_VOLUME_UNLABELED |
-                                 $DEVICE_STATUS_VOLUME_ERROR),
-               f_type => undef, label => undef,
+               device_status => $DEVICE_STATUS_VOLUME_UNLABELED,
+               device_error  => "File 0 not found",
+               f_type => $Amanda::Header::F_EMPTY, label => undef,
                reserved => 0 },
              { slot => 4, state => Amanda::Changer::SLOT_FULL,
                device_status => $DEVICE_STATUS_SUCCESS,
+               device_error  => undef,
                f_type => $Amanda::Header::F_TAPESTART, label => "FOO?BAR",
                reserved => 0, current => 1 },
              { slot => 5, state => Amanda::Changer::SLOT_FULL,
-               device_status => ($DEVICE_STATUS_DEVICE_ERROR |
-                                 $DEVICE_STATUS_VOLUME_UNLABELED |
-                                 $DEVICE_STATUS_VOLUME_ERROR),
-               f_type => undef, label => undef,
+               device_status => $DEVICE_STATUS_VOLUME_UNLABELED,
+               device_error  => "File 0 not found",
+               f_type => $Amanda::Header::F_EMPTY, label => undef,
                reserved => 0 },
                ], "inventory finds the labeled tape");
 
@@ -437,4 +438,5 @@ Amanda::MainLoop::run();
     Amanda::MainLoop::run();
 }
 
+$chg->quit();
 rmtree($taperoot);