-
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 scenario with lots of utf8 characters
- Loading branch information
Showing
14 changed files
with
243 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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
services: | ||
omd: | ||
build: omd/ | ||
platform: linux/amd64 | ||
ports: | ||
- "127.0.0.3:60080:80" | ||
- "127.0.0.3:60443:443" | ||
- "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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM local/thruk-labs-rocky:nightly | ||
|
||
COPY playbook.yml /root/ansible_dropin/ | ||
ENV ANSIBLE_ROLES_PATH /thruk/t/scenarios/_common/ansible/roles | ||
COPY test.cfg /root/ |
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,37 @@ | ||
--- | ||
- hosts: all | ||
roles: | ||
- role: common | ||
- role: thruk_developer | ||
- role: local_tests | ||
tasks: | ||
- name: "yum install libreoffix" | ||
include_role: | ||
name: yum_apt_retry | ||
vars: | ||
package: | ||
- libreoffice-calc | ||
|
||
- name: "omd config change" | ||
shell: "omd config demo change" | ||
args: | ||
stdin: | | ||
APACHE_MODE=own | ||
LIVESTATUS_TCP=on | ||
- name: "create secret.key" | ||
shell: echo "testkey" > /omd/sites/demo/var/thruk/secret.key | ||
- name: "set permissions on secret.key" | ||
file: | ||
path: /omd/sites/demo/var/thruk/secret.key | ||
mode: 0600 | ||
owner: demo | ||
group: demo | ||
|
||
- name: "copy test.cfg" | ||
copy: | ||
src: /root/test.cfg | ||
dest: /omd/sites/demo/etc/naemon/conf.d/test.cfg | ||
owner: demo | ||
group: demo | ||
|
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,40 @@ | ||
define servicegroup { | ||
servicegroup_name Äll Service Checks | ||
alias Äll Service Checks | ||
members öäü߀,öäü߀ | ||
} | ||
|
||
define hostgroup { | ||
hostgroup_name Äll Hösts | ||
alias Just all hösts | ||
members * | ||
} | ||
|
||
define host { | ||
host_name öäü߀ | ||
alias öäü߀ | ||
use generic-host | ||
contact_groups töst | ||
} | ||
|
||
define service { | ||
service_description öäü߀ | ||
host_name öäü߀ | ||
use generic-service | ||
check_command check_dummy!0!"öäü߀" | ||
} | ||
|
||
define contactgroup { | ||
contactgroup_name töst | ||
alias töst group | ||
members cöntäct | ||
} | ||
|
||
define contact { | ||
contact_name cöntäct | ||
alias cöntäct | ||
use generic-contact | ||
can_submit_commands 1 | ||
email mäil@localhost | ||
} | ||
|
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,29 @@ | ||
use warnings; | ||
use strict; | ||
use Test::More; | ||
|
||
BEGIN { | ||
plan tests => 17; | ||
|
||
use lib('t'); | ||
require TestUtils; | ||
import TestUtils; | ||
} | ||
|
||
########################################################### | ||
my($host,$service) = TestUtils::get_test_service(); | ||
|
||
########################################################### | ||
# force reschedule so we get some performance data | ||
TestUtils::test_page( | ||
url => '/thruk/r/hosts/'.$host.'/cmd/schedule_forced_host_check', | ||
post => { start_time => 'now' }, | ||
like => ['Command successfully submitted'], | ||
); | ||
TestUtils::test_page( | ||
url => '/thruk/r/services/'.$host.'/'.$service.'/cmd/schedule_forced_svc_check', | ||
post => { start_time => 'now' }, | ||
like => ['Command successfully submitted'], | ||
); | ||
|
||
########################################################### |
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 @@ | ||
../../../300-controller_extinfo.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 @@ | ||
../../../300-controller_status.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 @@ | ||
../../../300-controller_tac.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,70 @@ | ||
use warnings; | ||
use strict; | ||
use Test::More; | ||
use utf8; | ||
|
||
plan tests => 27; | ||
|
||
BEGIN { | ||
$ENV{'THRUK_AUTHOR'} = 1; | ||
use lib('t'); | ||
require TestUtils; | ||
import TestUtils; | ||
} | ||
|
||
use 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"); | ||
|
||
########################################################### | ||
# add downtime with utf8 characters | ||
TestUtils::test_command({ | ||
cmd => '/usr/bin/env thruk r -d comment_data=döwnäü߀ -d end_time=+3m /hosts/öäü߀/cmd/schedule_host_downtime', | ||
like => ['/Command successfully submitted/'], | ||
}); | ||
|
||
########################################################### | ||
# excel export service list | ||
TestUtils::test_command({ | ||
cmd => '/usr/bin/env bash -c \'thruk url "status.cgi?style=detail&view_mode=xls&columns=Hostname&columns=IP&columns=Service&columns=Comments" >/tmp/test.xls\'', | ||
like => ['/^$/'], | ||
}); | ||
|
||
########################################################### | ||
# check excel file | ||
TestUtils::test_command({ | ||
cmd => '/usr/bin/env file /tmp/test.xls', | ||
like => ['/\/tmp\/test.xls: CDFV2 Microsoft Excel/'], | ||
}); | ||
|
||
########################################################### | ||
# convert to csv | ||
TestUtils::test_command({ | ||
cmd => '/usr/bin/env libreoffice --headless --convert-to "csv" --infilter="CSV:44,34,UTF-8" --outdir /tmp/ /tmp/test.xls', | ||
like => ['/convert/', '/StarCalc/'], | ||
}); | ||
|
||
########################################################### | ||
# check excel file | ||
TestUtils::test_command({ | ||
cmd => '/usr/bin/env file /tmp/test.csv', | ||
like => ['/\/tmp\/test.csv: UTF-8 Unicode text/'], | ||
}); | ||
|
||
########################################################### | ||
# does the csv contain all information? | ||
my $content = Thruk::Utils::IO::read_decoded("/tmp/test.csv"); | ||
like($content, '/öäü߀/', 'csv file contains hostname'); | ||
like($content, '/döwnäü߀/', 'csv contains downtime comment'); | ||
|
||
########################################################### | ||
# cleanup | ||
unlink("/tmp/test.xls"); | ||
#unlink("/tmp/test.csv"); | ||
|
||
########################################################### |
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 @@ | ||
../../../thruk.conf |
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,12 @@ | ||
<Component Thruk::Backend> | ||
<peer> | ||
name = naemon | ||
id = abcd | ||
type = livestatus | ||
<options> | ||
peer = 127.0.0.3:60557 | ||
</options> | ||
</peer> | ||
</Component> | ||
|
||
slow_page_log_threshold = 45 |