|
| 1 | +#!/bin/bash |
| 2 | +## kola: |
| 3 | +## # we install stress-ng |
| 4 | +## tags: needs-internet |
| 5 | +## platforms: qemu |
| 6 | +## numaNodes: true |
| 7 | +## minMemory: 2048 |
| 8 | +## architectures: "!s390x" |
| 9 | +## description: Verify that numad detects nodes and tracks set -euo pipefail |
| 10 | +## bindMountHostRO: ["/,/var/cosaroot"] |
| 11 | + |
| 12 | +set -euo pipefail |
| 13 | + |
| 14 | +# shellcheck disable=SC1091 |
| 15 | +. "$KOLA_EXT_DATA/commonlib.sh" |
| 16 | + |
| 17 | +if [[ $(systemctl show numad -p ActiveState) != "ActiveState=active" ]]; then |
| 18 | + fatal "numad did not activate" |
| 19 | +fi |
| 20 | + |
| 21 | +# Call numad to change the already running daemon's settings for -l and -i |
| 22 | +# `-l 7` adds extra information to the logs |
| 23 | +# `-i 5` changes interval from every 15s to every 5s |
| 24 | +numad -l7 -i5 |
| 25 | + |
| 26 | +if ! lscpu | grep -Eq "NUMA node\(s\):\s*2"; then |
| 27 | + fatal "expected to find exactly 2 numa nodes" |
| 28 | +fi |
| 29 | + |
| 30 | +# As part of the test we want to run a somewhat intensive process, so that |
| 31 | +# we can verify that numad is successfully tracking processes. Here we |
| 32 | +# use the same pattern of using a mounted in COSA as the container root as: |
| 33 | +# https://github.com/coreos/coreos-assembler/blob/8dbfe3ea8b8f571e732e8cc0ab307e983a0be1f3/mantle/cmd/kola/resources/iscsi_butane_setup.yaml#L102-L113 |
| 34 | +podman run --privileged --name stress-ng --pid=host \ |
| 35 | + --volume=root:/root/:nocopy --volume=vartmp:/var/tmp/:nocopy \ |
| 36 | + --workdir /root --rootfs /var/cosaroot \ |
| 37 | + stress-ng --temp-path /var/tmp --vm 1 --vm-bytes 1024M --timeout 25s |
| 38 | + |
| 39 | +logfile="/var/log/numad.log" |
| 40 | +for node in 0 1; do |
| 41 | + # Different versions of numad have a slightly different format for the log file, |
| 42 | + # e.g. MBs_total vs MBs_tot. This pattern should match both versions. |
| 43 | + if ! grep -Eq "Node.${node}.*MBs_tot(al)?.*CPUs_tot(al)?" "$logfile"; then |
| 44 | + fatal "Numad didn't detect Node ${node}" |
| 45 | + fi |
| 46 | +done |
| 47 | + |
| 48 | +# Check that the stress test was being monitored by numad |
| 49 | +if ! grep -q "stress-ng-vm" "$logfile"; then |
| 50 | + fatal "Numad is not monitoring the stress test" |
| 51 | +fi |
| 52 | + |
| 53 | +ok "Numad working as expected" |
0 commit comments