1 # Copyright (c) 2007,2008 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;
21 use lib "@amperldir@";
22 use Installcheck::Config;
23 use Installcheck::Dumpcache;
24 use Installcheck::Run qw(run run_get run_err $diskname);
30 # First, try amgetconf out without a config
33 "amcheck with no arguments returns an error exit status");
34 like($Installcheck::Run::stdout, qr/\AUSAGE:/i,
35 ".. and gives usage message");
37 like(run_err('amcheck', 'this-probably-doesnt-exist'),
38 qr(could not open conf file)i,
39 "run with non-existent config fails with an appropriate error message.");
42 # Now use a fresh new config
44 $testconf = Installcheck::Run::setup();
45 $testconf->add_param("autolabel", "\"TESTCONF%%\" empty volume_error");
46 $testconf->add_dle("localhost $diskname installcheck-test");
49 like(run_get('amcheck', 'TESTCONF'),
50 qr/Amanda Tape Server Host Check/,
51 "amcheck with a new config succeeds");
53 like(run_get('amcheck', '-s', 'TESTCONF'),
54 qr/Amanda Tape Server Host Check/,
57 like(run_get('amcheck', '-l', 'TESTCONF'),
58 qr/Amanda Tape Server Host Check/,
61 like(run_get('amcheck', '-t', 'TESTCONF'),
62 qr/Amanda Tape Server Host Check/,
65 like(run_get('amcheck', '-c', 'TESTCONF'),
66 qr/Amanda Backup Client Hosts Check/,
69 like(run_get('amcheck', '-c', 'TESTCONF', 'localhost', "$diskname"),
70 qr/Amanda Backup Client Hosts Check/,
71 "amcheck -c works with a hostname and diskname");
73 ok(!run('amcheck', '-o', 'autolabel=', 'TESTCONF'),
74 "amcheck -o configoption works");
76 # do this after the other tests, above, since it writes to the tape
77 like(run_get('amcheck', '-sw', 'TESTCONF'),
78 qr/Volume 'TESTCONF01' is writeable/,
79 "amcheck -w works (with -s)");
81 Installcheck::Dumpcache::load("basic");
82 ok(run('amcheck', 'TESTCONF'),
83 "amcheck on a cached dump run works");
85 Installcheck::Run::cleanup();