Skip to content

Commit 3e7be6c

Browse files
author
Tim Zhou
committed
fxing cpu weight tests
1 parent 1de27d8 commit 3e7be6c

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

test/apiv2/20-containers.at

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -762,15 +762,12 @@ if root && test -e /dev/nullb0; then
762762
t POST libpod/containers/updateCtr/update ${TMPD}/update.json 201
763763

764764
cgroupPath=/sys/fs/cgroup/cpu.weight
765-
# 002 is the byte length
766-
cpu_weight_expect_regex=$'\x01\x025|\x01\x0220'
767-
768765
# Verify CPU weight
769766
echo '{ "AttachStdout":true,"Cmd":["cat", "'$cgroupPath'"]}' >${TMPD}/exec.json
770767
t POST containers/updateCtr/exec ${TMPD}/exec.json 201 .Id~[0-9a-f]\\{64\\}
771768
eid=$(jq -r '.Id' <<<"$output")
772769
response=$('t POST exec/$eid/start 200')
773-
like "$response" "$cpu_weight_expect_regex"
770+
like_any "$response" "cpu_weight is 5 or 20" $'\x01\x025' $'\x01\x0220'
774771

775772
BlkioDeviceReadBps_expected='[
776773
{

test/apiv2/test-apiv2

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,3 +737,19 @@ fi
737737
echo "1..${test_count}"
738738

739739
exit $failure_count
740+
741+
742+
# LIKE_ANY
743+
###############################################################################
744+
like_any() {
745+
local actual="$1"
746+
local testname="$2"
747+
shift 2
748+
for expect in "$@"; do
749+
if expr "$actual" : "$expect" &>/dev/null; then
750+
_show_ok 1 "$testname ('$actual') ~ $expect"
751+
return
752+
fi
753+
done
754+
_show_ok 0 "$testname" "~ any of [$*]" "$actual"
755+
}

0 commit comments

Comments
 (0)