Skip to content

Commit

Permalink
add build/tests support in docker
Browse files Browse the repository at this point in the history
  • Loading branch information
Build Automat authored and sni committed Feb 24, 2023
1 parent 0e4e1db commit 052fd0c
Show file tree
Hide file tree
Showing 14 changed files with 107 additions and 30 deletions.
1 change: 1 addition & 0 deletions distros/Makefile.DEBIAN_10
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ BUILD_PACKAGES += gawk
BUILD_PACKAGES += git-buildpackage
BUILD_PACKAGES += gperf
BUILD_PACKAGES += help2man # required by naemon
BUILD_PACKAGES += iputils-ping # required by monitoring-plugins
BUILD_PACKAGES += libboost-all-dev
BUILD_PACKAGES += libc6-dev
BUILD_PACKAGES += libcurl4-openssl-dev # needed by perl modules / thruk
Expand Down
1 change: 1 addition & 0 deletions distros/Makefile.DEBIAN_11
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ BUILD_PACKAGES += git-buildpackage
BUILD_PACKAGES += golang # required to bootstrap go
BUILD_PACKAGES += gperf
BUILD_PACKAGES += help2man # required by naemon
BUILD_PACKAGES += iputils-ping # required by monitoring-plugins
BUILD_PACKAGES += libboost-all-dev
BUILD_PACKAGES += libc6-dev
BUILD_PACKAGES += libcurl4-openssl-dev # needed by perl modules / thruk
Expand Down
7 changes: 2 additions & 5 deletions packages/apache-omd/WEB_ALIAS.hook
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,8 @@ RewriteRule ^/$OMD_SITE(.*) /$ALIAS\$1 [R=permanent,L,NE]
<IfModule mod_proxy_http.c>
<Location /$ALIAS>
# Setting "retry=0" to prevent 60 second caching of problem states e.g. when
# the site apache is down and someone tries to access the page.
# "disablereuse=On" prevents the apache from keeping the connection which leads to
# wrong devlivered pages sometimes
ProxyPass $PROTO://$CONFIG_APACHE_TCP_ADDR:$CONFIG_APACHE_TCP_PORT/$OMD_SITE retry=0 disablereuse=On
# do not add ProxyPass Options here, they will be ignored because of worker sharing anyway ([proxy:warn] AH01146: Ignoring parameter 'retry=0' for worker 'https://...' because of worker sharing)
ProxyPass $PROTO://$CONFIG_APACHE_TCP_ADDR:$CONFIG_APACHE_TCP_PORT/$OMD_SITE
ProxyPassReverse $PROTO://$CONFIG_APACHE_TCP_ADDR:$CONFIG_APACHE_TCP_PORT/$OMD_SITE
</Location>
</IfModule>
Expand Down
45 changes: 45 additions & 0 deletions packages/naemon-livestatus/patches/108-fix-thread-stack-size.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
From 84527bd6b7977c67f50c16c6bf22de0b8825a0ef Mon Sep 17 00:00:00 2001
From: Sven Nierlein <[email protected]>
Date: Thu, 23 Feb 2023 19:38:00 +0100
Subject: [PATCH] fix too low thread stacksize

thread stack size cannot be lower than PTHREAD_STACK_MIN. On some systems, ex.: debian 11 on aarch64, the lower limit is 1M. This results
in lots of `livestatus: Error: Cannot set thread stack size to 65536` entries in the logfile.
So lets check if the value is at least PTHREAD_STACK_MIN to avoid this error message.
---
src/module.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/module.c b/src/module.c
index b8801ed..bffd4c5 100644
--- a/src/module.c
+++ b/src/module.c
@@ -140,7 +140,7 @@ static int accept_connection(int sd, int events, void *discard)
if (g_debug_level >= 2 && 0 == pthread_attr_getstacksize(&attr, &defsize))
logger(LG_INFO, "Default stack size is %lu", defsize);
if (0 != pthread_attr_setstacksize(&attr, g_thread_stack_size))
- logger(LG_INFO, "Error: Cannot set thread stack size to %lu", g_thread_stack_size);
+ logger(LG_INFO, "Error: Cannot set thread stack size to %lu: %s", g_thread_stack_size, strerror(errno));
else {
if (g_debug_level >= 2)
logger(LG_INFO, "Setting thread stack size to %lu", g_thread_stack_size);
@@ -666,6 +666,10 @@ void livestatus_parse_arguments(const char *args_orig)
}
else if (!strcmp(left, "thread_stack_size")) {
g_thread_stack_size = strtoul(right, 0, 10);
+ if(g_thread_stack_size < PTHREAD_STACK_MIN) {
+ g_thread_stack_size = PTHREAD_STACK_MIN;
+ logger(LG_INFO, "thread stacks cannot be lower than %lu", PTHREAD_STACK_MIN);
+ }
logger(LG_INFO, "Setting size of thread stacks to %lu", g_thread_stack_size);
}
else if (!strcmp(left, "max_response_size")) {
@@ -787,6 +791,8 @@ int nebmodule_init(int flags __attribute__ ((__unused__)), char *args, void *han
g_should_terminate = false;
g_client_threads = NULL;
g_num_client_threads = 0;
+ if(g_thread_stack_size < PTHREAD_STACK_MIN)
+ g_thread_stack_size = PTHREAD_STACK_MIN;
initialize_logger();
livestatus_parse_arguments(args);
open_logfile();
2 changes: 1 addition & 1 deletion packages/omd/TMPFS.hook
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ case "$1" in
set)
# Unmount the tmpfs when it was mounted before
if [ "$2" == "off" ]; then
omd umount >&2
omd umount >/dev/null
fi
;;
esac
1 change: 1 addition & 0 deletions packages/omd/omd
Original file line number Diff line number Diff line change
Expand Up @@ -3085,6 +3085,7 @@ def finalize_site(what, apache_reload):
# user. We also could do this at 'omd start', but this might confuse
# users. They could create files below tmp which would be shadowed
# by the mount.
save_site_conf()
prepare_and_populate_tmpfs(g_sitename)

# Run all hooks in order to setup things according to the
Expand Down
19 changes: 11 additions & 8 deletions t/10-omd_testsite.t
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ plan( tests => 468 );

my $omd_bin = TestUtils::get_omd_bin();

my $is_docker = TestUtils::is_docker();
my $createoptions = $is_docker ? " --no-tmpfs " : "";

# print omd version
my $vtest = { cmd => $omd_bin." version", "exit" => undef };
TestUtils::test_command($vtest) or TestUtils::bail_out_clean("no further testing without working omd");
Expand Down Expand Up @@ -66,7 +69,7 @@ my $tests = [
{ cmd => $omd_bin." rm $site", stdin => "yes\n", 'exit' => undef, errlike => undef },
{ cmd => $omd_bin." rm $site2", stdin => "yes\n", 'exit' => undef, errlike => undef },
{ cmd => $omd_bin." rm $site2", stdin => "yes\n", 'exit' => undef, errlike => undef },
{ cmd => $omd_bin." create $site", like => '/Created new site '.$site.'./' },
{ cmd => $omd_bin." create $createoptions $site", like => '/Created new site '.$site.'./' },
{ cmd => "/bin/su - $site -c 'omd reset etc/htpasswd'", like => '/^$/' },
{ cmd => "/bin/su - $site -c 'test -h etc/nagios/conf.d'", like => '/^$/' },
{ cmd => "/bin/su - $site -c 'test -d etc/naemon/conf.d'", like => '/^$/' },
Expand All @@ -80,7 +83,7 @@ my $tests = [
{ cmd => $omd_bin." config $site set APACHE_TCP_PORT 5000", like => '/^$/' },
{ cmd => $omd_bin." config $site set APACHE_TCP_ADDR 127.0.0.1", like => '/^$/' },
{ cmd => "/bin/su - $site -c 'grep -c 5010 etc/apache/proxy-port.conf'", like => '/^0$/', exit => 1 },
{ cmd => "/bin/df -k /omd/sites/$site/tmp/.", like => '/tmpfs/m' },
{ cmd => "/bin/df -k /omd/sites/$site/tmp/.", like => $is_docker ? '/overlay/' : '/tmpfs/m' },
{ cmd => $omd_bin." check $site", like => '/Running configuration check/', errlike => '/Running pre-flight check on configuration/' },
{ cmd => $omd_bin." start $site", like => '/Starting naemon/' },
{ cmd => $omd_bin." status $site", like => [
Expand All @@ -97,14 +100,14 @@ my $tests = [
{ cmd => $omd_bin." config $site2 show APACHE_TCP_PORT", like => '/^5001$/' },
{ cmd => "/bin/su - $site2 -c 'omd -v diff'", like => ['/^$/'] },
{ cmd => "/usr/bin/find /omd/sites/$site2/ -not -user $site2 -ls", like => '/^\s*$/' },
{ cmd => "/bin/df -k /omd/sites/$site2/tmp/.", like => '/tmpfs/m' },
{ cmd => "/bin/df -k /omd/sites/$site2/tmp/.", like => $is_docker ? '/overlay/' : '/tmpfs/m' },
{ cmd => $omd_bin." mv $site2 $site3", like => '/Moving site '.$site2.' to '.$site3.'.../' },
{ cmd => $omd_bin." config $site3 show APACHE_TCP_PORT", like => '/^5001$/' },
{ cmd => "/usr/bin/find /omd/sites/$site3/ -not -user $site3 -ls", like => '/^\s*$/' },
{ cmd => "/bin/df -k /omd/sites/$site3/tmp/.", like => '/tmpfs/m' },
{ cmd => "/bin/df -k /omd/sites/$site3/tmp/.", like => $is_docker ? '/overlay/' : '/tmpfs/m' },
{ cmd => $omd_bin." rm $site3", like => '/Restarting Apache...\s*OK/', stdin => "yes\n" },
{ cmd => $omd_bin." rm $site", like => '/Restarting Apache...\s*OK/', stdin => "yes\n" },
{ cmd => $omd_bin." create -u 7017 -g 7018 $site",
{ cmd => $omd_bin." create $createoptions -u 7017 -g 7018 $site",
like => '/Created new site '.$site.'./',
errlike => '/^(|.*outside of the .* range.*|.*is greater than SYS_UID_MAX.*)$/',
},
Expand All @@ -125,12 +128,12 @@ my $tests = [
{ cmd => $omd_bin." rm $site3", like => '/Restarting Apache...\s*OK/', stdin => "yes\n" },

# --reuse
{ cmd => $omd_bin." create $site", like => '/Created new site '.$site.'./' },
{ cmd => $omd_bin." create $createoptions $site", like => '/Created new site '.$site.'./' },
{ cmd => "/bin/su - $site -c 'omd reset etc/htpasswd'", like => '/^$/' },
{ cmd => $omd_bin." rm --reuse $site", stdin => "yes\n" },
{ cmd => "/usr/bin/id -u $site", like => '/\d+/' },
{ cmd => "/usr/bin/id -g $site", like => '/\d+/' },
{ cmd => $omd_bin." create $site2", like => '/Created new site '.$site2.'./', errlike => '/ERROR: Failed to read config of site testsite./' },
{ cmd => $omd_bin." create $createoptions $site2", like => '/Created new site '.$site2.'./', errlike => '/ERROR: Failed to read config of site testsite./' },
{ cmd => $omd_bin." mv --reuse $site2 $site", like => '/Moving site '.$site2.' to '.$site.'.../' , errlike => '/ERROR: Failed to read config of site testsite./' },
{ cmd => "/usr/bin/id -u $site2", like => '/\d+/' },
{ cmd => "/usr/bin/id -g $site2", like => '/\d+/' },
Expand All @@ -140,7 +143,7 @@ my $tests = [
{ cmd => $omd_bin." rm $site2", like => '/Restarting Apache...\s*OK/', stdin => "yes\n" },

# --backup
{ cmd => $omd_bin." backup $site /tmp/omd.backup.tgz", like => '/Unmounting temporary filesystem/' },
{ cmd => $omd_bin." backup $site /tmp/omd.backup.tgz", like => $is_docker ? '/^$/' : '/Unmounting temporary filesystem/' },
{ cmd => $omd_bin." rm $site", like => '/Restarting Apache...\s*OK/', stdin => "yes\n" },

# --restore
Expand Down
2 changes: 1 addition & 1 deletion t/20-package_icinga2.t
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ my $site = TestUtils::create_test_site() or TestUtils::bail_out_clean("no fur
my $prepares = [
{ cmd => $omd_bin." config $site set CORE icinga2" },

{ cmd => "/bin/su - $site -c './etc/init.d/icinga2 check'", errlike => '/Finished validating the configuration/' },
{ cmd => "/bin/su - $site -c 'omd check icinga2'", errlike => '/Finished validating the configuration/' },
{ cmd => "/bin/su - $site -c './etc/init.d/icinga2 status'", like => '/icinga2 is NOT running/', exit => 1 },
{ cmd => $omd_bin." start $site" },
{ cmd => "/bin/su - $site -c './etc/init.d/icinga2 status'", like => '/icinga2 is running \(\d+\)/' },
Expand Down
7 changes: 5 additions & 2 deletions t/20-package_pnp4nagios.t
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ BEGIN {
use lib "$FindBin::Bin/lib/lib/perl5";
}

plan( tests => 178 );
plan( tests => 192 );

##################################################
# create our test site
Expand All @@ -32,7 +32,8 @@ TestUtils::test_command({ cmd => "/usr/bin/env sed -i -e 's/^perfdata_file_proce
# prepare initial data
TestUtils::test_command({ cmd => $omd_bin." start $site" });
# submit a forced check, so we have initial perf data
TestUtils::test_command({ cmd => "/bin/su - $site -c './lib/monitoring-plugins/check_http -H localhost -a omdadmin:omd -u /$site/thruk/cgi-bin/cmd.cgi -e 200 -P \"cmd_typ=7&cmd_mod=2&host=omd-$site&service=Dummy+Service&start_time=2010-11-06+09%3A46%3A02&force_check=on&btnSubmit=Commit\" -r \"Your command request was successfully submitted\"'", like => '/HTTP OK:/' });
TestUtils::test_command({ cmd => "/bin/su - $site -c './lib/monitoring-plugins/check_http -H localhost -a omdadmin:omd -u /$site/thruk/cgi-bin/cmd.cgi -e 200 -P \"cmd_typ=7&cmd_mod=2&host=omd-$site&service=Dummy+Service&start_time=now&force_check=on\" -r \"Your command request was successfully submitted\"'", like => '/HTTP OK:/' });
TestUtils::test_command({ cmd => "/bin/su - $site -c 'thruk r \"/csv/services?columns=has_been_checked&has_been_checked=1&host_name=omd-$site&description=Dummy+Service\"'", like => '/^1$/smx', waitfor => '^1$' });
TestUtils::test_command({ cmd => "/bin/su - $site -c './etc/init.d/rrdcached flush'", like => '/flush.*OK/' });
TestUtils::wait_for_file("/omd/sites/$site/var/pnp4nagios/perfdata/omd-$site/Dummy_Service_omd-dummy.rrd") or TestUtils::bail_out_clean("No need to test pnp without existing rrd");;

Expand Down Expand Up @@ -92,6 +93,8 @@ TestUtils::test_command({ cmd => $omd_bin." start $site" });
# submit a forced check, so we have initial perf data
TestUtils::test_command({ cmd => "/bin/su - $site -c './lib/monitoring-plugins/check_http -H localhost -a omdadmin:omd -u /$site/thruk/cgi-bin/cmd.cgi -e 200 -P \"cmd_typ=96&cmd_mod=2&host=omd-$site&start_time=2010-11-06+09%3A46%3A02&force_check=on\" -r \"Your command request was successfully submitted\"'", like => '/HTTP OK:/' });
TestUtils::test_command({ cmd => "/bin/su - $site -c './lib/monitoring-plugins/check_http -H localhost -a omdadmin:omd -u /$site/thruk/cgi-bin/cmd.cgi -e 200 -P \"cmd_typ=7&cmd_mod=2&host=omd-$site&service=Dummy+Service&start_time=2010-11-06+09%3A46%3A02&force_check=on\" -r \"Your command request was successfully submitted\"'", like => '/HTTP OK:/' });
TestUtils::test_command({ cmd => "/bin/su - $site -c 'thruk r \"/csv/services?columns=has_been_checked&has_been_checked=1&host_name=omd-$site&description=Dummy+Service\"'", like => '/^1$/smx', waitfor => '^1$' });
TestUtils::test_command({ cmd => "/bin/su - $site -c './etc/init.d/rrdcached flush'", like => '/flush.*OK/' });
TestUtils::wait_for_file("/omd/sites/$site/var/pnp4nagios/perfdata/omd-$site/Dummy_Service_omd-dummy.rrd") or TestUtils::bail_out_clean("No need to test pnp without existing rrd");;
TestUtils::wait_for_file("/omd/sites/$site/var/pnp4nagios/perfdata/omd-$site/_HOST__omd-dummy.rrd") or TestUtils::bail_out_clean("No need to test pnp without existing rrd");;

Expand Down
6 changes: 4 additions & 2 deletions t/20-package_thruk.t
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ BEGIN {
use lib "$FindBin::Bin/lib/lib/perl5";
}

plan( tests => 987 );
plan( tests => 996 );

##################################################
# create our test site
Expand Down Expand Up @@ -220,7 +220,9 @@ for my $core (qw/naemon/) {
unlink("/omd/sites/$site/tmp/thruk/thruk.cache");
unlink("/omd/sites/$site/var/thruk/obj_retention.dat");

TestUtils::test_command({ cmd => "/bin/su - $site -c './bin/thruk -A omdadmin \"cmd.cgi?cmd_typ=7&cmd_mod=2&host=omd-$site&service=Dummy+Service&start_time=now&force_check=on&btnSubmit=Commit\" --local'", like => '/command request was successfully submitted/', errlike => '/cmd: COMMAND/' });
TestUtils::test_command({ cmd => "/bin/su - $site -c './bin/thruk -A omdadmin \"cmd.cgi?cmd_typ=7&cmd_mod=2&host=omd-$site&service=Dummy+Service&start_time=now&force_check=on\" --local'", like => '/command request was successfully submitted/', errlike => '/cmd: COMMAND/' });
TestUtils::test_command({ cmd => "/bin/su - $site -c 'thruk r \"/csv/services?columns=has_been_checked&has_been_checked=1&host_name=omd-$site&description=Dummy+Service\"'", like => '/^1$/smx', waitfor => '^1$' });
TestUtils::test_command({ cmd => "/bin/su - $site -c './etc/init.d/rrdcached flush'", like => '/flush.*OK/' });
TestUtils::wait_for_file("/omd/sites/$site/var/pnp4nagios/perfdata/omd-$site/Dummy_Service_omd-dummy.rrd", 240) or TestUtils::bail_out_clean("No need to test Thruk without working pnp");;

for my $test (@{$tests}) {
Expand Down
3 changes: 3 additions & 0 deletions t/35-ansible.t
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ my $site = TestUtils::create_test_site() or TestUtils::bail_out_clean("no fur
# is ansible installed?
TestUtils::test_command({ cmd => "/bin/su - $site -c 'test -x bin/ansible'", like => '/^$/' });

# use usermod to unlock the user, otherwise ssh does not allow login
TestUtils::test_command({ cmd => "/usr/sbin/usermod -p test $site", like => '/.*/', errlike => '/.*/', exit => undef });

# enable and test ssh to localhost
TestUtils::test_command({ cmd => "/bin/su - $site -c 'mkdir .ssh'", like => '/^$/' });
TestUtils::test_command({ cmd => "/bin/su - $site -c 'chmod 700 .ssh'", like => '/^$/' });
Expand Down
17 changes: 10 additions & 7 deletions t/38-prometheus.t
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,16 @@ TestUtils::test_command({ cmd => $omd_bin." start $site", like => ['/Starting pr
TestUtils::test_command({ cmd => "/bin/su - $site -c 'lib/monitoring-plugins/check_http -t 60 -H 127.0.0.1 --onredirect=follow -a omdadmin:omd -u \"/$site/prometheus\" -s \"<title>Prometheus Time Series Collection and Processing Server</title>\"'", like => '/HTTP OK:/', waitfor => 'OK:', maxwait => 180 });
TestUtils::test_command({ cmd => "/bin/su - $site -c 'lib/monitoring-plugins/check_http -t 60 -H 127.0.0.1 --onredirect=follow -a omdadmin:omd -u \"/$site/alertmanager\" -s \"<title>Alertmanager</title>\"'", like => '/HTTP OK:/', waitfor => 'OK:' });
TestUtils::test_command({ cmd => "/bin/su - $site -c 'lib/monitoring-plugins/check_http -t 60 -H 127.0.0.1 -p 9115 -u \"/metrics\" -s \"process_open_fds\"'", like => '/HTTP OK:/' });
my $blackbox_icmp = TestUtils::test_command({ cmd => qq[/bin/su - $site -c 'lib/monitoring-plugins/check_http -t 60 -H 127.0.0.1 -p 9115 -u "/probe?module=icmp&target=127.0.0.1" -s "probe_success 1"'], like => '/HTTP OK:/' });
unless($blackbox_icmp) {
local $ENV{PATH} = "/usr/sbin:/sbin:$ENV{PATH}";
my $be = '/opt/omd/versions/default/bin/blackbox_exporter';
diag(qx(sysctl net.ipv4.ping_group_range));
diag(qx(printf '%s(%s): ' capabilities $be; getcap $be));
};
SKIP: {
skip 'not supported on docker', 4 if TestUtils::is_docker();
my $blackbox_icmp = TestUtils::test_command({ cmd => qq[/bin/su - $site -c 'lib/monitoring-plugins/check_http -t 60 -H 127.0.0.1 -p 9115 -u "/probe?module=icmp&target=127.0.0.1" -s "probe_success 1"'], like => '/HTTP OK:/' });
unless($blackbox_icmp) {
local $ENV{PATH} = "/usr/sbin:/sbin:$ENV{PATH}";
my $be = '/opt/omd/versions/default/bin/blackbox_exporter';
diag(qx(sysctl net.ipv4.ping_group_range));
diag(qx(printf '%s(%s): ' capabilities $be; getcap $be));
};
}
# grafana can take some time to start it's webserver
TestUtils::test_command({ cmd => "/bin/su - $site -c 'cat var/log/grafana/grafana.log'", like => '/HTTP Server Listen/', waitfor => 'HTTP\ Server\ Listen', maxwait => 180 });
TestUtils::test_command({ cmd => "/bin/su - $site -c 'lib/monitoring-plugins/check_http -t 60 -H 127.0.0.1 --onredirect=follow -a omdadmin:omd -u \"/$site/grafana/api/datasources/proxy/2/api/v1/query_range?query=go_goroutines&start=1535520675&end=1535542290&step=15\" -s \"success\"'", like => '/HTTP OK:/', waitfor => 'OK:' });
Expand Down
2 changes: 1 addition & 1 deletion t/40-snmptrapd.t
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ BEGIN {

chomp(my $os = qx(./distro));

#plan( tests => 212 );
plan( skip_all => "this test does not run inside docker" ) if TestUtils::is_docker();
plan( skip_all => "this distribution does not run with systemd" ) if ! -x "/bin/systemctl";
my $snmptrap = -x "/bin/snmptrap" ? "/bin/snmptrap" : -x "/usr/bin/snmptrap" ? "/usr/bin/snmptrap" : undef;
plan( skip_all => "this server cannot send traps" ) if ! defined $snmptrap;
Expand Down
24 changes: 21 additions & 3 deletions t/TestUtils.pm
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,11 @@ sub create_test_site {
if(scalar @{[glob('/omd/sites/*/.')]} >= 1) {
$errlike = '/is in use/';
}
if(test_command({ cmd => TestUtils::get_omd_bin()." create $site", errlike => $errlike })) {
my $createoptions = "";
if(`grep docker /proc/1/mountinfo 2>/dev/null | grep -c hosts` > 0) {
$createoptions = " --no-tmpfs ";
}
if(test_command({ cmd => TestUtils::get_omd_bin()." create $createoptions $site", errlike => $errlike })) {
# disable cookie auth for tests
my $omd_bin = TestUtils::get_omd_bin();
print `$omd_bin config $site set THRUK_COOKIE_AUTH off`;
Expand Down Expand Up @@ -612,9 +616,9 @@ sub read_config {

##################################################

=head2 config
=head2 wait_for_file
return config value
wait for file to appear
=cut
sub wait_for_file {
Expand Down Expand Up @@ -1058,6 +1062,20 @@ sub get_external_ip {

##################################################

=head2 is_docker
returns true if test runs in a docker container
=cut
sub is_docker {
if(`grep docker /proc/1/mountinfo 2>/dev/null | grep -c hosts` > 0) {
return 1;
}
return;
}

##################################################

END {
our($cookie_file);
unlink($cookie_file) if $cookie_file;
Expand Down

0 comments on commit 052fd0c

Please sign in to comment.