508e6e9615dfc0ac4d08a4f0dc8e6e7e42f30d9b
[debian/amanda] / installcheck / amdump.pl
1 # Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
2 #
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.
6 #
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
10 # for more details.
11 #
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
15 #
16 # Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
17 # Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
18
19 use Test::More tests => 2;
20
21 use lib "@amperldir@";
22 use Installcheck::Config;
23 use Installcheck::Run qw(run run_err $diskname amdump_diag);
24 use Amanda::Config qw( :init );
25 use Amanda::Paths;
26
27 my $testconf;
28
29 # Just run amdump.
30
31 $testconf = Installcheck::Run::setup();
32 $testconf->add_param('label_new_tapes', '"TESTCONF%%"');
33
34 # one program "GNUTAR"
35 $testconf->add_dle(<<EODLE);
36 localhost diskname1 $diskname {
37     installcheck-test
38     program "GNUTAR"
39 }
40 EODLE
41
42 # and one with the amgtar application
43 $testconf->add_dle(<<EODLE);
44 localhost diskname2 $diskname {
45     installcheck-test
46     program "APPLICATION"
47     application {
48         plugin "amgtar"
49         property "ATIME-PRESERVE" "NO"
50     }
51 }
52 EODLE
53 $testconf->write();
54
55 ok(run('amdump', 'TESTCONF'), "amdump runs successfully")
56     or amdump_diag();
57
58 # Dump a nonexistant client, and see amdump fail.
59 $testconf = Installcheck::Run::setup();
60 $testconf->add_dle('does-not-exist.example.com / installcheck-test');
61 $testconf->write();
62
63 ok(!run('amdump', 'TESTCONF'), "amdump fails with nonexistent client");
64
65 Installcheck::Run::cleanup();