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