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