X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=installcheck%2Famlabel.pl;h=8d8024e761c1231983584b8211f18ba5903657d9;hb=d28952249e392eb31bc8eecc53f6c477f30c617b;hp=92f45346672a19cbba4d103ecc1334615b08f4af;hpb=b116e9366c7b2ea2c2eb53b0a13df4090e176235;p=debian%2Famanda diff --git a/installcheck/amlabel.pl b/installcheck/amlabel.pl index 92f4534..8d8024e 100644 --- a/installcheck/amlabel.pl +++ b/installcheck/amlabel.pl @@ -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 @@ -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 => 19; +use Test::More tests => 24; use strict; use warnings; @@ -35,7 +36,8 @@ my $testconf; Amanda::Debug::dbopen("installcheck"); Installcheck::log_test_output(); -$testconf = Installcheck::Run::setup(); +$testconf = Installcheck::Run::setup(1, 4); +$testconf->add_param('autolabel', '"TESTCONF%%" any'); $testconf->write(); config_init($CONFIG_INIT_EXPLICIT_NAME, "TESTCONF"); @@ -79,6 +81,9 @@ like(run_get('amlabel', 'TESTCONF', 'TESTCONF92'), $tl->reload(); is_deeply($tl->{'tles'}->[0], { 'reuse' => 1, + 'barcode' => undef, + 'meta' => undef, + 'blocksize' => '32', 'comment' => undef, 'position' => 1, 'label' => 'TESTCONF92', @@ -133,3 +138,43 @@ Writing label 'TESTCONF88'/, ok(run('amlabel', 'TESTCONF', 'TESTCONF88', '-f', 'slot', '2'), "-f option doesn't have to follow 'amlabel'"); + +ok(run('amlabel', 'TESTCONF', 'TESTCONF88', '--meta', 'meta-01', '--barcode', 'bar-01', '--assign'), + "--assign works"); + +$tl->reload(); +is_deeply($tl->{'tles'}->[0], { + 'reuse' => 1, + 'barcode' => 'bar-01', + 'meta' => 'meta-01', + 'blocksize' => undef, + 'comment' => undef, + 'position' => 1, + 'label' => 'TESTCONF88', + 'datestamp' => '0' + }, + "tapelist correctly updated after --assign"); + +ok(run('amlabel', 'TESTCONF', 'slot', '4'), + "amlabel works without a label"); +like($Installcheck::Run::stdout, + qr/Reading label\.\.\. +Found an empty tape\. +Writing label 'TESTCONF01'\.\.\. +Checking label\.\.\. +Success!/, + "amlabel without label use autolabel"); + +$tl->reload(); +is_deeply($tl->{'tles'}->[0], { + 'reuse' => 1, + 'barcode' => undef, + 'meta' => 'meta-01', + 'blocksize' => '32', + 'comment' => undef, + 'position' => 1, + 'label' => 'TESTCONF01', + 'datestamp' => '0' + }, + "tapelist correctly updated after autolabel"); +