lintian doesn't like orphan packages with uploaders...
[debian/amanda] / installcheck / Amanda_Changer_rait.pl
index 37df0f380cf2a8820b02af0a5c47f995d70aa53a..1526ad3f121d0816ef6ffc7878eda3e6b770db69 100644 (file)
@@ -1,8 +1,9 @@
-# Copyright (c) 2009, 2010 Zmanda, Inc.  All Rights Reserved.
+# Copyright (c) 2009-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
 # Contact information: Zmanda Inc, 465 S. Mathilda Ave., Suite 300
 # Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
 
-use Test::More tests => 42;
+use Test::More tests => 43;
 use File::Path;
 use Data::Dumper;
 use strict;
+use warnings;
 
 use lib "@amperldir@";
 use Installcheck;
@@ -102,7 +104,8 @@ sub test_threeway {
     pass("Create 3-way RAIT of vtapes");
 
     my $steps = define_steps
-       cb_ref => \$finished_cb;
+       cb_ref => \$finished_cb,
+       finalize => sub { $chg->quit() };
 
     step get_info => sub {
         $chg->info(info_cb => $steps->{'check_info'},
@@ -267,19 +270,19 @@ sub test_threeway {
        die $err if $err;
 
        is_deeply($inv,  [
-          { state => Amanda::Changer::SLOT_FULL, device_status => $DEVICE_STATUS_SUCCESS,
+          { state => Amanda::Changer::SLOT_FULL, device_status => $DEVICE_STATUS_VOLUME_UNLABELED,
            f_type => $Amanda::Header::F_EMPTY, label => undef, # undef because labels don't match
            reserved => 0,
            slot => '{1,1,1}', import_export => undef },
-          { state => Amanda::Changer::SLOT_FULL, device_status => $DEVICE_STATUS_SUCCESS,
+          { state => Amanda::Changer::SLOT_FULL, device_status => $DEVICE_STATUS_VOLUME_UNLABELED,
            f_type => $Amanda::Header::F_EMPTY, label => undef, # all blank
            reserved => 0,
            slot => '{2,2,2}', import_export => undef },
-          { state => Amanda::Changer::SLOT_FULL, device_status => $DEVICE_STATUS_SUCCESS,
+          { state => Amanda::Changer::SLOT_FULL, device_status => $DEVICE_STATUS_VOLUME_UNLABELED,
            f_type => $Amanda::Header::F_EMPTY, label => undef, # mismatched labels
            reserved => 0,
            slot => '{3,3,3}', import_export => undef },
-          { state => Amanda::Changer::SLOT_FULL, device_status => $DEVICE_STATUS_SUCCESS,
+          { state => Amanda::Changer::SLOT_FULL, device_status => $DEVICE_STATUS_VOLUME_UNLABELED,
            f_type => $Amanda::Header::F_EMPTY, label => undef, # mismatched labels
            reserved => 0,
            slot => '{4,4,4}', import_export => undef } ,
@@ -296,9 +299,11 @@ sub test_threeway_error {
 
     my $chg = Amanda::Changer->new("chg-rait:{chg-disk:$tapebase/1,chg-disk:$tapebase/2,ERROR}");
     pass("Create 3-way RAIT of vtapes, with the third errored out");
+    is($chg->have_inventory(), '1', "changer have inventory");
 
     my $steps = define_steps
-       cb_ref => \$finished_cb;
+       cb_ref => \$finished_cb,
+       finalize => sub { $chg->quit() };
 
     step get_info => sub {
         $chg->info(info_cb => $steps->{'check_info'},
@@ -388,7 +393,8 @@ sub test_normal_inventory {
     pass("Create 3-way RAIT of vtapes with correctly-labeled children");
 
     my $steps = define_steps
-       cb_ref => \$finished_cb;
+       cb_ref => \$finished_cb,
+       finalize => sub { $chg->quit() };
 
     step setup => sub {
        reset_taperoot();
@@ -415,9 +421,9 @@ sub test_normal_inventory {
            slot => '{1,1,1}', import_export => undef },
           { state => Amanda::Changer::SLOT_FULL, device_status => $DEVICE_STATUS_SUCCESS, f_type => $Amanda::Header::F_TAPESTART, label => 'mytape-2', reserved => 0,
            slot => '{2,2,2}', import_export => undef },
-          { state => Amanda::Changer::SLOT_FULL, device_status => $DEVICE_STATUS_SUCCESS, f_type => $Amanda::Header::F_EMPTY, label => undef, reserved => 0,
+          { state => Amanda::Changer::SLOT_FULL, device_status => $DEVICE_STATUS_VOLUME_UNLABELED, f_type => $Amanda::Header::F_EMPTY, label => undef, reserved => 0,
            slot => '{3,3,3}', import_export => undef },
-          { state => Amanda::Changer::SLOT_FULL, device_status => $DEVICE_STATUS_SUCCESS, f_type => $Amanda::Header::F_EMPTY, label => undef, reserved => 0,
+          { state => Amanda::Changer::SLOT_FULL, device_status => $DEVICE_STATUS_VOLUME_UNLABELED, f_type => $Amanda::Header::F_EMPTY, label => undef, reserved => 0,
            slot => '{4,4,4}', import_export => undef } ,
         ], "second inventory is correct");
 
@@ -453,7 +459,8 @@ sub test_properties {
        "Create RAIT device from a named config subsection");
 
     my $steps = define_steps
-       cb_ref => \$finished_cb;
+       cb_ref => \$finished_cb,
+       finalize => sub { $chg->quit() };
 
     step do_load_1 => sub {
        reset_taperoot();
@@ -497,7 +504,8 @@ sub test_except_slots {
     my $chg;
 
     my $steps = define_steps
-       cb_ref => \$finished_cb;
+       cb_ref => \$finished_cb,
+       finalize => sub { $chg->quit() if defined $chg };
 
     step start => sub {
        $chg = Amanda::Changer->new("myrait");