Imported Upstream version 3.1.0
[debian/amanda] / installcheck / amvault.pl
1 # Copyright (c) 2010 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 => 2;
20
21 use lib "@amperldir@";
22 use File::Path;
23 use Installcheck;
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
30 my $vtape_root = "$Installcheck::TMP/tertiary";
31 sub setup_chg_disk {
32     rmtree $vtape_root if -d $vtape_root;
33     mkpath "$vtape_root/slot1";
34     return "chg-disk:$vtape_root";
35 }
36
37 # set up a basic dump
38 Installcheck::Dumpcache::load("basic");
39
40 # and then set up a new vtape to vault onto
41 my $tertiary_chg = setup_chg_disk();
42
43 ok(run("$sbindir/amvault", 'TESTCONF', 'latest', $tertiary_chg, "TESTCONF%%"),
44     "amvault runs!")
45     or diag($Installcheck::Run::stderr);
46
47 my @tert_files = glob("$vtape_root/slot1/0*");
48 ok(@tert_files > 0,
49     "..and files appear on the tertiary volume!");
50
51 rmtree $vtape_root;
52 Installcheck::Run::cleanup();