MT#16429 Switch system-tests to goss

Change-Id: Ib5d87ac6d3de8e6a43d89423d22b8dcd6fd24871
(cherry picked from commit ddd3277692)
changes/47/4247/1
Alexander Lutay 10 years ago
parent b8319d7f3d
commit 844b2d5abc

@ -0,0 +1,37 @@
{
"command": {
"hostname": {
"exit-status": "0",
"stdout": [
"spce"
],
"stderr": []
},
"hostname --fqdn": {
"exit-status": "0",
"stdout": [
"spce."
],
"stderr": []
},
"hostname --short": {
"exit-status": "0",
"stdout": [
"spce"
],
"stderr": []
},
"[ $(hostname --short). = $(hostname --fqdn) ]": {
"comment": "short hostname should be the same as fqdn (ignoring trailing dot)",
"exit-status": "0",
"stdout": [],
"stderr": []
},
"[ $(resolveip -s $(hostname --fqdn)) = $(resolveip -s $(hostname --short)) ]": {
"comment": "ip-s of short hostname and fqdn should be the same",
"exit-status": "0",
"stdout": [],
"stderr": []
}
}
}

@ -1,76 +0,0 @@
#!/usr/bin/perl
=head1 NAME
hostname-and-interfaces - check hostname and ip resolution on interfaces
=head2 SYNOPSIS
NONE
=head2 DESCRIPTION
Checks the hostname short name and fqdn. Cheks the ip adresses on the interfaces
if resolv to some hostname.
=cut
use strict;
use warnings;
use Test::More 'tests' => 3;
use Test::Differences;
use List::MoreUtils 'any';
use Sys::Net 'resolv', 'interfaces';
my $HOSTNAME_CMD = 'hostname';
exit main();
sub main {
my $hostname_short_ip;
my $hostname_fqdn_ip;
SKIP: {
my $hostname = `$HOSTNAME_CMD`;
skip 'hostname command not found', 2
if not defined $hostname;
my $hostname_short = `$HOSTNAME_CMD --short`;
$hostname_short =~ s/^\s*(.*)\s*$/$1/;
diag 'short hostname - ', $hostname_short
if $ENV{TEST_VERBOSE};
my $hostname_fqdn = `$HOSTNAME_CMD --fqdn`;
$hostname_fqdn =~ s/^\s*(.*)\s*$/$1/;
diag 'fqdn hostname - ', $hostname_fqdn
if $ENV{TEST_VERBOSE};
is($hostname_short . '.', $hostname_fqdn, 'short hostname should be the same as fqdn (ignoring trailing dot)');
# short hostname from fqdn
my ($short) = split /\./, $hostname_fqdn;
is($short, $hostname_short, 'check short hostname');
# resolv ip-s for short and fqdn hostname
$hostname_short_ip = resolv($hostname_short);
$hostname_fqdn_ip = resolv($hostname_fqdn);
is(
$hostname_short_ip,
$hostname_fqdn_ip,
'ip-s of short hostname and fqdn should be the same - '.$hostname_fqdn_ip,
);
}
return 0;
}
__END__
=head1 AUTHOR
Jozef Kutej
=cut

@ -0,0 +1,104 @@
{
"command": {
"pgrep -c -f '[l]ua5.1 /usr/bin/prosody'": {
"exit-status": "0",
"stdout": [
"1"
],
"stderr": []
},
"pgrep -c -f '[p]erl-fcgi-pm \\[NGCP::Panel\\]'": {
"exit-status": "0",
"stdout": [
"1"
],
"stderr": []
},
"pgrep -c -f '[p]erl-fcgi-pm \\[Sipwise::Provisioning\\]'": {
"exit-status": "0",
"stdout": [
"1"
],
"stderr": []
},
"pgrep -n -f '[k]amailio.*kamailio.proxy.pid'": {
"exit-status": "0",
"stdout": [
"/[0-9]+/"
],
"stderr": []
},
"pgrep -n -f '[k]amailio.*kamailio.lb.pid'": {
"exit-status": "0",
"stdout": [
"/[0-9]+/"
],
"stderr": []
}
},
"process": {
"acpid": {
"running": true
},
"asterisk": {
"running": true
},
"collectd": {
"running": true
},
"collectdmon": {
"running": true
},
"cron": {
"running": true
},
"exim4": {
"running": true
},
"getty": {
"running": true
},
"kamailio": {
"running": true
},
"mediator": {
"running": true
},
"mysqld": {
"running": true
},
"mysqld_safe": {
"running": true
},
"ngcp-sems": {
"running": true
},
"nginx": {
"running": true
},
"ntpd": {
"running": true
},
"perl-fcgi": {
"running": true
},
"rate-o-mat": {
"running": true
},
"redis-server": {
"running": true
},
"rsyslogd": {
"running": true
},
"rtpengine": {
"running": true
},
"sshd": {
"running": true
},
"udevd": {
"running": true
}
}
}

@ -1,91 +0,0 @@
#!/usr/bin/perl
=head1 NAME
running-processes - check running processes
=head2 SYNOPSIS
cat >> test-server.yaml << __YAML_END__
running-processes:
should-run:
- dhclient3
- /usr/sbin/sshd
- /usr/sbin/cron
__YAML_END__
=cut
use strict;
use warnings;
use Test::More;
use Test::Differences;
use List::MoreUtils 'any';
use Carp::Clan 'croak';
use FindBin '$Bin';
use YAML::Syck 'LoadFile';
eval "use Proc::ProcessTable";
plan 'skip_all' => "need Proc::ProcessTable to run processes tests" if $@;
my $file_config = $Bin.'/test-server.yaml';
if ($Bin =~ m{/.+(ce|pro)$}) {
my $cfg_tt2 = "/etc/ngcp-tests/test-server_$1.yaml";
if (-r $cfg_tt2) {
$file_config = $cfg_tt2;
}
}
my $config = LoadFile($file_config);
do {
fail("no configuration sections for 'running-processes'");
done_testing();
exit 1;
} if (not $config or not $config->{'running-processes'});
exit main();
sub main {
plan 'tests' => 1;
my $process_table = Proc::ProcessTable->new;
SKIP: {
skip 'no should-run section, not checking running processes', 1
if ref $config->{'running-processes'}->{'should-run'} ne 'ARRAY';
my @should_run = @{$config->{'running-processes'}->{'should-run'}};
eq_or_diff(
[ map { $process_table->is_running($_) ? $_ : undef } @should_run ],
[ @should_run ],
'check if all processes are running',
);
}
return 0;
}
sub Proc::ProcessTable::is_running {
my $self = shift;
my $process_string = shift;
croak 'pass process name'
if not defined $process_string;
return any { $_->cmndline =~ $process_string } @{$self->table};
}
__END__
=head1 NOTE
Process listing depends on L<Proc::ProcessTable>.
=head1 AUTHOR
Jozef Kutej
=cut

@ -0,0 +1,18 @@
{
"command": {
"df --output=pcent / | tail -1": {
"exit-status": "0",
"stdout": [
"/[0-9]%|[0-7][0-9]%/"
],
"stderr": []
},
"df --output=ipcent / | tail -1": {
"exit-status": "0",
"stdout": [
"/[0-9]%|[0-7][0-9]%/"
],
"stderr": []
}
}
}

@ -1,110 +0,0 @@
#!/usr/bin/perl
=head1 NAME
disk-free - check disk free space and free inodes
=head2 SYNOPSIS
cat >> test-server.yaml << __YAML_END__
disk-free:
/:
max-used: 95%
max-inodes: 90%
/var:
max-df: 1G
max-inodes: 64875
__YAML_END__
=cut
use strict;
use warnings;
use Test::More;
use Test::Differences;
use FindBin '$Bin';
use YAML::Syck 'LoadFile';
use Test::Server::Util qw(parse_size format_size);
eval "use Filesys::DiskSpace";
plan 'skip_all' => "need Filesys::DiskSpace to run disk free tests" if $@;
my $file_config = $Bin.'/test-server.yaml';
if ($Bin =~ m{/.+(ce|pro)$}) {
my $cfg_tt2 = "/etc/ngcp-tests/test-server_$1.yaml";
if (-r $cfg_tt2) {
$file_config = $cfg_tt2;
}
}
my $config = LoadFile($file_config);
# by default check root filesystem
$config->{'disk-free'} = { '/' => undef }
if not $config->{'disk-free'};
$config = $config->{'disk-free'};
exit main();
sub main {
plan 'tests' => scalar(keys %$config)*2;
foreach my $dir (keys %$config) {
my $max_used = $config->{$dir}->{'max-used'} || '95%';
my $max_inodes = $config->{$dir}->{'max-inodes'} || '90%';
my ($fs_type, $fs_desc, $used_space, $avail_space, $used_inodes, $avail_inodes)
= Filesys::DiskSpace::df($dir);
my $current_used;
my $diff_used;
# check used disk space
if ($max_used =~ m/^(.+)%\s*$/) {
$max_used = $1;
$current_used = int($used_space*100/($avail_space+$used_space));
$diff_used = ($current_used - $max_used).'%';
}
else {
$max_used = parse_size($max_used);
$current_used = $used_space * 1024;
$diff_used = format_size($current_used - $max_used);
}
cmp_ok($current_used, '<=', $max_used, 'check disk space on '.$dir)
or diag('difference is ', $diff_used);
# check used inodes
if ($max_inodes =~ m/^(.+)%\s*$/) {
$max_inodes = $1;
$current_used = int($used_inodes*100/($avail_inodes+$used_inodes));
$diff_used = ($current_used - $max_inodes).'%';
}
else {
$max_inodes = parse_size($max_inodes);
$current_used = $used_inodes;
$diff_used = $current_used - $max_inodes;
}
cmp_ok($current_used, '<=', $max_inodes, 'check inodes on '.$dir)
or diag('difference is ', $diff_used);
}
return 0;
}
__END__
=head1 NOTE
Disk Free checking depends on L<Filesys::DiskSpace>.
=head1 AUTHOR
Jozef Kutej
=cut

@ -0,0 +1,52 @@
{
"file": {
"/etc/apt/sources.list.d/sipwise.list": {
"exists": true,
"mode": "0644",
"owner": "root",
"group": "root",
"filetype": "file",
"contains": []
},
"/etc/ngcp-config/config.yml": {
"exists": true,
"mode": "0644",
"owner": "root",
"group": "root",
"filetype": "file",
"contains": []
},
"/etc/ngcp-config/constants.yml": {
"exists": true,
"mode": "0644",
"owner": "root",
"group": "root",
"filetype": "file",
"contains": []
},
"/etc/ngcp-config/network.yml": {
"exists": true,
"mode": "0644",
"owner": "root",
"group": "root",
"filetype": "file",
"contains": []
},
"/etc/ngcp_version": {
"exists": true,
"mode": "0644",
"owner": "root",
"group": "root",
"filetype": "file",
"contains": []
},
"/etc/sipwise_ngcp_version": {
"exists": true,
"mode": "0644",
"owner": "root",
"group": "root",
"filetype": "file",
"contains": []
}
}
}

@ -1,31 +0,0 @@
#!/bin/bash
i=1
declare -a FILES=( "/etc/ngcp_version" \
"/etc/sipwise_ngcp_version" \
"/etc/apt/sources.list.d/sipwise.list" \
"/etc/ngcp-config/config.yml" \
"/etc/ngcp-config/constants.yml" \
"/etc/ngcp-config/network.yml" \
)
echo "1..$(( 2 *${#FILES[@]} ))"
for FILE in "${FILES[@]}" ; do
if [ -f ${FILE} ]; then
echo "ok $i - Found file: ${FILE}"
else
echo "not ok $i - File not found: ${FILE}"
fi
i=$(($i+1))
COUNT=$(stat -c%s ${FILE} 2>/dev/null || echo 0)
if [ "$COUNT" != "0" ]; then
echo "ok $i - File is not empty: ${FILE}"
else
echo "not ok $i - File is empty: ${FILE}"
fi
i=$(($i+1))
done

@ -0,0 +1,11 @@
{
"command": {
"ls -la /var/cores/core.*": {
"exit-status": "2",
"stdout": [],
"stderr": [
"ls: cannot access /var/cores/core.*: No such file or directory"
]
}
}
}

@ -1,18 +0,0 @@
#!/bin/bash
SYSCTL="/sbin/sysctl"
CORE_DIR=$(dirname $(${SYSCTL} kernel.core_pattern | awk '{print $3}'| sed -e "s_'__g"))
CORE_FILES=$(ls -m -w 100000 ${CORE_DIR})
NUM_FILES=$(ls -1 ${CORE_DIR}|wc -l)
echo "1..1"
if [ -d ${CORE_DIR} ]; then
if [[ $NUM_FILES > 0 ]]; then
# echo "not ok 1 - ${CORE_DIR} not empty: ${CORE_FILES}"
echo "ok 1 - ${CORE_DIR} not empty: ${CORE_FILES}"
else
echo "ok 1 - ${CORE_DIR} empty"
fi
else
echo "ok 1 - no ${CORE_DIR}"
fi

@ -0,0 +1,23 @@
[% PROCESS '/usr/lib/ngcp-ngcpcfg/get_hostname';
hostname = out
-%]
[% argv.host=hostname; argv.type='web_ext';
PROCESS '/usr/lib/ngcp-ngcpcfg/get_all_ips_for_host';
web_ext_ips = out;
-%]
[% argv.host=hostname; argv.type='web_int';
PROCESS '/usr/lib/ngcp-ngcpcfg/get_all_ips_for_host';
web_int_ips = out;
-%]
{
"port": {
"tcp:443": {
"listening": true,
"ip": "[% web_ext_ips.0 -%]"
},
"tcp:1443": {
"listening": true,
"ip": "[% web_int_ips.0 -%]"
}
}
}

@ -0,0 +1,9 @@
{
"command": {
"find /etc/ngcp-config/templates/ -type f ! \\( -name *.dpkg-dist -o -name *.dpkg-old -o -name *.dpkg-new -o -name *.dpkg-remove -o -name *.dpkg-bak -o -name *.dpkg-del \\) -print0 |xargs -0 dpkg -S \u003e/dev/null": {
"exit-status": "0",
"stdout": [],
"stderr": []
}
}
}

@ -1,19 +0,0 @@
#!/bin/bash
i=1
tmpfile=$(mktemp)
find /etc/ngcp-config/templates/ -type f ! \( -name "*.dpkg-dist" -o -name "*.dpkg-old" -o -name "*.dpkg-new" -o -name "*.dpkg-remove" -o -name "*.dpkg-bak" -o -name "*.dpkg-del" \) -print0 |xargs -0 dpkg -S >/dev/null 2>"$tmpfile"
if ! [ -s "$tmpfile" ] ; then
echo "1..1"
echo "ok 1 - no unpackaged files in /etc/ngcp-config/templates/"
else
echo "1..$(wc -l < "${tmpfile}")"
while read line ; do
echo "not ok $i - $line"
i=$(( i+1 ))
done < "${tmpfile}"
fi
rm -f "$tmpfile"

@ -0,0 +1,139 @@
{
"group": {
"cdrexport": {
"exists": true,
"gid": "10001"
},
"daemon": {
"exists": true,
"gid": "1"
},
"kamailio": {
"exists": true
},
"mysql": {
"exists": true
},
"ntp": {
"exists": true
},
"prosody": {
"exists": true
},
"redis": {
"exists": true
},
"root": {
"exists": true,
"gid": "0"
},
"sems": {
"exists": true
},
"sipwise": {
"exists": true,
"gid": "10000"
},
"ssh": {
"exists": true
},
"ssl-cert": {
"exists": true
},
"sudo": {
"exists": true
},
"www-data": {
"exists": true
}
},
"user": {
"": {
"exists": false
},
"cdrexport": {
"exists": true,
"uid": "10001",
"gid": "10001",
"groups": [
"cdrexport"
],
"home": "/home/jail/home/cdrexport"
},
"kamailio": {
"exists": true,
"groups": [
"kamailio",
"ssl-cert"
],
"home": "/var/run/kamailio"
},
"mysql": {
"exists": true,
"groups": [
"mysql"
],
"home": "/nonexistent"
},
"nobody": {
"exists": true,
"groups": [
"nogroup"
],
"home": "/nonexistent"
},
"prosody": {
"exists": true,
"groups": [
"prosody",
"ssl-cert"
],
"home": "/var/lib/prosody"
},
"proxy": {
"exists": true,
"groups": [
"proxy"
],
"home": "/bin"
},
"redis": {
"exists": true,
"groups": [
"redis"
],
"home": "/var/lib/redis"
},
"sems": {
"exists": true,
"groups": [
"sems"
],
"home": "/var/run/ngcp-sems"
},
"sipwise": {
"exists": true,
"uid": "10000",
"gid": "10000",
"groups": [
"sipwise"
],
"home": "/var/sipwise"
},
"sshd": {
"exists": true,
"groups": [
"nogroup"
],
"home": "/var/run/sshd"
},
"www-data": {
"exists": true,
"groups": [
"ssl-cert",
"www-data"
],
"home": "/var/www"
}
}
}

@ -0,0 +1,13 @@
{
"package": {
"ngcp-ngcp-ce": {
"installed": true
},
"ngcp-ngcp-pro": {
"installed": false
},
"ngcp-ngcp-carrier": {
"installed": false
}
}
}

@ -0,0 +1,88 @@
{
"service": {
"acpid": {
"enabled": true,
"running": true
},
"asterisk": {
"enabled": true,
"running": true
},
"collectd": {
"enabled": true,
"running": true
},
"cron": {
"enabled": true,
"running": true
},
"exim4": {
"enabled": true,
"running": true
},
"io-scheduler": {
"enabled": true,
"running": true
},
"kamailio-lb": {
"enabled": true,
"running": true
},
"kamailio-proxy": {
"enabled": true,
"running": true
},
"mediator": {
"enabled": true,
"running": true
},
"motd": {
"enabled": true,
"running": true
},
"mysql": {
"enabled": true,
"running": true
},
"ngcp-ossbss": {
"enabled": true,
"running": true
},
"ngcp-rate-o-mat": {
"enabled": true,
"running": true
},
"ngcp-rtpengine-daemon": {
"enabled": true,
"running": true
},
"ngcp-sems": {
"enabled": true,
"running": true
},
"nginx": {
"enabled": true,
"running": true
},
"ntp": {
"enabled": true,
"running": true
},
"prosody": {
"enabled": true,
"running": true
},
"redis-server": {
"enabled": true,
"running": true
},
"rsyslog": {
"enabled": true,
"running": true
},
"ssh": {
"enabled": true,
"running": true
}
}
}

@ -0,0 +1,17 @@
{
"port": {
"tcp:1443": {
"listening": true
},
"tcp:22": {
"listening": true
},
"tcp:443": {
"listening": true
},
"tcp6:80": {
"comment": "why Ipv4 is not here?",
"listening": true
}
}
}

@ -0,0 +1,18 @@
{
"dns": {
"localhost": {
"resolveable": true,
"addrs": [
"127.0.0.1"
],
"timeout": 500
},
"spce": {
"resolveable": true,
"addrs": [
"127.0.0.2"
],
"timeout": 500
}
}
}

@ -0,0 +1,14 @@
{
"command": {
"false": {
"exit-status": "1",
"stdout": [],
"stderr": []
},
"true": {
"exit-status": "0",
"stdout": [],
"stderr": []
}
}
}

@ -0,0 +1,17 @@
{
"gossfile": {
"01_running-processes.json": {},
"01_hostname-and-interfaces.json": {},
"02_disk-free.json": {},
"03_files_availability.json": {},
"03_no-cores.json": {},
"03_open_ports.json": {},
"04_template_files.json": {},
"05_system_users.json": {},
"06_system_packages.json": {},
"07_system_service.json": {},
"08_system_ports.json": {},
"09_system_dns.json": {},
"99_dummy.json": {}
}
}

7
debian/control vendored

@ -8,12 +8,9 @@ Homepage: http://sipwise.com/
Package: ngcp-system-tests
Architecture: all
Depends: libfilesys-diskspace-perl,
libproc-processtable-perl,
libtest-server-perl,
libtest-www-mechanize-perl,
Depends: curl,
net-tools,
perl-modules,
procps,
${misc:Depends},
${perl:Depends}
Description: run system tests against NGCP systems

@ -1,4 +1,3 @@
ce/* /usr/share/ngcp-tests/ce/
pro/* /usr/share/ngcp-tests/pro/
ce/* /etc/ngcp-config/templates/etc/ngcp-tests/ce/
pro/* /etc/ngcp-config/templates/etc/ngcp-tests/pro/
testrunner /usr/share/ngcp-tests/
etc/* /etc/ngcp-config/templates/etc/ngcp-tests/

@ -1,69 +0,0 @@
[% PROCESS '/usr/lib/ngcp-ngcpcfg/get_hostname'; hostname = out -%]
[% argv.host=hostname; argv.role='proxy';
PROCESS '/usr/lib/ngcp-ngcpcfg/has_role';
is_proxy = out
-%]
[% argv.host=hostname; argv.role='lb';
PROCESS '/usr/lib/ngcp-ngcpcfg/has_role';
is_lb = out
-%]
[% argv.host=hostname; argv.role='mgmt';
PROCESS '/usr/lib/ngcp-ngcpcfg/has_role';
is_mgmt = out
-%]
[% argv.host=hostname; argv.role='db';
PROCESS '/usr/lib/ngcp-ngcpcfg/has_role';
is_db = out
-%]
[% argv.host=hostname; argv.role='rtp';
PROCESS '/usr/lib/ngcp-ngcpcfg/has_role';
is_rtp = out
-%]
disk-free:
/:
max-used : 80%
max-inodes: 80%
running-processes:
should-run:
- getty
- udevd
- /usr/sbin/acpid
- /usr/sbin/collectdmon
- collectd -C /etc/collectd/collectd.conf -f
- /usr/sbin/cron
- /usr/sbin/exim4
- /usr/sbin/mysqld
- /bin/sh /usr/bin/mysqld_safe
- /usr/sbin/ntpd
- /usr/sbin/rsyslogd
- /usr/sbin/sshd
[% IF is_rtp || is_proxy || is_db -%]
- /usr/bin/redis-server
[% END -%]
[% IF is_mgmt -%]
[% IF ossbss.frontend == 'apache' -%]
- /usr/sbin/apache2
- /usr/bin/logger -p daemon.info -t oss
[% ELSIF ossbss.frontend == 'fcgi' -%]
- "perl-fcgi-pm \[Sipwise::Provisioning\]"
[% END -%]
- /usr/sbin/nginx
- "perl-fcgi-pm \[NGCP::Panel\]"
[% END -%]
[% IF is_proxy -%]
- /usr/sbin/asterisk -n
- /usr/sbin/kamailio -f /etc/kamailio/proxy/kamailio.cfg -P /var/run/kamailio/kamailio.proxy.pid
- /usr/sbin/ngcp-sems
- lua5.1 /usr/bin/prosody
- /usr/bin/mediator
[% IF rateomat.enable == "yes" -%]
- rate-o-mat
[% END -%]
[% END -%]
[% IF is_lb -%]
- /usr/sbin/kamailio -f /etc/kamailio/lb/kamailio.cfg -P /var/run/kamailio/kamailio.lb.pid
[% END -%]
[% IF is_rtp -%]
- /usr/sbin/rtpengine
[% END -%]

@ -1,199 +0,0 @@
[% PROCESS '/usr/lib/ngcp-ngcpcfg/get_hostname'; hostname = out -%]
[% argv.host=hostname; argv.role='proxy';
PROCESS '/usr/lib/ngcp-ngcpcfg/has_role';
is_proxy = out
-%]
[% argv.host=hostname; argv.role='lb';
PROCESS '/usr/lib/ngcp-ngcpcfg/has_role';
is_lb = out
-%]
[% argv.host=hostname; argv.role='mgmt';
PROCESS '/usr/lib/ngcp-ngcpcfg/has_role';
is_mgmt = out
-%]
[% argv.host=hostname; argv.role='db';
PROCESS '/usr/lib/ngcp-ngcpcfg/has_role';
is_db = out
-%]
[% argv.host=hostname; argv.role='rtp';
PROCESS '/usr/lib/ngcp-ngcpcfg/has_role';
is_rtp = out
-%]
[% argv.host=hostname; argv.type='sip_ext';
PROCESS '/usr/lib/ngcp-ngcpcfg/get_all_shared_ips_for_host';
sip_ext_ips = out
-%]
[% IF !sip_ext_ips.size -%]
[% argv.host=hostname; argv.type='sip_ext';
PROCESS '/usr/lib/ngcp-ngcpcfg/get_all_ips_for_host';
sip_ext_ips = out;
-%]
[% END -%]
disk-free:
/:
max-used : 80%
max-inodes: 80%
running-processes:
should-run:
- getty
- udevd
- /usr/sbin/acpid
- /usr/sbin/collectdmon
- collectd -C /etc/collectd/collectd.conf -f
- /usr/sbin/cron
- /usr/sbin/exim4
- /usr/sbin/mysqld
- /bin/sh /usr/bin/mysqld_safe
- /usr/sbin/ntpd
- /usr/sbin/rsyslogd
- /usr/sbin/sshd
- "heartbeat: master control process"
- "heartbeat: read: ping"
- "heartbeat: write: ping"
- "heartbeat: FIFO reader"
- "ha_logd: write process"
- "ha_logd: read process"
- /usr/sbin/hb_watchdog
- /usr/bin/monit
[% IF (is_proxy || is_lb) && voisniff.daemon.start == 'yes' -%]
- /usr/bin/voisniff-ng
[% END -%]
- /usr/lib64/heartbeat/ipfail
- /usr/sbin/glusterd
- /usr/sbin/glusterfs
- /usr/sbin/glusterfsd
- /usr/sbin/haveged -w 1024
- /usr/sbin/snmpd
[% IF is_rtp || is_proxy || is_db -%]
- /usr/bin/redis-server
[% END -%]
[% IF is_mgmt -%]
[% IF ossbss.frontend == 'apache' -%]
- /usr/sbin/apache2
- /usr/bin/logger -p daemon.info -t oss
[% ELSIF ossbss.frontend == 'fcgi' -%]
- "perl-fcgi-pm \[Sipwise::Provisioning\]"
[% END -%]
- /usr/sbin/nginx
- "perl-fcgi-pm \[NGCP::Panel\]"
[% END -%]
[% IF is_proxy -%]
- /usr/sbin/asterisk -n
- /usr/sbin/kamailio -f /etc/kamailio/proxy/kamailio.cfg -P /var/run/kamailio/kamailio.proxy.pid
- /usr/sbin/ngcp-sems
- lua5.1 /usr/bin/prosody
- /usr/bin/mediator
[% IF rateomat.enable == "yes" -%]
- rate-o-mat
[% END -%]
[% END -%]
[% IF is_lb -%]
- /usr/sbin/kamailio -f /etc/kamailio/lb/kamailio.cfg -P /var/run/kamailio/kamailio.lb.pid
[% END -%]
[% IF is_rtp -%]
- /usr/sbin/rtpengine
[% END -%]
open-ports:
connect:
localhost:
# TCP ports list
22: ssh
25: exim4
[% IF is_mgmt -%]
80: http
443: https$
1443: https
[% IF pbx.enable == 'yes' -%]
1444: https
1445: http
[% END -%]
[% IF ossbss.frontend != 'no' -%]
2443: https
[% END -%]
[% END -%]
2812: monit
3306: mysqld
[% IF is_lb -%]
5060: kamailio
[% END -%]
[% IF is_proxy -%]
5062: kamailio
5280: prosody
5281: prosody
5582: prosody
8090: ngcp-sems
4569/udp: asterisk
5040/udp: ngcp-sems
5070/udp: asterisk
5080/udp: ngcp-sems
[% END -%]
7777: closed # test for closed TCP port check, nothing there
24009: glusterfsd
# UDP ports list
123/udp: ntpd
161/udp: snmpd
694/udp: heartbeat
[% IF is_rtp -%]
2223/udp: rtpengine
[% END -%]
7777/udp: closed # test for closed UDP port check, nothing there
25826/udp: collectd
192.168.255.251:
22: ssh
3306: mysql
[% IF is_rtp || is_proxy || is_db -%]
6379: redis-server
[% END -%]
192.168.255.252:
22: ssh
3306: mysql
[% IF is_rtp || is_proxy || is_db -%]
6379: redis-server
[% END -%]
[% IF is_proxy -%]
[% sip_ext_ips.0 -%]:
5222: prosody
5269: prosody
[% END -%]
deb.sipwise.com:
80: http
debian.sipwise.com:
80: http
sites-ok:
[% IF is_mgmt -%]
sites:
http://localhost:8081/nginx_status:
content: "Active connections"
[% IF ossbss.frontend == 'apache' -%]
https://localhost:2443/SOAP/Provisioning.wsdl:
content: "xmlns:tns=\"http://dev.sipwise.com/SOAP/Provisioning\""
[% ELSIF ossbss.frontend == 'fcgi' -%]
https://ngcpsoap:s04pt3st@localhost:2443/SOAP/Provisioning.wsdl:
content: "xmlns:tns=\"http://dev.sipwise.com/SOAP/Provisioning\""
[% END -%]
# ngcp http
http://localhost/:
content: "Subscriber Sign In"
http://localhost:1443/login/subscriber:
content: "Subscriber Sign In"
http://localhost:1443/:
content: "Admin Sign In"
http://localhost/login/admin:
content: "Admin Sign In"
# the same tests as above through httpS
http://localhost/:
content: "Subscriber Sign In"
http://localhost:1443/login/subscriber:
content: "Subscriber Sign In"
http://localhost:1443/:
content: "Admin Sign In"
http://localhost/login/admin:
content: "Admin Sign In"
[% ELSE -%]
sites:
[% END -%]

@ -0,0 +1,37 @@
{
"command": {
"hostname": {
"exit-status": "0",
"stdout": [
"/sp[1,2]/"
],
"stderr": []
},
"hostname --fqdn": {
"exit-status": "0",
"stdout": [
"/sp[1,2]/"
],
"stderr": []
},
"hostname --short": {
"exit-status": "0",
"stdout": [
"/sp[1,2]/"
],
"stderr": []
},
"[ $(hostname --short) = $(hostname --fqdn) ]": {
"comment": "short hostname should be the same as fqdn (ignoring trailing dot)",
"exit-status": "0",
"stdout": [],
"stderr": []
},
"[ $(resolveip -s $(hostname --fqdn)) = $(resolveip -s $(hostname --short)) ]": {
"comment": "ip-s of short hostname and fqdn should be the same",
"exit-status": "0",
"stdout": [],
"stderr": []
}
}
}

@ -1,118 +0,0 @@
#!/usr/bin/perl
=head1 NAME
hostname-and-interfaces - check hostname and ip resolution on interfaces
=head2 SYNOPSIS
NONE
=head2 DESCRIPTION
Checks the hostname short name and fqdn. Cheks the ip adresses on the interfaces
if resolv to some hostname.
=cut
use strict;
use warnings;
use Test::More 'tests' => 5;
use Test::Differences;
use List::MoreUtils 'any';
use Sys::Net 'resolv', 'interfaces';
my $HOSTNAME_CMD = 'hostname';
exit main();
sub main {
my $hostname_short_ip;
my $hostname_fqdn_ip;
SKIP: {
my $hostname = `$HOSTNAME_CMD`;
skip 'hostname command not found', 2
if not defined $hostname;
my $hostname_short = `$HOSTNAME_CMD --short`;
$hostname_short =~ s/^\s*(.*)\s*$/$1/;
diag 'short hostname - ', $hostname_short
if $ENV{TEST_VERBOSE};
my $hostname_fqdn = `$HOSTNAME_CMD --fqdn`;
$hostname_fqdn =~ s/^\s*(.*)\s*$/$1/;
diag 'fqdn hostname - ', $hostname_fqdn
if $ENV{TEST_VERBOSE};
is($hostname_short, $hostname_fqdn, 'short hostname should be the same as fqdn');
# short hostname from fqdn
my ($short) = split /\./, $hostname_fqdn;
is($short, $hostname_short, 'check short hostname');
# resolv ip-s for short and fqdn hostname
$hostname_short_ip = resolv($hostname_short);
$hostname_fqdn_ip = resolv($hostname_fqdn);
is(
$hostname_short_ip,
$hostname_fqdn_ip,
'ip-s of short hostname and fqdn should be the same - '.$hostname_fqdn_ip,
);
}
SKIP: {
skip 'fqdn not found', 2
if not defined $hostname_fqdn_ip;
# get interfaces
my %if_named = %{interfaces()};
skip 'no interfaces found', 2
if not keys %if_named;
ok(
(any { $_->{'ip'} eq $hostname_fqdn_ip } values %if_named ),
'there should be at leas one interface with hostname ip - '.$hostname_fqdn_ip,
);
# loop through all interfaces
foreach my $ifname (keys %if_named) {
my $iface = $if_named{$ifname};
# resolv interface ip to hostnames
$iface->{'hostname'} = resolv($iface->{'ip'});
diag 'if ', $ifname, ' ip ', $iface->{'ip'}, ' resolves to ', $iface->{'hostname'}
if $ENV{TEST_VERBOSE};
}
skip 'DNS resolve check as requested via env SKIP_DNS_CHECK_TEST=true', 1
if $ENV{SKIP_DNS_CHECK_TEST};
# check if every interface has a hostname set (different from the ip)
eq_or_diff(
[ map {
$_->{'hostname'}
&& ($_->{'hostname'} ne $_->{'ip'})
? $_->{'ip'}
: 'not resolving'
} values %if_named ],
[ map { $_->{'ip'} } values %if_named ],
'every interface ip should resolv to a name',
);
}
return 0;
}
__END__
=head1 AUTHOR
Jozef Kutej
=cut

@ -0,0 +1,134 @@
{
"command": {
"pgrep -c -f '[l]ua5.1 /usr/bin/prosody'": {
"exit-status": "0",
"stdout": [
"1"
],
"stderr": []
},
"pgrep -c -f '[p]erl-fcgi-pm \\[NGCP::Panel\\]'": {
"exit-status": "0",
"stdout": [
"1"
],
"stderr": []
},
"pgrep -c -f '[p]erl-fcgi-pm \\[Sipwise::Provisioning\\]'": {
"exit-status": "0",
"stdout": [
"1"
],
"stderr": []
},
"pgrep -n -f '[k]amailio.*kamailio.proxy.pid'": {
"exit-status": "0",
"stdout": [
"/[0-9]+/"
],
"stderr": []
},
"pgrep -n -f '[k]amailio.*kamailio.lb.pid'": {
"exit-status": "0",
"stdout": [
"/[0-9]+/"
],
"stderr": []
}
},
"process": {
"acpid": {
"running": true
},
"asterisk": {
"running": true
},
"collectd": {
"running": true
},
"collectdmon": {
"running": true
},
"cron": {
"running": true
},
"exim4": {
"running": true
},
"faxgetty": {
"running": true
},
"faxq": {
"running": true
},
"hfaxd": {
"running": true
},
"getty": {
"running": true
},
"glusterfs": {
"running": true
},
"hb_watchdog": {
"running": true
},
"heartbeat": {
"running": true
},
"kamailio": {
"running": true
},
"mediator": {
"running": true
},
"mysqld": {
"running": true
},
"mysqld_safe": {
"running": true
},
"monit": {
"running": true
},
"ngcp-iaxmodem": {
"running": true
},
"ngcp-sems": {
"running": true
},
"nginx": {
"running": true
},
"ntpd": {
"running": true
},
"perl-fcgi": {
"running": true
},
"rate-o-mat": {
"running": true
},
"redis-server": {
"running": true
},
"rsyslogd": {
"running": true
},
"rtpengine": {
"running": true
},
"sshd": {
"running": true
},
"snmpd": {
"running": true
},
"udevd": {
"running": true
},
"voisniff-ng": {
"running": true
}
}
}

@ -1 +0,0 @@
../ce/01_running-processes.t

@ -0,0 +1 @@
../ce/02_disk-free.json.tt2

@ -1 +0,0 @@
../ce/02_disk-free.t

@ -0,0 +1 @@
../ce/03_files_availability.json.tt2

@ -1 +0,0 @@
../ce/03_files_availability.sh

@ -0,0 +1 @@
../ce/03_no-cores.json.tt2

@ -1 +0,0 @@
../ce/03_no-cores.sh

@ -1,157 +0,0 @@
#!/usr/bin/perl
=head1 NAME
sites-ok.t - check web sites
=head SYNOPSIS
cat >> test-server.yaml << __YAML_END__
open-ports:
connect:
localhost:
22: ssh
bratislava.pm.org:
80: http
camel.cle.sk:
443: https
__YAML_END__
=cut
use strict;
use warnings;
use Test::More;
use Test::Differences;
use Test::Exception;
use Test::Net::Service;
use YAML::Syck 'LoadFile';
use FindBin '$Bin';
eval "use IO::Socket::INET";
plan 'skip_all' => "need IO::Socket::INET to run ports open tests" if $@;
my $file_config;
if ($Bin =~ m{/.+(ce|pro)$}) {
my $cfg_tt2 = "/etc/ngcp-tests/test-server_$1.yaml";
if (-r $cfg_tt2) {
$file_config = $cfg_tt2;
}
}
my $config = LoadFile($file_config);
do {
fail("no configuration sections for 'open-ports'");
done_testing();
exit 1;
} if (not $config or not $config->{'open-ports'});
my $netstat=`netstat -anu`;
exit main();
sub main {
my $connect = $config->{'open-ports'}->{'connect'};
# count the tests and plan them
my $number_of_tests = 0;
foreach my $host (keys %$connect) {
foreach my $port (keys %{$connect->{$host}}) {
# port connection test
$number_of_tests ++;
# service check for all besides closed ports
$number_of_tests ++
if not (($connect->{$host}->{$port} || '') eq 'closed');
}
}
plan 'tests' => $number_of_tests;
# loop through ports that needs to be working
foreach my $host (keys %$connect) {
my ($result)="";
my $net_service = Test::Net::Service->new(
'host' => $host
);
foreach my $port (keys %{$connect->{$host}}) {
my $service = $connect->{$host}->{$port} || '';
my $proto = 'tcp';
if ($port =~ /([0-9]+)\/(.*)/smg) {
$port = $1;
$proto = $2;
};
my $socket = IO::Socket::INET->new(
PeerAddr => $host,
PeerPort => $port,
Proto => $proto,
);
if ($proto eq "udp") {
($result)=$netstat=~/\w+\s+\d+\s+\d+\s+[\d.:]+:$port\s+[\d:.]+:\*/;
} else {
($result)=$socket;
};
# check for closed ports
if ($service eq 'closed') {
ok( !$result, "connect to $service on $host port $port/$proto ($service) is filtered" );
next;
}
ok( $result, "connect to $service on $host port $port/$proto ($service)" );
# skip rest if we failed to connect
if (not defined $result) {
SKIP: {
skip 'skipping service check if port open failed', 1;
}
next;
}
# skip rest if servis was not specified
if (not $result) {
SKIP: {
skip 'skipping service check no service defined', 1;
}
next;
}
# skip rest if there is no test_function for the service
if (not $net_service->can('test_'.$service)) {
SKIP: {
skip 'unknown service '.$service.'!!!', 1;
}
next;
}
# check the service
lives_ok(
sub {
$net_service->test(
'socket' => $socket,
'host' => $host,
'service' => $service
)
},
"check $service service default response with proto $proto port $port on host"
);
}
}
return 0;
}
__END__
=head1 NOTE
Port checking depends on L<IO::Socket::INET>.
=head1 AUTHOR
Jozef Kutej
=cut

@ -0,0 +1,207 @@
[% PROCESS '/usr/lib/ngcp-ngcpcfg/get_hostname'; hostname = out -%]
[% argv.host=hostname; argv.role='proxy';
PROCESS '/usr/lib/ngcp-ngcpcfg/has_role';
is_proxy = out
-%]
[% argv.host=hostname; argv.role='lb';
PROCESS '/usr/lib/ngcp-ngcpcfg/has_role';
is_lb = out
-%]
[% argv.host=hostname; argv.role='mgmt';
PROCESS '/usr/lib/ngcp-ngcpcfg/has_role';
is_mgmt = out
-%]
[% argv.host=hostname; argv.role='db';
PROCESS '/usr/lib/ngcp-ngcpcfg/has_role';
is_db = out
-%]
[% argv.host=hostname; argv.role='rtp';
PROCESS '/usr/lib/ngcp-ngcpcfg/has_role';
is_rtp = out
-%]
[% argv.host=hostname; argv.type='ha_int';
PROCESS '/usr/lib/ngcp-ngcpcfg/get_iface';
host_ha_iface = out
-%]
[% argv.host=hostname; argv.type='sip_ext';
PROCESS '/usr/lib/ngcp-ngcpcfg/get_all_shared_ips_for_host';
sip_ext_ips = out
-%]
[% IF !sip_ext_ips.size -%]
[% argv.host=hostname; argv.type='sip_ext';
PROCESS '/usr/lib/ngcp-ngcpcfg/get_all_ips_for_host';
sip_ext_ips = out;
-%]
[% END -%]
[% argv.host=hostname; argv.type='web_ext';
PROCESS '/usr/lib/ngcp-ngcpcfg/get_all_shared_ips_for_host';
web_ext_ips = out
-%]
[% IF !web_ext_ips.size -%]
[% argv.host=hostname; argv.type='web_ext';
PROCESS '/usr/lib/ngcp-ngcpcfg/get_all_ips_for_host';
web_ext_ips = out;
-%]
[% END -%]
[% argv.host=hostname; argv.type='web_int';
PROCESS '/usr/lib/ngcp-ngcpcfg/get_all_shared_ips_for_host';
web_int_ips = out
-%]
[% IF !web_int_ips.size -%]
[% argv.host=hostname; argv.type='web_int';
PROCESS '/usr/lib/ngcp-ngcpcfg/get_all_ips_for_host';
web_int_ips = out;
-%]
[% END -%]
{
"port": {
[% IF is_mgmt -%]
"tcp:443": {
"listening": true,
"ip": "127.0.0.1"
},
"tcp:443": {
"listening": true,
"ip": "[% web_ext_ips.0 -%]"
},
"tcp:1443": {
"listening": true,
"ip": "127.0.0.1"
},
"tcp:1443": {
"listening": true,
"ip": "[% web_int_ips.0 -%]"
},
[% END -%]
[% IF is_mgmt && pbx.enable == 'yes' -%]
"tcp:1444": {
"listening": true,
"ip": "[% web_ext_ips.0 -%]"
},
"tcp:1445": {
"listening": true,
"ip": "[% web_ext_ips.0 -%]"
},
[% END -%]
"tcp:22": {
"listening": true,
"ip": "0.0.0.0"
},
"tcp:22": {
"listening": true,
"ip": "[% hosts.$hostname.$host_ha_iface.ip %]"
},
"tcp:24009": {
"listening": true,
"ip": "0.0.0.0"
},
[% IF is_mgmt && ossbss.frontend != 'no' -%]
"tcp:2443": {
"listening": true,
"ip": "[% web_ext_ips.0 -%]"
},
[% END -%]
"tcp:25": {
"listening": true,
"ip": "127.0.0.1"
},
"tcp:2812": {
"listening": true,
"ip": "127.0.0.1"
},
"tcp:3306": {
"listening": true,
"ip": "0.0.0.0"
},
[% IF is_lb -%]
"tcp:5060": {
"listening": true,
"ip": "[% sip_ext_ips.0 -%]"
},
[% END -%]
[% IF is_proxy -%]
"tcp:5062": {
"listening": true,
"ip": "127.0.0.1"
},
"tcp:5222": {
"listening": true,
"ip": "[% sip_ext_ips.0 -%]"
},
"tcp:5269": {
"listening": true,
"ip": "[% sip_ext_ips.0 -%]"
},
"tcp:5280": {
"listening": true,
"ip": "127.0.0.1"
},
"tcp:5281": {
"listening": true,
"ip": "127.0.0.1"
},
"tcp:5582": {
"listening": true,
"ip": "127.0.0.1"
},
"tcp:8090": {
"listening": true,
"ip": "127.0.0.1"
},
"udp:4569": {
"listening": true,
"ip": "127.0.0.1"
},
"udp:5040": {
"listening": true,
"ip": "127.0.0.1"
},
"udp:5070": {
"listening": true,
"ip": "127.0.0.1"
},
"udp:5080": {
"listening": true,
"ip": "127.0.0.1"
},
[% END -%]
[% IF is_rtp || is_proxy || is_db -%]
"tcp:6379": {
"listening": true,
"ip": "[% hosts.$hostname.$host_ha_iface.ip %]"
},
[% END -%]
"tcp:7777": {
"listening": false
},
"udp:7777": {
"listening": false
},
"udp:123": {
"listening": true,
"ip": "0.0.0.0"
},
"udp:161": {
"listening": true,
"ip": "127.0.0.1"
},
[% IF is_rtp -%]
"udp:2223": {
"listening": true,
"ip": "127.0.0.1"
},
[% END -%]
"udp:25826": {
"listening": true,
"ip": "[% hosts.$hostname.$host_ha_iface.ip %]"
},
"udp:[% heartbeat.port ? heartbeat.port : '694' %]": {
"listening": true,
"ip": "0.0.0.0"
},
"tcp:22": {
"listening": true,
"comment": "last record to keep JSON valid"
}
}
}

@ -1,104 +0,0 @@
#!/usr/bin/perl
=head1 NAME
sites-ok.t - check web sites
=head SYNOPSIS
cat >> test-server.yaml << __YAML_END__
sites-ok:
sites:
http://ant.local:
content: It works!
http://debrepo.ant.local/debian/:
title : Index of /[a-z]+
content: Parent Directory
__YAML_END__
=cut
use strict;
use warnings;
use Test::More;
use Test::Differences;
use YAML::Syck 'LoadFile';
use FindBin '$Bin';
BEGIN { $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0 }
eval "use Test::WWW::Mechanize";
plan 'skip_all' => "need Test::WWW::Mechanize to run web tests" if $@;
my $file_config;
if ($Bin =~ m{/.+(ce|pro)$}) {
my $cfg_tt2 = "/etc/ngcp-tests/test-server_$1.yaml";
if (-r $cfg_tt2) {
$file_config = $cfg_tt2;
}
}
my $config = LoadFile($file_config);
do {
fail("no configuration sections for 'sites-ok'");
done_testing();
exit 1;
} if (not $config or not $config->{'sites-ok'});
exit main();
sub main {
plan 'no_plan';
my $mech = Test::WWW::Mechanize->new;
my $sites = $config->{'sites-ok'}->{'sites'};
# loop through sites that needs to be working
foreach my $base_url (keys %$sites) {
$mech->get_ok($base_url, 'fetch '.$base_url);
# test site title
my %site = %{$sites->{$base_url}};
# check title
like($mech->title, qr/$site{'title'}/, 'check title')
if exists $site{'title'};
#check content
like($mech->content, qr/$site{'content'}/, 'check content')
if exists $site{'content'};
# fetch site links
my $INTERNAL_LINKS_QR = qr{
^
(
$base_url # links starting with base url
|
(?![a-zA-Z]+:) # and NOT starting with http: or mailto: or ftp: or ...
)
}xms;
$mech->links_ok(
# match the links that starts with base url or are without http(s) in the beginning
[ $mech->find_all_links( url_regex => $INTERNAL_LINKS_QR ) ],
'check all internal page links',
);
}
return 0;
}
__END__
=head1 NOTE
Web checking depends on L<Test::WWW::Mechanize>.
=head1 AUTHOR
Jozef Kutej
=cut

@ -0,0 +1 @@
../ce/04_template_files.json.tt2

@ -1 +0,0 @@
../ce/04_template_files.sh

@ -0,0 +1 @@
../ce/05_system_users.json.tt2

@ -0,0 +1,13 @@
{
"package": {
"ngcp-ngcp-ce": {
"installed": false
},
"ngcp-ngcp-pro": {
"installed": true
},
"ngcp-ngcp-carrier": {
"installed": false
}
}
}

@ -0,0 +1,229 @@
[% PROCESS '/usr/lib/ngcp-ngcpcfg/get_hostname'; hostname = out -%]
[% argv.host=hostname; argv.role='proxy';
PROCESS '/usr/lib/ngcp-ngcpcfg/has_role';
is_proxy = out
-%]
[% argv.host=hostname; argv.role='lb';
PROCESS '/usr/lib/ngcp-ngcpcfg/has_role';
is_lb = out
-%]
[% argv.host=hostname; argv.role='mgmt';
PROCESS '/usr/lib/ngcp-ngcpcfg/has_role';
is_mgmt = out
-%]
[% argv.host=hostname; argv.role='db';
PROCESS '/usr/lib/ngcp-ngcpcfg/has_role';
is_db = out
-%]
[% argv.host=hostname; argv.role='rtp';
PROCESS '/usr/lib/ngcp-ngcpcfg/has_role';
is_rtp = out
-%]
[% PROCESS '/usr/lib/ngcp-ngcpcfg/get_ngcp_type'; ngcp_type = out -%]
{
"service": {
"acpid": {
"enabled": true,
"running": true
},
[% IF is_proxy && asterisk.enabled == "yes" -%]
"asterisk": {
"enabled": false,
"running": true
},
[% END -%]
[% IF (is_proxy || is_rtp) && intercept.enabled == "yes" -%]
"captagent": {
"enabled": false,
"running": true
},
[% END -%]
"collectd": {
"enabled": true,
"running": true
},
[% IF turnserver.enabled == 'yes' -%]
"coturn": {
"enabled": false,
"running": true
},
[% END -%]
"cron": {
"enabled": true,
"running": true
},
[% IF bootenv.dhcp.enable == 'yes' -%]
"dnsmasq": {
"enabled": false,
"running": true
},
[% END -%]
"exim4": {
"enabled": true,
"running": true
},
[% IF haproxy.enable == "yes" -%]
"haproxy": {
"enabled": false,
"running": true
},
[% END -%]
[% IF heartbeat.hb_watchdog.enable == 'yes' -%]
"hb_watchdog": {
"enabled": true,
"running": true
},
[% END -%]
"io-scheduler": {
"enabled": true,
"running": true
},
[% IF is_lb && kamailio.lb.start == "yes" -%]
"kamailio-lb": {
"enabled": false,
"running": true
},
[% ELSE -%]
"kamailio-lb": {
"enabled": false,
"running": false
},
[% END -%]
[% IF is_proxy && kamailio.proxy.start == "yes" -%]
"kamailio-proxy": {
"enabled": false,
"running": true
},
[% ELSE -%]
"kamailio-proxy": {
"enabled": false,
"running": false
},
[% END -%]
[% IF mediator.enabled == 'yes' -%]
"mediator": {
"enabled": false,
"running": true
},
[% END -%]
"motd": {
"enabled": true,
"running": true
},
"mysql": {
"enabled": true,
"running": true
},
[% IF is_mgmt && ossbss.frontend != 'no' -%]
"ngcp-ossbss": {
"enabled": true,
"running": true
},
[% END -%]
[% IF www_admin.enabled == 'yes' -%]
"ngcp-panel": {
"enabled": true,
"running": true
},
[% END -%]
[% IF rateomat.enable == "yes" -%]
"ngcp-rate-o-mat": {
"enabled": false,
"running": true
},
[% END -%]
[% IF rtpproxy.enabled == "yes" -%]
"ngcp-rtpengine-daemon": {
"enabled": false,
"running": true
},
[% END -%]
[% IF sems.enabled == "yes" -%]
"ngcp-sems": {
"enabled": false,
"running": true
},
[% END -%]
[% IF nginx.enabled == 'yes' -%]
"nginx": {
"enabled": true,
"running": true
},
[% END -%]
"ntp": {
"enabled": true,
"running": true
},
[% IF prosody.enabled == 'yes' -%]
"prosody": {
"enabled": false,
"running": true
},
[% END -%]
[% IF pushd.enable == "yes" -%]
"ngcp-pushd": {
"enabled": true,
"running": true
},
[% END -%]
[% IF faxserver.hylafax.start == "yes" -%]
"ngcp-hylafaxplus": {
"enabled": false,
"running": false,
"comment": "ngcp-hylafaxplus init script doesn't support 'status', skip as going to be removed"
},
[% END -%]
[% IF faxserver.type == 'software' && faxserver.iaxmodem.start == "yes" -%]
"ngcp-iaxmodem": {
"enabled": false,
"running": true
},
[% END -%]
[% IF redis.enabled == "yes" -%]
"redis-server": {
"enabled": true,
"running": true
},
[% END -%]
"rsyslog": {
"enabled": true,
"running": true
},
[% IF ldap.enabled == "yes" -%]
"slapd": {
"enabled": false,
"running": true
},
[% END -%]
[% IF pbx.enable == "yes" -%]
"sems-pbx": {
"enabled": false,
"running": true
},
[% END -%]
[% IF (is_proxy || is_lb || is_rtp) && voisniff.daemon.start == 'yes' -%]
"voisniff-ng": {
"enabled": true,
"running": false,
"comment": "voisniff-ng init script doesn't support 'status', see MT#17055"
},
[% END -%]
[% IF ngcp_type == 'carrier' -%]
"ngcpcfg-api": {
"enabled": false,
"running": true
},
[% END -%]
[% IF (is_db || is_mgmt) && ngcp_type == 'carrier' -%]
"elasticsearch": {
"enabled": true,
"running": true
},
[% END -%]
"ssh": {
"enabled": true,
"running": true
}
}
}

@ -0,0 +1 @@
../ce/08_system_ports.json.tt2

@ -0,0 +1,25 @@
{
"dns": {
"localhost": {
"resolveable": true,
"addrs": [
"127.0.0.1"
],
"timeout": 500
},
"sp1": {
"resolveable": true,
"addrs": [
"192.168.255.251"
],
"timeout": 500
},
"sp2": {
"resolveable": true,
"addrs": [
"192.168.255.252"
],
"timeout": 500
}
}
}

@ -0,0 +1 @@
../ce/99_dummy.json.tt2

@ -0,0 +1 @@
../ce/goss.json.tt2

@ -1,32 +1,44 @@
#!/bin/bash
set -e
REPORT_DIRECTORY='reports/'
usage() {
printf "Usage: %s <type CE/PRO>\n\n" "$0"
printf "Usage example: %s CE\n" "$0"
}
if [ $# -lt 1 ] ; then
echo "Usage: $0 </path/to/test/directory/>" >&2
echo
echo "Usage example: $0 /usr/share/ngcp-tests/ce/"
usage >&2
exit 1
fi
if ! [ -d "$1" ] ; then
echo "$1 is not a directory" >&2
exit 1
TYPE=$(echo "$1"| tr '[:upper:]' '[:lower:]')
case "${TYPE}" in
ce|pro) echo "Requested system tests for supported type '${TYPE}', continue..." ;;
*) echo "ERRRO: Unknown type '$1'" >&2 ; usage >&2 ; exit 1 ;;
esac
if [ ! -x /usr/sbin/goss ] ; then
echo "Downloading goss and installing as /usr/sbin/goss"
curl -L https://deb.sipwise.com/files/goss-0.0.16-linux-amd64 > /usr/sbin/goss
chmod +x /usr/sbin/goss
fi
echo "Rebuilding test configs in /etc/ngcp-test/"
ngcpcfg build /etc/ngcp-test/*
rm -rf "${REPORT_DIRECTORY}"
mkdir "${REPORT_DIRECTORY}"
for test in ${1}/*.t ; do
perl "$test" > "${REPORT_DIRECTORY}/$(basename ${test}).tap" 2>&1
done
for test in ${1}/*.sh ; do
$test > "${REPORT_DIRECTORY}/$(basename ${test}).tap" 2>&1
done
mkdir -p "${REPORT_DIRECTORY}"
TAP_RESULTS="${REPORT_DIRECTORY}/goss_${TYPE}_results.tap"
# TODO: add --format=tap when TAP formater will be supported
if goss -g "/etc/ngcp-tests/${TYPE}/goss.json" validate ; then
echo "1..1" > "${TAP_RESULTS}"
echo "ok 1 - no errors were found" >> "${TAP_RESULTS}"
else
echo "1..1" > "${TAP_RESULTS}"
echo "not ok 1 - found errors, run test manually" >> "${TAP_RESULTS}"
fi
tar acf reports.tar.gz "${REPORT_DIRECTORY}"
echo "Generated reports.tar.gz"

Loading…
Cancel
Save