Imported Upstream version 3.3.2
[debian/amanda] / installcheck / amdump_client.pl
1 # Copyright (c) 2008-2012 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. Mathilda Ave., Suite 300
17 # Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
18
19 use Test::More tests => 3;
20 use strict;
21 use warnings;
22
23 use lib "@amperldir@";
24 use Installcheck::Dumpcache;
25 use Installcheck::Config;
26 use Installcheck::Run qw(run run_err $diskname amdump_diag);
27 use Amanda::Config qw( :init );
28 use Amanda::Paths;
29 use Sys::Hostname;
30
31 my $testconf;
32
33 # Just run amdump.
34
35 $testconf = Installcheck::Run::setup();
36 $testconf->add_param('autolabel', '"TESTCONF%%" empty volume_error');
37
38 my $hostname = hostname;
39 $testconf->add_client_param('auth', '"local"');
40 $testconf->add_client_param('amdump_server', "\"$hostname\"");
41
42 # and one with the amgtar application
43 $testconf->add_dle(<<EODLE);
44 $hostname diskname $diskname {
45     installcheck-test
46     program "APPLICATION"
47     dump-limit server
48     application {
49         plugin "amgtar"
50         property "ATIME-PRESERVE" "NO"
51     }
52 }
53 EODLE
54 $testconf->write();
55
56 ok(run('amdump_client', '--config', 'TESTCONF', 'list'), "'amdump_client list' runs successfully");
57 is($Installcheck::Run::stdout,
58     "config: TESTCONF\ndiskname\n",
59     "'amdump_client list' list diskname");
60 ok(run('amdump_client', '--config', 'TESTCONF', 'dump'), "'amdump_client dump' runs successfully")
61     or amdump_diag();
62
63 Installcheck::Run::cleanup();