Skip to content

Commit

Permalink
Update thp check and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysmeister committed Jul 27, 2024
1 parent b29b992 commit f158cd9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
10 changes: 5 additions & 5 deletions roles/mongodb_linux/molecule/default/tests/test_default.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ def test_thp_service(host):
# inspecting cgroups is iffy on GHA, so use the /.dockerenv file
in_docker = host.file("/.dockerenv").exists

if not in_docker:
for d in switches:
cmd = host.run("cat {0}".format(d))
#if not in_docker:
for d in switches:
cmd = host.run("cat {0}".format(d))

assert cmd.rc == 0
assert "[never]" in cmd.stdout
assert cmd.rc == 0
assert "[never]" in cmd.stdout


def test_limit_file(host):
Expand Down
12 changes: 9 additions & 3 deletions roles/mongodb_linux/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
- "setup"
- "pkg"

- name: Update perms on chrony pid dir on RedHat 8
- name: Update perms on chrony pid dir on RedHat 8+
file:
path: /run/chrony/
owner: root
Expand Down Expand Up @@ -166,7 +166,7 @@
register: sys_thp

- name: Check if disable-transparent-huge-pages service is already run
shell: cat /sys/kernel/mm/transparent_hugepage/enabled | grep -o '[never]'
shell: cat /sys/kernel/mm/transparent_hugepage/enabled | grep -o '{{ bs }}[never{{ bs }}]'
when: sys_thp.stat.exists
register: _huge_page_status
ignore_errors: yes
Expand All @@ -175,13 +175,19 @@
- "linux"
- "service"
- "setup"
vars:
bs: \

- debug:
var: _huge_page_status.stdout

- name: Enable disable-transparent-huge-pages service
service:
name: disable-transparent-huge-pages
state: started
enabled: yes
when: (not in_docker|bool) and (sys_thp.stat.exists) and (_huge_page_status.stdout == "")
#when: (not in_docker|bool) and (sys_thp.stat.exists) and (_huge_page_status.stdout == "")
when: (sys_thp.stat.exists) and (_huge_page_status.stdout == "")
tags:
- "linux"
- "service"
Expand Down

0 comments on commit f158cd9

Please sign in to comment.