X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=installcheck%2FAmanda_Changer_single.pl;h=1f876d69f1e643f2ed3d0f60592a89456a6054ec;hb=ca9fbb570498b74f4c6adaebd629bff20f146a14;hp=80da868e38ca9f63d0e17263af0a0948659a3427;hpb=d5853102f67d85d8e169f9dbe973ad573306c215;p=debian%2Famanda diff --git a/installcheck/Amanda_Changer_single.pl b/installcheck/Amanda_Changer_single.pl index 80da868..1f876d6 100644 --- a/installcheck/Amanda_Changer_single.pl +++ b/installcheck/Amanda_Changer_single.pl @@ -1,4 +1,4 @@ -# Copyright (c) 2008,2009 Zmanda, Inc. All Rights Reserved. +# Copyright (c) 2008, 2009, 2010 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 @@ -19,6 +19,7 @@ use Test::More tests => 6; use File::Path; use strict; +use warnings; use lib "@amperldir@"; use Installcheck::Config; @@ -46,7 +47,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 +74,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 +86,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 +104,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();