-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add test case for custom vars in details page
- Loading branch information
Showing
7 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
include ../_common/Makefile.common | ||
|
||
extra_test: | ||
docker compose exec $(DOCKER_COMPOSE_TTY) --user root omd sudo -iu demo /usr/local/bin/local_test.sh 0 | ||
|
||
extra_test_verbose: | ||
docker compose exec $(DOCKER_COMPOSE_TTY) --user root omd sudo -iu demo /usr/local/bin/local_test.sh 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ services: | |
- "127.0.0.3:60557:6557" | ||
volumes: | ||
- ../../../:/thruk:ro | ||
- ./:/test:ro |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
t/scenarios/backend_naemon/t/local/010-custom_vars_default_view.t
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
use warnings; | ||
use strict; | ||
use Test::More; | ||
|
||
BEGIN { | ||
use lib('t'); | ||
require TestUtils; | ||
import TestUtils; | ||
} | ||
|
||
plan tests => 35; | ||
|
||
$ENV{'THRUK_TEST_AUTH'} = 'omdadmin:omd'; | ||
$ENV{'PLACK_TEST_EXTERNALSERVER_URI'} = 'http://127.0.0.1/demo'; | ||
|
||
use_ok("Thruk::Utils::IO"); | ||
|
||
########################################################### | ||
# verify that we use the correct thruk binary | ||
TestUtils::test_command({ | ||
cmd => '/bin/bash -c "type thruk"', | ||
like => ['/\/thruk\/script\/thruk/'], | ||
}) or BAIL_OUT("wrong thruk path"); | ||
|
||
########################################################### | ||
# thruk roles | ||
TestUtils::test_command({ | ||
cmd => '/usr/bin/env thruk user.cgi', | ||
like => ['/>User<.*?>\(cli\)</', '/authorized_for_admin/'], | ||
}); | ||
|
||
########################################################### | ||
# create example config and reload apache | ||
my $rc = Thruk::Utils::IO::write("etc/thruk/thruk_local.d/custom_var.conf", ' | ||
show_custom_vars = _TEST | ||
show_custom_vars = __IMPACT | ||
default_service_columns = host_name,description,state,last_check,cust__IMPACT:ImpactAlias,cust_TEST:TestAlias | ||
'); | ||
ok($rc, 'etc/thruk/thruk_local.d/custom_var.conf'); | ||
TestUtils::test_command({ | ||
cmd => '/usr/bin/env omd reload apache', | ||
like => ['/Reloading apache.*OK/'], | ||
}); | ||
sleep(3); | ||
|
||
########################################################### | ||
TestUtils::test_page( | ||
url => '/thruk/cgi-bin/status.cgi?host=test', | ||
like => ['ImpactAlias', 'TestAlias', 'dbl underscore hst', 'dbl underscore svc', 'test var hst', 'test var svc'], | ||
); | ||
|
||
########################################################### | ||
# cleanup test config | ||
unlink("etc/thruk/thruk_local.d/custom_var.conf"); | ||
TestUtils::test_command({ | ||
cmd => '/usr/bin/env omd reload apache', | ||
like => ['/Reloading apache.*OK/'], | ||
}); | ||
sleep(3); |