|
Packit Service |
392537 |
# Copyright (c) 2007-2012 Zmanda, Inc. All Rights Reserved.
|
|
Packit Service |
392537 |
# Copyright (c) 2013-2016 Carbonite, Inc. All Rights Reserved.
|
|
Packit Service |
392537 |
#
|
|
Packit Service |
392537 |
# This program is free software; you can redistribute it and/or
|
|
Packit Service |
392537 |
# modify it under the terms of the GNU General Public License
|
|
Packit Service |
392537 |
# as published by the Free Software Foundation; either version 2
|
|
Packit Service |
392537 |
# of the License, or (at your option) any later version.
|
|
Packit Service |
392537 |
#
|
|
Packit Service |
392537 |
# This program is distributed in the hope that it will be useful, but
|
|
Packit Service |
392537 |
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
Packit Service |
392537 |
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
Packit Service |
392537 |
# for more details.
|
|
Packit Service |
392537 |
#
|
|
Packit Service |
392537 |
# You should have received a copy of the GNU General Public License along
|
|
Packit Service |
392537 |
# with this program; if not, write to the Free Software Foundation, Inc.,
|
|
Packit Service |
392537 |
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
Packit Service |
392537 |
#
|
|
Packit Service |
392537 |
# Contact information: Carbonite Inc., 756 N Pastoria Ave
|
|
Packit Service |
392537 |
# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
use Test::More tests => 95;
|
|
Packit Service |
392537 |
use strict;
|
|
Packit Service |
392537 |
use warnings;
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
use lib '@amperldir@';
|
|
Packit Service |
392537 |
use Installcheck;
|
|
Packit Service |
392537 |
use Installcheck::Config;
|
|
Packit Service |
392537 |
use Installcheck::Run qw(run run_get run_err);
|
|
Packit Service |
392537 |
use Amanda::Debug;
|
|
Packit Service |
392537 |
use Amanda::Paths;
|
|
Packit Service |
392537 |
use Cwd;
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
Amanda::Debug::dbopen("installcheck");
|
|
Packit Service |
392537 |
Installcheck::log_test_output();
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
# this is re-created for each test
|
|
Packit Service |
392537 |
my $testconf;
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
##
|
|
Packit Service |
392537 |
# First, try amgetconf out without a config
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
ok(!run('amgetconf'), "bare amgetconf fails");
|
|
Packit Service |
392537 |
like($Installcheck::Run::stdout, qr(\AUsage: )i,
|
|
Packit Service |
392537 |
".. and gives usage message on stdout");
|
|
Packit Service |
392537 |
like(run_err('amgetconf', 'this-probably-doesnt-exist', 'tapedev'),
|
|
Packit Service |
392537 |
qr(could not open conf file)i,
|
|
Packit Service |
392537 |
"error message when configuration parameter doesn't exist");
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
##
|
|
Packit Service |
392537 |
# Next, work against a basically empty config
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
$testconf = Installcheck::Config->new();
|
|
Packit Service |
392537 |
$testconf->write();
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
# test some defaults
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', "reserve"), "100",
|
|
Packit Service |
392537 |
"reserve defaults to 100");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', "tapelist"), "tapelist",
|
|
Packit Service |
392537 |
"tapelist defaults to 'tapelist'");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', "usetimestamps"), "yes",
|
|
Packit Service |
392537 |
"usetimestamps defaults to 'yes'");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', "send_amreport_on"), "NEVER",
|
|
Packit Service |
392537 |
"send_amreport_on set to 'NEVER'"); # (enum value is 0)
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', "taperalgo"), "FIRST",
|
|
Packit Service |
392537 |
"taperalgo defaults to 'ALL'"); # (enum value is 0)
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', "printer"), "",
|
|
Packit Service |
392537 |
"printer defaults to empty string, which is not an error");
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
# test command-line parsing (amandates is in the global amanbda-client.conA)f
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', '--execute-where', 'client', 'amandates'),
|
|
Packit Service |
392537 |
"$Installcheck::TMP/TESTCONF/amandates",
|
|
Packit Service |
392537 |
"--execute-where client");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', '--execute-where=client', 'amandates'),
|
|
Packit Service |
392537 |
"$Installcheck::TMP/TESTCONF/amandates",
|
|
Packit Service |
392537 |
"--execute-where=client");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', '--client', 'amandates'),
|
|
Packit Service |
392537 |
"$Installcheck::TMP/TESTCONF/amandates",
|
|
Packit Service |
392537 |
"--client");
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', '--execute-where', 'server', 'reserve'), "100",
|
|
Packit Service |
392537 |
"--execute-where server");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', '--execute-where=server', 'reserve'), "100",
|
|
Packit Service |
392537 |
"--execute-where=server");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', '--execute-where=server', '--execute-where=server', 'reserve'), "100",
|
|
Packit Service |
392537 |
"--execute-where=server --execute-where=server");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', '--execute-where=client', '--execute-where=client', 'amandates'),
|
|
Packit Service |
392537 |
"$Installcheck::TMP/TESTCONF/amandates",
|
|
Packit Service |
392537 |
"--execute-where=client --execute-where=client");
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
like(run_err('amgetconf', 'TESTCONF', '--execute-where=server', '--execute-where=client'),
|
|
Packit Service |
392537 |
qr/conflicts with/,
|
|
Packit Service |
392537 |
"handles conflict --execute-where=server --execute-where=client");
|
|
Packit Service |
392537 |
like(run_err('amgetconf', 'TESTCONF', '--execute-where=client', '--execute-where=server'),
|
|
Packit Service |
392537 |
qr/conflicts with/,
|
|
Packit Service |
392537 |
"handles conflict --execute-where=client --execute-where=server");
|
|
Packit Service |
392537 |
like(run_err('amgetconf', 'TESTCONF', '--execute-where=server', '--client'),
|
|
Packit Service |
392537 |
qr/conflicts with/,
|
|
Packit Service |
392537 |
"handles conflict --execute-where=server --client");
|
|
Packit Service |
392537 |
like(run_err('amgetconf', 'TESTCONF', '--client', '--execute-where=server'),
|
|
Packit Service |
392537 |
qr/conflicts with/,
|
|
Packit Service |
392537 |
"handles conflict --client --execute-where=server");
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', '-o', 'reserve=50', 'reserve'), "50",
|
|
Packit Service |
392537 |
"-o reserve=50");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', '-oreserve=50', 'reserve'), "50",
|
|
Packit Service |
392537 |
"-oreserve=50");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', '-o', 'reserve=50', 'TESTCONF', 'reserve'), "50",
|
|
Packit Service |
392537 |
"-oreserve=50 before config name");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', 'reserve', 'a', 'table', 'for', 'two', '-o', 'reserve=50'), "50",
|
|
Packit Service |
392537 |
"extra command-line arguments are ignored");
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
# test a nonexistent parameter
|
|
Packit Service |
392537 |
like(run_err('amgetconf', 'TESTCONF', "foos_per_bar"), qr/no such parameter/,
|
|
Packit Service |
392537 |
"handles nonexistent parameters as an error");
|
|
Packit Service |
392537 |
like(run_err('amgetconf', 'TESTCONF', "build.foos_per_bar"), qr/no such parameter/,
|
|
Packit Service |
392537 |
"handles nonexistent build parameters as an error");
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
# Test build parameters that we can determine easily. Testing all parameters
|
|
Packit Service |
392537 |
# would be more of a maintenance bother than a help.
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', "build.bindir"), $bindir,
|
|
Packit Service |
392537 |
"build.bindir is correct");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', "build.sbindir"), $sbindir,
|
|
Packit Service |
392537 |
"build.sbindir is correct");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', "build.libexecdir"), $libexecdir,
|
|
Packit Service |
392537 |
"build.libexecdir is correct");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', "build.amlibexecdir"), $amlibexecdir,
|
|
Packit Service |
392537 |
"build.amlibexecdir is correct");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', "build.mandir"), $mandir,
|
|
Packit Service |
392537 |
"build.mandir is correct");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', "build.AMANDA_DBGDIR"), $AMANDA_DBGDIR,
|
|
Packit Service |
392537 |
"build.AMANDA_DBGDIR is correct");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', "build.AMANDA_TMPDIR"), $AMANDA_TMPDIR,
|
|
Packit Service |
392537 |
"build.AMDNA_TMPDIR is correct");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', "build.CONFIG_DIR"), $CONFIG_DIR,
|
|
Packit Service |
392537 |
"build.CONFIG_DIR is correct");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', "build.__empty"), "",
|
|
Packit Service |
392537 |
"empty build variables handled correctly");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', "build.amdatadir"), $amdatadir,
|
|
Packit Service |
392537 |
"empty build variables handled correctly");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', "build.security_file"), $SECURITY_FILE,
|
|
Packit Service |
392537 |
"empty build variables handled correctly");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', "build.amandates_file"), $AMANDATES_FILE,
|
|
Packit Service |
392537 |
"empty build variables handled correctly");
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
like(run_err('amgetconf', 'TESTCONF', "build.bogus-param"), qr(no such parameter),
|
|
Packit Service |
392537 |
"bogus build parameters result in an error");
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', "build.config_dir"), $CONFIG_DIR,
|
|
Packit Service |
392537 |
"build parameters are case-insensitive");
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
is(run_get('amgetconf', "build.bindir"), $bindir, "build variables are available without a config");
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
# empty --list should return nothing
|
|
Packit Service |
392537 |
is_deeply([sort(+split(/\n/, run_get('amgetconf', 'TESTCONF', '--list', 'holdingdisk')))], [ ],
|
|
Packit Service |
392537 |
"--list returns an empty list when there's nothing to return");
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
# dbopen, dbclose
|
|
Packit Service |
392537 |
my $dbfile = run_get('amgetconf', 'TESTCONF', "dbopen.foo");
|
|
Packit Service |
392537 |
chomp $dbfile;
|
|
Packit Service |
392537 |
like($dbfile, qr(^\Q$AMANDA_DBGDIR\E/server/foo.[0-9]*.debug$),
|
|
Packit Service |
392537 |
"'amgetconf dbopen.foo' returns a proper debug filename");
|
|
Packit Service |
392537 |
SKIP: {
|
|
Packit Service |
392537 |
skip "dbopen didn't work, so I'll skip the rest", 3
|
|
Packit Service |
392537 |
unless (-f $dbfile);
|
|
Packit Service |
392537 |
ok(!run('amgetconf', 'TESTCONF', "dbclose.foo"),
|
|
Packit Service |
392537 |
"dbclose without filename fails");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', "dbclose.foo:$dbfile"), $dbfile,
|
|
Packit Service |
392537 |
"'amgetconf dbclose.foo:<filename>' returns the debug filename");
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
# sometimes shell scripts pass a full path as appname..
|
|
Packit Service |
392537 |
$dbfile = run_get('amgetconf', 'TESTCONF', 'dbopen./sbin/foo');
|
|
Packit Service |
392537 |
like($dbfile, qr(^\Q$AMANDA_DBGDIR\E/server/_sbin_foo.[0-9]*.debug$),
|
|
Packit Service |
392537 |
"'amgetconf dbopen./sbin/foo' doesn't get confused by the slashes");
|
|
Packit Service |
392537 |
}
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
##
|
|
Packit Service |
392537 |
# Test an invalid config file
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
$testconf = Installcheck::Config->new();
|
|
Packit Service |
392537 |
$testconf->add_param("foos_per_bar", "10");
|
|
Packit Service |
392537 |
$testconf->write();
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
like(run_err('amgetconf', 'TESTCONF', "foos_per_bar"), qr/errors processing config file/,
|
|
Packit Service |
392537 |
"gives error on invalid configuration");
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
##
|
|
Packit Service |
392537 |
# Now let's fill in some interesting values
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
$testconf = Installcheck::Config->new();
|
|
Packit Service |
392537 |
$testconf->add_param("reserved-udp-port", '100,200');
|
|
Packit Service |
392537 |
$testconf->add_param("printer", '"/dev/lp"');
|
|
Packit Service |
392537 |
$testconf->add_param("reserve", '27');
|
|
Packit Service |
392537 |
$testconf->write();
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', "reserved-udp-port"), "100,200",
|
|
Packit Service |
392537 |
"correctly returns intrange parameters from the file");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', "printer"), "/dev/lp",
|
|
Packit Service |
392537 |
"correctly returns string parameters from the file");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', "reserve"), "27",
|
|
Packit Service |
392537 |
"correctly returns integer parameters from the file");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', "rEsErVe"), "27",
|
|
Packit Service |
392537 |
"is case-insensitive");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', "reserved_udp_port"), "100,200",
|
|
Packit Service |
392537 |
"treats _ and - identically");
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
# check runs without a config
|
|
Packit Service |
392537 |
my $olddir = getcwd();
|
|
Packit Service |
392537 |
chdir("$CONFIG_DIR/TESTCONF") or die("Could not 'cd' to TESTCONF directory");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', "printer"), "/dev/lp",
|
|
Packit Service |
392537 |
"uses current directory when no configuration name is given");
|
|
Packit Service |
392537 |
chdir($olddir) or die("Could not 'cd' back to my original directory");
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
##
|
|
Packit Service |
392537 |
# device_property can appear multiple times
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
$testconf = Installcheck::Config->new();
|
|
Packit Service |
392537 |
$testconf->add_param("device_property", '"power" "on"');
|
|
Packit Service |
392537 |
$testconf->add_param("device_property", '"turbo" "engaged"');
|
|
Packit Service |
392537 |
$testconf->write();
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
is_deeply([sort(+split(qr/\n/, run_get('amgetconf', 'TESTCONF', 'device_property')))],
|
|
Packit Service |
392537 |
[sort('visible "power" "on"', 'visible "turbo" "engaged"')],
|
|
Packit Service |
392537 |
"device_property can have multiple values");
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
##
|
|
Packit Service |
392537 |
# Subsections
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
$testconf = Installcheck::Config->new();
|
|
Packit Service |
392537 |
$testconf->add_tapetype("cassette", [ length => "32 k" ]);
|
|
Packit Service |
392537 |
$testconf->add_tapetype("reel2reel", [ length => "1 M" ]);
|
|
Packit Service |
392537 |
$testconf->add_tapetype("scotch", [ length => "512000 bytes" ]);
|
|
Packit Service |
392537 |
$testconf->add_dumptype("testdump", [ comment => '"testdump-dumptype"',
|
|
Packit Service |
392537 |
auth => '"bsd"' ]);
|
|
Packit Service |
392537 |
$testconf->add_dumptype("testdump1", [ inherit => 'testdump' ]);
|
|
Packit Service |
392537 |
$testconf->add_interface("testiface", [ use => '10' ]);
|
|
Packit Service |
392537 |
$testconf->add_holdingdisk("hd17", [ chunksize => '128' ]);
|
|
Packit Service |
392537 |
$testconf->add_application('app_amgtar', [ plugin => '"amgtar"' ]);
|
|
Packit Service |
392537 |
$testconf->add_application('app_amstar', [ plugin => '"amstar"' ]);
|
|
Packit Service |
392537 |
$testconf->add_script('my_script', [ "execute-on" => 'pre-dle-amcheck', 'plugin' => '"foo"' ]);
|
|
Packit Service |
392537 |
$testconf->add_device('my_device', [ "tapedev" => '"foo:/bar"' ]);
|
|
Packit Service |
392537 |
$testconf->write();
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
is_deeply([sort(+split(/\n/, run_get('amgetconf', 'TESTCONF', '--list', 'tapetype')))],
|
|
Packit Service |
392537 |
[sort("cassette", "reel2reel", "scotch", "TEST-TAPE")],
|
|
Packit Service |
392537 |
"--list returns correct set of tapetypes");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', 'tapetype:scotch:length'), '500',
|
|
Packit Service |
392537 |
"returns tapetype parameter correctly");
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
ok(scalar(grep { $_ eq 'testdump' }
|
|
Packit Service |
392537 |
split(/\n/,
|
|
Packit Service |
392537 |
run_get('amgetconf', 'TESTCONF', '--list', 'dumptype'))),
|
|
Packit Service |
392537 |
"--list returns a test dumptype among the default dumptypes");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', 'dumptype:testdump:comment'), 'testdump-dumptype',
|
|
Packit Service |
392537 |
"returns dumptype parameter correctly");
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
is_deeply([sort(+split(/\n/, run_get('amgetconf', 'TESTCONF', '--list', 'interface')))],
|
|
Packit Service |
392537 |
[sort("testiface", "default")],
|
|
Packit Service |
392537 |
"--list returns correct set of interfaces");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', 'interface:testiface:use'), '10',
|
|
Packit Service |
392537 |
"returns interface parameter correctly");
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
is_deeply([sort(+split(/\n/, run_get('amgetconf', 'TESTCONF', '--list', 'holdingdisk')))],
|
|
Packit Service |
392537 |
[sort("hd17")],
|
|
Packit Service |
392537 |
"--list returns correct set of holdingdisks");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', 'holdingdisk:hd17:chunksize'), '128',
|
|
Packit Service |
392537 |
"returns holdingdisk parameter correctly");
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
like(run_get('amgetconf', 'TESTCONF', '--list', 'build'), qr(.*version.*),
|
|
Packit Service |
392537 |
"'--list build' lists build variables");
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
is_deeply([sort(+split(/\n/, run_get('amgetconf', 'TESTCONF', '--list', 'application')))],
|
|
Packit Service |
392537 |
[sort("app_amgtar", "app_amstar")],
|
|
Packit Service |
392537 |
"--list returns correct set of applications");
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', 'application-tool:app_amgtar:plugin'), 'amgtar',
|
|
Packit Service |
392537 |
"returns application-tool parameter correctly");
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
is_deeply([sort(+split(/\n/, run_get('amgetconf', 'TESTCONF', '--list', 'script')))],
|
|
Packit Service |
392537 |
[sort("my_script")],
|
|
Packit Service |
392537 |
"--list returns correct set of scripts");
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
# test the old names
|
|
Packit Service |
392537 |
is_deeply([sort(+split(/\n/, run_get('amgetconf', 'TESTCONF', '--list', 'script-tool')))],
|
|
Packit Service |
392537 |
[sort("my_script")],
|
|
Packit Service |
392537 |
"--list returns correct set of scripts, using the name script-tool");
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
is_deeply([sort(+split(/\n/, run_get('amgetconf', 'TESTCONF', '--list', 'application-tool')))],
|
|
Packit Service |
392537 |
[sort("app_amgtar", "app_amstar")],
|
|
Packit Service |
392537 |
"--list returns correct set of applications, using the name 'application-tool'");
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', 'script-tool:my_script:execute-on'), 'PRE-DLE-AMCHECK',
|
|
Packit Service |
392537 |
"returns script-tool parameter correctly");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', 'script_tOOl:my_script:execute-on'), 'PRE-DLE-AMCHECK',
|
|
Packit Service |
392537 |
"insensitive to case in subsec_type");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', 'script-tool:my_script:execute-on'), 'PRE-DLE-AMCHECK',
|
|
Packit Service |
392537 |
"insensitive to -/_ in subsec_type");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', 'script_tOOl:my_script:eXECute-on'), 'PRE-DLE-AMCHECK',
|
|
Packit Service |
392537 |
"insensitive to case in subsec_key");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', 'script-tool:my_script:execute_on'), 'PRE-DLE-AMCHECK',
|
|
Packit Service |
392537 |
"insensitive to -/_ in subsec_key");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', 'dumptype:srvcompress:Auth', '-odumptype:srvcompress:auth=SSH'), 'SSH',
|
|
Packit Service |
392537 |
"inherited setting are overrided");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', 'dumptype:srvcompress:compress', '-odumptype:srvcompress:compress=SERVER BEST'), 'SERVER BEST',
|
|
Packit Service |
392537 |
"inherited default are overrided");
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
is_deeply([sort(split(/\n/, run_get('amgetconf', 'TESTCONF', '--list', 'device')))],
|
|
Packit Service |
392537 |
[sort("my_device")],
|
|
Packit Service |
392537 |
"--list returns correct set of devices");
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', 'device:my_device:tapedev'), 'foo:/bar',
|
|
Packit Service |
392537 |
"returns device parameter correctly");
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
# non-existent subsection types, names, and parameters
|
|
Packit Service |
392537 |
like(run_err('amgetconf', 'TESTCONF', 'NOSUCHTYPE:testiface:comment'), qr/no such parameter/,
|
|
Packit Service |
392537 |
"handles bad subsection type");
|
|
Packit Service |
392537 |
like(run_err('amgetconf', 'TESTCONF', 'dumptype:NOSUCHDUMP:comment'), qr/no such parameter/,
|
|
Packit Service |
392537 |
"handles bad dumptype namek");
|
|
Packit Service |
392537 |
like(run_err('amgetconf', 'TESTCONF', 'dumptype:testdump:NOSUCHPARAM'), qr/no such parameter/,
|
|
Packit Service |
392537 |
"handles bad dumptype parameter name");
|
|
Packit Service |
392537 |
like(run_err('amgetconf', 'TESTCONF', 'application-tool:app_amgtar:NOSUCHPARAM'), qr/no such parameter/,
|
|
Packit Service |
392537 |
"handles bad application-tool parameter name");
|
|
Packit Service |
392537 |
like(run_err('amgetconf', 'TESTCONF', 'script-tool:my-script:NOSUCHPARAM'), qr/no such parameter/,
|
|
Packit Service |
392537 |
"handles bad script-tool parameter name");
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
like(run_err('amgetconf', 'TESTCONF', '--list', 'frogs'), qr/no such parameter/,
|
|
Packit Service |
392537 |
"--list fails given an invalid subsection name");
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
##
|
|
Packit Service |
392537 |
# exclude lists are a bit funny, too
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
$testconf = Installcheck::Config->new();
|
|
Packit Service |
392537 |
$testconf->add_dumptype("testdump", [
|
|
Packit Service |
392537 |
"exclude file optional" => '"f1"', # this optional will have no effect
|
|
Packit Service |
392537 |
"exclude file append" => '"f2"',
|
|
Packit Service |
392537 |
"exclude list" => '"l1"',
|
|
Packit Service |
392537 |
"exclude list append" => '"l2"',
|
|
Packit Service |
392537 |
"include file" => '"ifo"',
|
|
Packit Service |
392537 |
"include list optional" => '"ilo"',
|
|
Packit Service |
392537 |
]);
|
|
Packit Service |
392537 |
$testconf->write();
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
is_deeply([sort(+split(qr/\n/, run_get('amgetconf', 'TESTCONF', 'dumptype:testdump:exclude')))],
|
|
Packit Service |
392537 |
[sort('FILE "f1" "f2"',
|
|
Packit Service |
392537 |
'LIST "l1" "l2"')],
|
|
Packit Service |
392537 |
"exclude files and lists displayed correctly; a non-final optional is ignored");
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
is_deeply([sort(+split(qr/\n/, run_get('amgetconf', 'TESTCONF', 'dumptype:testdump:include')))],
|
|
Packit Service |
392537 |
[sort('FILE OPTIONAL "ifo"',
|
|
Packit Service |
392537 |
'LIST OPTIONAL "ilo"')],
|
|
Packit Service |
392537 |
"a final 'OPTIONAL' makes the whole include/exclude optional");
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
$testconf = Installcheck::Config->new();
|
|
Packit Service |
392537 |
$testconf->add_param("property", '"prop1" "value1"');
|
|
Packit Service |
392537 |
$testconf->add_param("property", '"prop2" "value2"');
|
|
Packit Service |
392537 |
$testconf->add_param("property", '"prop3" "value3"');
|
|
Packit Service |
392537 |
$testconf->write();
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', "property:prop1"), "value1",
|
|
Packit Service |
392537 |
"correctly returns property prop1 from the file");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', "property:prop2"), "value2",
|
|
Packit Service |
392537 |
"correctly returns property prop2 from the file");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', "property:prop3"), "value3",
|
|
Packit Service |
392537 |
"correctly returns property prop3 from the file");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', "property"), "hidden \"prop1\" \"value1\"\nhidden \"prop2\" \"value2\"\nhidden \"prop3\" \"value3\"",
|
|
Packit Service |
392537 |
"correctly returns all propertiss from the file");
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
isnt(run_get('amgetconf', '--platform'), "Unknown",
|
|
Packit Service |
392537 |
"correctly returns then platform");
|
|
Packit Service |
392537 |
isnt(run_get('amgetconf', '--distro'), "Unknown",
|
|
Packit Service |
392537 |
"correctly returns then distro");
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
$testconf->add_storage("STO", [ 'tpchanger' => '"/dev/nst0"' ]);
|
|
Packit Service |
392537 |
$testconf->add_taperscan("SCAN", [ 'plugin' => '"lexical"' ]);
|
|
Packit Service |
392537 |
$testconf->write();
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', 'storage:STO:tpchanger', '-ostorage:STO:tpchanger=toto'), 'toto',
|
|
Packit Service |
392537 |
"correctly returns STO tpchanger 1");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', 'storage:STO:tpchanger', '-ostorage:STO:tpchanger=toto', '-ostorage=STO'), 'toto',
|
|
Packit Service |
392537 |
"correctly returns STO tpchanger 2");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', 'taperscan:SCAN:plugin', '-otaperscan:SCAN:plugin=foobar'), 'foobar',
|
|
Packit Service |
392537 |
"correctly returns SCAN plugin 1");
|
|
Packit Service |
392537 |
is(run_get('amgetconf', 'TESTCONF', 'taperscan:SCAN:plugin', '-otaperscan:SCAN:plugin=foobar', '-otaperscan=SCAN'), 'foobar',
|
|
Packit Service |
392537 |
"correctly returns SCAN plugin 2");
|