Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions test/command.bats
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
load helpers

@test "crio commands" {
run ${CRIO_BINARY_PATH} -c /dev/null config > /dev/null
run crio -c /dev/null config > /dev/null
echo "$output"
[ "$status" -eq 0 ]
run ${CRIO_BINARY_PATH} badoption > /dev/null
run crio badoption > /dev/null
echo "$output"
[ "$status" -ne 0 ]
}

@test "invalid ulimits" {
run ${CRIO_BINARY_PATH} --default-ulimits doesntexist=2042
run crio --default-ulimits doesntexist=2042
echo $output
[ "$status" -ne 0 ]
[[ "$output" == *"invalid ulimit type: doesntexist"* ]]
run ${CRIO_BINARY_PATH} --default-ulimits nproc=2042:42
run crio --default-ulimits nproc=2042:42
echo $output
[ "$status" -ne 0 ]
[[ "$output" == *"ulimit soft limit must be less than or equal to hard limit: 2042 > 42"* ]]
Expand All @@ -25,15 +25,15 @@ load helpers
}

@test "invalid devices" {
run ${CRIO_BINARY_PATH} --additional-devices /dev/sda:/dev/foo:123
run crio --additional-devices /dev/sda:/dev/foo:123
echo $output
[ "$status" -ne 0 ]
[[ "$output" == *"invalid device mode:"* ]]
run ${CRIO_BINARY_PATH} --additional-devices /dev/sda:/dee/foo:rm
run crio --additional-devices /dev/sda:/dee/foo:rm
echo $output
[ "$status" -ne 0 ]
[[ "$output" == *"invalid device mode:"* ]]
run ${CRIO_BINARY_PATH} --additional-devices /dee/sda:rmw
run crio --additional-devices /dee/sda:rmw
echo $output
[ "$status" -ne 0 ]
[[ "$output" == *"invalid device mode:"* ]]
Expand All @@ -42,11 +42,11 @@ load helpers
@test "invalid metrics port" {
mkdir -p "$TESTDIR/cni/net.d"
opt="--cni-config-dir $TESTDIR/cni/net.d"
run ${CRIO_BINARY_PATH} ${opt} --metrics-port foo --enable-metrics
run crio ${opt} --metrics-port foo --enable-metrics
echo $output
[ "$status" -ne 0 ]
[[ "$output" == *'invalid value "foo" for flag'* ]]
run ${CRIO_BINARY_PATH} ${opt} --metrics-port 18446744073709551616 --enable-metrics
run crio ${opt} --metrics-port 18446744073709551616 --enable-metrics
echo $output
[ "$status" -ne 0 ]
[[ "$output" == *"value out of range"* ]]
Expand All @@ -55,7 +55,7 @@ load helpers
@test "invalid log max" {
mkdir -p "$TESTDIR/cni/net.d"
opt="--cni-config-dir $TESTDIR/cni/net.d"
run ${CRIO_BINARY_PATH} ${opt} --log-size-max foo
run crio ${opt} --log-size-max foo
echo $output
[ "$status" -ne 0 ]
[[ "$output" == *'invalid value "foo" for flag'* ]]
Expand All @@ -65,17 +65,17 @@ load helpers
mkdir -p "$TESTDIR/cni/net.d"
opt="--cni-config-dir $TESTDIR/cni/net.d"
# log size max is special zero value
run ${CRIO_BINARY_PATH} ${opt} --log-size-max 0
run crio ${opt} --log-size-max 0
echo $output
[ "$status" -ne 0 ]
[[ "$output" == *"log size max should be negative or >= 8192"* ]]
# log size max is less than 8192 and more than 0
run ${CRIO_BINARY_PATH} ${opt} --log-size-max 8191
run crio ${opt} --log-size-max 8191
echo $output
[ "$status" -ne 0 ]
[[ "$output" == *"log size max should be negative or >= 8192"* ]]
# log size max is out of the range of 64-bit signed integers
run ${CRIO_BINARY_PATH} ${opt} --log-size-max 18446744073709551616
run crio ${opt} --log-size-max 18446744073709551616
echo $output
[ "$status" -ne 0 ]
[[ "$output" == *"value out of range"* ]]
Expand Down
2 changes: 1 addition & 1 deletion test/helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ function setup_test() {
# Run crio using the binary specified by $CRIO_BINARY_PATH.
# This must ONLY be run on engines created with `start_crio`.
function crio() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as a follow up (or you can address it here) we should change this function name (crio-with-args?) it is not clear we're not running the crio binary in $PATH when calling it above.

"$CRIO_BINARY_PATH" --listen "$CRIO_SOCKET" "$@"
"$CRIO_BINARY_PATH" --listen "$CRIO_SOCKET" --runtimes "$RUNTIME_NAME:$RUNTIME_BINARY:$RUNTIME_ROOT:$RUNTIME_TYPE" "$@"
}

# Run crictl using the binary specified by $CRICTL_BINARY.
Expand Down