Skip to content

Commit e04ce51

Browse files
authored
Merge pull request #731 from askervin/5F5_e2e_robust_coldstart_test
e2e: more robust coldstart test
2 parents fbf45f2 + fc36cef commit e04ce51

File tree

2 files changed

+24
-20
lines changed
  • test/e2e/policies.test-suite/topology-aware/c4pmem4

2 files changed

+24
-20
lines changed

test/e2e/policies.test-suite/topology-aware/c4pmem4/test03-coldstart-deprecated-syntax/code.var.sh

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@
1010

1111
PMEM_NODES='{"node4", "node5", "node6", "node7"}'
1212

13-
# pmem-active returns total Active (allocated) memory on PMEM nodes
14-
pmem-active() {
13+
# pmem-used returns total MemUsed (allocated) memory on PMEM nodes
14+
pmem-used() {
1515
local pmem_nodes_shell=${PMEM_NODES//[\" ]/}
16-
vm-command "cat /sys/devices/system/node/$pmem_nodes_shell/meminfo | awk '/Active:/{mem+=\$4}END{print mem}'" >/dev/null ||
16+
vm-command "cat /sys/devices/system/node/$pmem_nodes_shell/meminfo | awk '/MemUsed:/{mem+=\$4}END{print mem}'" >/dev/null ||
1717
command-error "cannot read PMEM usage from node $node"
1818
echo "$COMMAND_OUTPUT"
1919
}
2020

2121
CRI_RESMGR_OUTPUT="cat cri-resmgr.output.txt"
2222

23-
PMEM_ACTIVE_BEFORE_POD0="$(pmem-active)"
23+
PMEM_USED_BEFORE_POD0="$(pmem-used)"
2424

2525
DURATION=10s
2626
COLD_ALLOC=$((10 * 1024))kB
@@ -40,11 +40,12 @@ vm-run-until "pgrep -f '^sh -c paused after cold_alloc'" >/dev/null ||
4040
error "cold memory allocation timed out"
4141

4242
echo "Verify PMEM consumption during cold period."
43-
PMEM_ERROR_MARGIN=1024 # meminfo Active vs dd bytes error margin
44-
PMEM_ACTIVE_COLD_POD0="$(pmem-active)"
45-
PMEM_COLD_CONSUMED=$(( $PMEM_ACTIVE_COLD_POD0 - $PMEM_ACTIVE_BEFORE_POD0 ))
43+
PMEM_ERROR_MARGIN=1024 # meminfo MemUsed vs dd bytes error margin
44+
sleep 1
45+
PMEM_USED_COLD_POD0="$(pmem-used)"
46+
PMEM_COLD_CONSUMED=$(( $PMEM_USED_COLD_POD0 - $PMEM_USED_BEFORE_POD0 ))
4647
if (( $PMEM_COLD_CONSUMED + $PMEM_ERROR_MARGIN < ${COLD_ALLOC%kB} )); then
47-
error "pod0 did not allocate $COLD_ALLOC from PMEM. Active PMEM delta: $PMEM_COLD_CONSUMED"
48+
error "pod0 did not allocate $COLD_ALLOC from PMEM. MemUsed PMEM delta: $PMEM_COLD_CONSUMED"
4849
else
4950
echo "### Verified: PMEM memory consumed during cold period: $PMEM_COLD_CONSUMED kB, pod script allocated: ${COLD_ALLOC%kB} kB"
5051
fi
@@ -69,8 +70,9 @@ vm-run-until "pgrep -f '^sh -c paused after warm_alloc'" ||
6970
error "warm memory allocation timed out"
7071

7172
echo "Verify (soft): PMEM consumption after cold period."
72-
PMEM_ACTIVE_WARM_POD0="$(pmem-active)"
73-
PMEM_WARM_CONSUMED=$(( $PMEM_ACTIVE_WARM_POD0 - $PMEM_ACTIVE_COLD_POD0 ))
73+
sleep 1
74+
PMEM_USED_WARM_POD0="$(pmem-used)"
75+
PMEM_WARM_CONSUMED=$(( $PMEM_USED_WARM_POD0 - $PMEM_USED_COLD_POD0 ))
7476
if (( $PMEM_WARM_CONSUMED > 0 )); then
7577
echo "### Verify (soft) failed: pod0 allocated $WARM_ALLOC from PMEM. Should have been taken from DRAM."
7678
else

test/e2e/policies.test-suite/topology-aware/c4pmem4/test03-coldstart/code.var.sh

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@
1010

1111
PMEM_NODES='{"node4", "node5", "node6", "node7"}'
1212

13-
# pmem-active returns total Active (allocated) memory on PMEM nodes
14-
pmem-active() {
13+
# pmem-used returns total MemUsed (allocated) memory on PMEM nodes
14+
pmem-used() {
1515
local pmem_nodes_shell=${PMEM_NODES//[\" ]/}
16-
vm-command "cat /sys/devices/system/node/$pmem_nodes_shell/meminfo | awk '/Active:/{mem+=\$4}END{print mem}'" >/dev/null ||
16+
vm-command "cat /sys/devices/system/node/$pmem_nodes_shell/meminfo | awk '/MemUsed:/{mem+=\$4}END{print mem}'" >/dev/null ||
1717
command-error "cannot read PMEM usage from node $node"
1818
echo "$COMMAND_OUTPUT"
1919
}
2020

2121
CRI_RESMGR_OUTPUT="cat cri-resmgr.output.txt"
2222

23-
PMEM_ACTIVE_BEFORE_POD0="$(pmem-active)"
23+
PMEM_USED_BEFORE_POD0="$(pmem-used)"
2424

2525
DURATION=10s
2626
COLD_ALLOC=$((10 * 1024))kB
@@ -40,11 +40,12 @@ vm-run-until "pgrep -f '^sh -c paused after cold_alloc'" >/dev/null ||
4040
error "cold memory allocation timed out"
4141

4242
echo "Verify PMEM consumption during cold period."
43-
PMEM_ERROR_MARGIN=1024 # meminfo Active vs dd bytes error margin
44-
PMEM_ACTIVE_COLD_POD0="$(pmem-active)"
45-
PMEM_COLD_CONSUMED=$(( $PMEM_ACTIVE_COLD_POD0 - $PMEM_ACTIVE_BEFORE_POD0 ))
43+
PMEM_ERROR_MARGIN=1024 # meminfo MemUsed vs dd bytes error margin
44+
sleep 1
45+
PMEM_USED_COLD_POD0="$(pmem-used)"
46+
PMEM_COLD_CONSUMED=$(( $PMEM_USED_COLD_POD0 - $PMEM_USED_BEFORE_POD0 ))
4647
if (( $PMEM_COLD_CONSUMED + $PMEM_ERROR_MARGIN < ${COLD_ALLOC%kB} )); then
47-
error "pod0 did not allocate $COLD_ALLOC from PMEM. Active PMEM delta: $PMEM_COLD_CONSUMED"
48+
error "pod0 did not allocate $COLD_ALLOC from PMEM. MemUsed PMEM delta: $PMEM_COLD_CONSUMED"
4849
else
4950
echo "### Verified: PMEM memory consumed during cold period: $PMEM_COLD_CONSUMED kB, pod script allocated: ${COLD_ALLOC%kB} kB"
5051
fi
@@ -69,8 +70,9 @@ vm-run-until "pgrep -f '^sh -c paused after warm_alloc'" ||
6970
error "warm memory allocation timed out"
7071

7172
echo "Verify (soft): PMEM consumption after cold period."
72-
PMEM_ACTIVE_WARM_POD0="$(pmem-active)"
73-
PMEM_WARM_CONSUMED=$(( $PMEM_ACTIVE_WARM_POD0 - $PMEM_ACTIVE_COLD_POD0 ))
73+
sleep 1
74+
PMEM_USED_WARM_POD0="$(pmem-used)"
75+
PMEM_WARM_CONSUMED=$(( $PMEM_USED_WARM_POD0 - $PMEM_USED_COLD_POD0 ))
7476
if (( $PMEM_WARM_CONSUMED > 0 )); then
7577
echo "### Verify (soft) failed: pod0 allocated $WARM_ALLOC from PMEM. Should have been taken from DRAM."
7678
else

0 commit comments

Comments
 (0)