lintian doesn't like orphan packages with uploaders...
[debian/amanda] / installcheck / Amanda_Changer_single.pl
index 80da868e38ca9f63d0e17263af0a0948659a3427..606cffbff300e927d5c0e9b380518cef309a6e29 100644 (file)
@@ -1,8 +1,9 @@
-# Copyright (c) 2008,2009 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
@@ -19,6 +20,7 @@
 use Test::More tests => 6;
 use File::Path;
 use strict;
+use warnings;
 
 use lib "@amperldir@";
 use Installcheck::Config;
@@ -46,7 +48,8 @@ if ($cfg_result != $CFGERR_OK) {
     die(join "\n", @errors);
 }
 
-my $chg = Amanda::Changer->new("chg-single:tape:/foo");
+my $chg = Amanda::Changer->new("chg-single:null:/foo");
+die "$chg" if $chg->isa("Amanda::Changer::Error");
 
 {
     my ($held_res);
@@ -72,7 +75,7 @@ my $chg = Amanda::Changer->new("chg-single:tape:/foo");
        my ($err, $res) = @_;
        ok(!$err, "no error loading relative slot 'current'")
            or diag($err);
-       is($res->{'device'}->device_name(), 'tape:/foo',
+       is($res->{'device'}->device_name(), 'null:/foo',
            "returns correct device name");
 
        $held_res = $res; # hang onto it while loading another slot
@@ -84,7 +87,7 @@ my $chg = Amanda::Changer->new("chg-single:tape:/foo");
     $got_second_res = make_cb('got_second_res' => sub {
        my ($err, $res) = @_;
        chg_err_like($err,
-           { message => qr{'tape:/foo' is already reserved},
+           { message => qr{'null:/foo' is already reserved},
              type => 'failed',
              reason => 'volinuse' },
            "second simultaneous reservation rejected");
@@ -102,8 +105,10 @@ my $chg = Amanda::Changer->new("chg-single:tape:/foo");
     $get_info->();
     Amanda::MainLoop::run();
 }
+$chg->quit();
 
 $chg = Amanda::Changer->new("chg-single:bogus:device");
 is("$chg",
     "chg-single: error opening device 'bogus:device': Device type bogus is not known.",
     "bogus device name detected early");
+$chg->quit();