1 # Copyright (c) 2007-2012 Zmanda, Inc. All Rights Reserved.
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful, but
9 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 # You should have received a copy of the GNU General Public License along
14 # with this program; if not, write to the Free Software Foundation, Inc.,
15 # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 # Contact information: Zmanda Inc, 465 S. Mathilda Ave., Suite 300
18 # Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
20 use Test::More tests => 12;
24 use lib "@amperldir@";
25 use Installcheck::Config;
26 use Installcheck::Dumpcache;
27 use Installcheck::Run qw(run run_get run_err $diskname);
33 # First, try amgetconf out without a config
36 "amcheck with no arguments returns an error exit status");
37 like($Installcheck::Run::stdout, qr/\AUSAGE:/i,
38 ".. and gives usage message");
40 like(run_err('amcheck', 'this-probably-doesnt-exist'),
41 qr(could not open conf file)i,
42 "run with non-existent config fails with an appropriate error message.");
45 # Now use a fresh new config
47 $testconf = Installcheck::Run::setup();
48 $testconf->add_param("autolabel", "\"TESTCONF%%\" empty volume_error");
49 $testconf->add_dle("localhost $diskname installcheck-test");
52 like(run_get('amcheck', 'TESTCONF'),
53 qr/Amanda Tape Server Host Check/,
54 "amcheck with a new config succeeds");
56 like(run_get('amcheck', '-s', 'TESTCONF'),
57 qr/Amanda Tape Server Host Check/,
60 like(run_get('amcheck', '-l', 'TESTCONF'),
61 qr/Amanda Tape Server Host Check/,
64 like(run_get('amcheck', '-t', 'TESTCONF'),
65 qr/Amanda Tape Server Host Check/,
68 like(run_get('amcheck', '-c', 'TESTCONF'),
69 qr/Amanda Backup Client Hosts Check/,
72 like(run_get('amcheck', '-c', 'TESTCONF', 'localhost', "$diskname"),
73 qr/Amanda Backup Client Hosts Check/,
74 "amcheck -c works with a hostname and diskname");
76 ok(!run('amcheck', '-o', 'autolabel=', 'TESTCONF'),
77 "amcheck -o configoption works");
79 # do this after the other tests, above, since it writes to the tape
80 like(run_get('amcheck', '-sw', 'TESTCONF'),
81 qr/Volume 'TESTCONF01' is writeable/,
82 "amcheck -w works (with -s)");
84 Installcheck::Dumpcache::load("basic");
85 ok(run('amcheck', 'TESTCONF'),
86 "amcheck on a cached dump run works");
88 Installcheck::Run::cleanup();