replace crioctl with crictl

Signed-off-by: Wei Wei <weiwei.inf@gmail.com>
This commit is contained in:
Wei Wei 2017-11-15 23:24:20 +08:00
parent 7b837b5a1e
commit 25dfde9044
28 changed files with 457 additions and 457 deletions

View file

@ -13,57 +13,57 @@ function teardown() {
@test "ensure correct hostname" {
start_crio
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
run crictl runs "$TESTDATA"/sandbox_config.json
echo "$output"
[ "$status" -eq 0 ]
pod_id="$output"
run crioctl ctr create --config "$TESTDATA"/container_redis.json --pod "$pod_id"
run crictl create "$pod_id" "$TESTDATA"/container_redis.json "$TESTDATA"/sandbox_config.json
echo "$output"
[ "$status" -eq 0 ]
ctr_id="$output"
run crioctl ctr start --id "$ctr_id"
run crictl start "$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
run crioctl ctr execsync --id "$ctr_id" sh -c "hostname"
run crictl exec --sync "$ctr_id" sh -c "hostname"
echo "$output"
[ "$status" -eq 0 ]
[[ "$output" =~ "crioctl_host" ]]
run crioctl ctr execsync --id "$ctr_id" sh -c "echo \$HOSTNAME"
[[ "$output" =~ "crictl_host" ]]
run crictl exec --sync "$ctr_id" sh -c "echo \$HOSTNAME"
echo "$output"
[ "$status" -eq 0 ]
[[ "$output" =~ "crioctl_host" ]]
run crioctl ctr execsync --id "$ctr_id" sh -c "cat /etc/hostname"
[[ "$output" =~ "crictl_host" ]]
run crictl exec --sync "$ctr_id" sh -c "cat /etc/hostname"
echo "$output"
[ "$status" -eq 0 ]
[[ "$output" =~ "crioctl_host" ]]
[[ "$output" =~ "crictl_host" ]]
}
@test "ensure correct hostname for hostnetwork:true" {
start_crio
hostnetworkconfig=$(cat "$TESTDATA"/sandbox_config.json | python -c 'import json,sys;obj=json.load(sys.stdin);obj["linux"]["security_context"]["namespace_options"]["host_network"] = True; obj["annotations"] = {}; obj["hostname"] = ""; json.dump(obj, sys.stdout)')
echo "$hostnetworkconfig" > "$TESTDIR"/sandbox_hostnetwork_config.json
run crioctl pod run --config "$TESTDIR"/sandbox_hostnetwork_config.json
run crictl runs "$TESTDIR"/sandbox_hostnetwork_config.json
echo "$output"
[ "$status" -eq 0 ]
pod_id="$output"
run crioctl ctr create --config "$TESTDATA"/container_redis.json --pod "$pod_id"
run crictl create "$pod_id" "$TESTDATA"/container_redis.json "$TESTDIR"/sandbox_hostnetwork_config.json
echo "$output"
[ "$status" -eq 0 ]
ctr_id="$output"
run crioctl ctr start --id "$ctr_id"
run crictl start "$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
run crioctl ctr execsync --id "$ctr_id" sh -c "hostname"
run crictl exec --sync "$ctr_id" sh -c "hostname"
echo "$output"
[ "$status" -eq 0 ]
[[ "$output" =~ "$HOSTNAME" ]]
run crioctl ctr execsync --id "$ctr_id" sh -c "echo \$HOSTNAME"
run crictl exec --sync "$ctr_id" sh -c "echo \$HOSTNAME"
echo "$output"
[ "$status" -eq 0 ]
[[ "$output" =~ "$HOSTNAME" ]]
run crioctl ctr execsync --id "$ctr_id" sh -c "cat /etc/hostname"
run crictl exec --sync "$ctr_id" sh -c "cat /etc/hostname"
echo "$output"
[ "$status" -eq 0 ]
[[ "$output" =~ "$HOSTNAME" ]]
@ -71,27 +71,28 @@ function teardown() {
@test "Check for valid pod netns CIDR" {
start_crio
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
run crictl runs "$TESTDATA"/sandbox_config.json
echo "$output"
[ "$status" -eq 0 ]
pod_id="$output"
run crioctl ctr create --config "$TESTDATA"/container_redis.json --pod "$pod_id"
run crictl create "$pod_id" "$TESTDATA"/container_redis.json "$TESTDATA"/sandbox_config.json
echo "$output"
[ "$status" -eq 0 ]
ctr_id="$output"
check_pod_cidr $ctr_id
}
@test "Ping pod from the host" {
start_crio
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
run crictl runs "$TESTDATA"/sandbox_config.json
echo "$output"
[ "$status" -eq 0 ]
pod_id="$output"
run crioctl ctr create --config "$TESTDATA"/container_redis.json --pod "$pod_id"
run crictl create "$pod_id" "$TESTDATA"/container_redis.json "$TESTDATA"/sandbox_config.json
echo "$output"
[ "$status" -eq 0 ]
ctr_id="$output"
@ -101,22 +102,22 @@ function teardown() {
@test "Ping pod from another pod" {
start_crio
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
run crictl runs "$TESTDATA"/sandbox_config.json
echo "$output"
[ "$status" -eq 0 ]
pod1_id="$output"
run crioctl ctr create --config "$TESTDATA"/container_redis.json --pod "$pod1_id"
run crictl create "$pod1_id" "$TESTDATA"/container_redis.json "$TESTDATA"/sandbox_config.json
echo "$output"
[ "$status" -eq 0 ]
ctr1_id="$output"
temp_sandbox_conf cni_test
run crioctl pod run --config "$TESTDIR"/sandbox_config_cni_test.json
run crictl runs "$TESTDIR"/sandbox_config_cni_test.json
echo "$output"
[ "$status" -eq 0 ]
pod2_id="$output"
run crioctl ctr create --config "$TESTDATA"/container_redis.json --pod "$pod2_id"
run crictl create "$pod2_id" "$TESTDATA"/container_redis.json "$TESTDIR"/sandbox_config_cni_test.json
echo "$output"
[ "$status" -eq 0 ]
ctr2_id="$output"
@ -131,7 +132,7 @@ function teardown() {
skip "bridge-custom plugin not available"
fi
start_crio "" "" "" "prepare_plugin_test_args_network_conf"
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
run crictl runs "$TESTDATA"/sandbox_config.json
[ "$status" -eq 0 ]
. /tmp/plugin_test_args.out
@ -146,7 +147,7 @@ function teardown() {
@test "Connect to pod hostport from the host" {
start_crio
run crioctl pod run --config "$TESTDATA"/sandbox_config_hostport.json
run crictl runs "$TESTDATA"/sandbox_config_hostport.json
echo "$output"
[ "$status" -eq 0 ]
pod_id="$output"
@ -154,18 +155,18 @@ function teardown() {
get_host_ip
echo $host_ip
run crioctl ctr create --config "$TESTDATA"/container_config_hostport.json --pod "$pod_id"
run crictl create "$pod_id" "$TESTDATA"/container_config_hostport.json "$TESTDATA"/sandbox_config_hostport.json
echo "$output"
[ "$status" -eq 0 ]
ctr_id="$output"
run crioctl ctr start --id "$ctr_id"
run crictl start "$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
run nc -w 5 $host_ip 4888 </dev/null
echo "$output"
[ "$output" = "crioctl_host" ]
[ "$output" = "crictl_host" ]
[ "$status" -eq 0 ]
run crioctl ctr stop --id "$ctr_id"
run crictl stop "$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
}
@ -179,7 +180,7 @@ function teardown() {
# make conmon non-executable to cause the sandbox setup to fail after
# networking has been configured
chmod 0644 $CONMON_BINARY
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
run crictl runs "$TESTDATA"/sandbox_config.json
chmod 0755 $CONMON_BINARY
echo "$output"
[ "$status" -ne 0 ]