Skip to content

Commit

Permalink
tests: code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sni committed Jan 28, 2025
1 parent 989d717 commit 0f6b82d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
13 changes: 8 additions & 5 deletions t/scenarios/_common/ansible/roles/common/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
- name: "yum clean all"
shell: "yum clean all || :"
- name: "apt update"
shell: "apt update || :"
- name: "switch centos 7 to vault.centos.org"
shell: |
sed -i -e 's%mirror.centos.org%vault.centos.org%g' /etc/yum.repos.d/CentOS-Base.repo
Expand All @@ -11,8 +7,10 @@

- name: "run set_admin_password"
shell: "! test -x /omd/sites/{{site}}/bin/set_admin_password || sudo su - {{ site }} -c 'set_admin_password omd'"

- name: "stop site"
shell: "omd stop {{ site }}"
shell: "ps -fu {{ site }} >/dev/null || omd stop {{ site }}"

- name: "check if xinetd file exists"
stat:
path: /opt/omd/sites/{{ site }}/etc/naemon/xinetd.conf
Expand All @@ -23,6 +21,7 @@
line: " cps = 10000 3"
regexp: '^\s*cps'
when: xinetd_livestatus.stat.exists == true

- name: "check if naemon.cfg file exists"
stat:
path: /opt/omd/sites/{{ site }}/etc/naemon/naemon.cfg
Expand All @@ -33,22 +32,26 @@
line: "check_workers=2"
regexp: '^check_workers='
when: naemon_conf.stat.exists == true

- name: increase slow_page_log_threshold
lineinfile:
dest: /opt/omd/sites/{{ site }}/etc/thruk/thruk_local.d/test_adjustments.conf
line: "slow_page_log_threshold = 35"
regexp: '^slow_page_log_threshold'
create: true

- name: lower max fcgi processes
lineinfile:
dest: /opt/omd/sites/{{ site }}/etc/apache/conf.d/02_fcgid.conf
line: "MaxProcessCount 5"
regexp: '^MaxProcessCount'

- name: increase max requests
lineinfile:
dest: /opt/omd/sites/{{ site }}/etc/apache/conf.d/02_fcgid.conf
line: "MaxRequestsPerProcess 100000"
regexp: '^MaxRequestsPerProcess'

- name: lower max fcgi processes for thruk
lineinfile:
dest: /opt/omd/sites/{{ site }}/etc/apache/conf.d/thruk.conf
Expand Down
14 changes: 7 additions & 7 deletions t/scenarios/_common/ansible/roles/ssh_site_login/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
- stat: path=/usr/bin/passwd
register: passwd_path
- package:
name:
- name: "install passwd"
include_role:
name: yum_apt_retry
vars:
package:
- passwd
state: present
# hack because ansibles takes over 10seconds, even if it does not install anything
when: not passwd_path.stat.exists
creates:
- /usr/bin/passwd
- shell: sudo su - {{ site }} -c "mkdir -p .ssh && chmod 700 .ssh && ssh-keygen -t ed25519 -f .ssh/id_ed25519 -N '' && cp .ssh/id_ed25519.pub .ssh/authorized_keys && chmod 600 .ssh/authorized_keys"
- name: create .ssh/config
copy:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
for file in {{ creates | join(' ') }}; do
if [ $(ls -l1 $(echo $file | tr , ' ') 2>/dev/null | wc -l) -eq 0 ]; then
echo "file $file not found after pkg installation"
yum clean all >/dev/null 2>&1 || :
apt update >/dev/null 2>&1 || :
exit 1
fi
done
Expand Down
3 changes: 1 addition & 2 deletions t/scenarios/utf8/omd/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- role: thruk_developer
- role: local_tests
tasks:
- name: "yum install libreoffix"
- name: "yum install libreoffice"
include_role:
name: yum_apt_retry
vars:
Expand Down Expand Up @@ -34,4 +34,3 @@
dest: /omd/sites/demo/etc/naemon/conf.d/test.cfg
owner: demo
group: demo

0 comments on commit 0f6b82d

Please sign in to comment.