Skip to content

Commit

Permalink
Add test to make sure /dev/shm is shared between containers in CRI-O
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
  • Loading branch information
rhatdan committed May 2, 2018
1 parent 4e4f1e2 commit 1f1ee4c
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 0 deletions.
40 changes: 40 additions & 0 deletions test/shm.bats
@@ -0,0 +1,40 @@
#!/usr/bin/env bats

load helpers

function teardown() {
cleanup_test
}

@test "ctr check shared /dev/shm" {
start_crio
run crictl runp "$TESTDATA"/sandbox_config.json
echo "$output"
[ "$status" -eq 0 ]
pod_id="$output"
run crictl create "$pod_id" "$TESTDIR"/container_sleep.json "$TESTDATA"/sandbox_config.json
echo "$output"
[ "$status" -eq 0 ]
ctr_id="$output"
run crictl start "$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
run crictl exec --sync "$ctr_id" "touch /dev/shm/testdata"
echo "$output"
[ "$status" -eq 0 ]

run crictl create "$pod_id" "$TESTDIR"/container_redis.json "$TESTDATA"/sandbox_config.json
echo "$output"
[ "$status" -eq 0 ]
ctr_id="$output"
run crictl start "$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
run crictl exec --sync "$ctr_id" "ls /dev/shm/testdata"
echo "$output"
[ "$status" -eq 0 ]

cleanup_ctrs
cleanup_pods
stop_crio
}
56 changes: 56 additions & 0 deletions test/testdata/container_sleep.json
@@ -0,0 +1,56 @@
{
"metadata": {
"name": "podsandbox-sleep"
},
"image": {
"image": "quay.io/crio/redis:alpine"
},
"command": [
"/bin/sleep", "6000"
],
"args": [
"6000"
],
"working_dir": "/",
"envs": [
{
"key": "PATH",
"value": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
},
{
"key": "TERM",
"value": "xterm"
},
{
"key": "REDIS_VERSION",
"value": "3.2.3"
},
{
"key": "REDIS_DOWNLOAD_URL",
"value": "http://download.redis.io/releases/redis-3.2.3.tar.gz"
},
{
"key": "REDIS_DOWNLOAD_SHA1",
"value": "92d6d93ef2efc91e595c8bf578bf72baff397507"
}
],
"labels": {
"tier": "backend"
},
"annotations": {
"pod": "podsandbox1"
},
"readonly_rootfs": false,
"log_path": "",
"stdin": false,
"stdin_once": false,
"tty": false,
"linux": {
"resources": {
"cpu_period": 10000,
"cpu_quota": 20000,
"cpu_shares": 512,
"oom_score_adj": 30
},
}
}

0 comments on commit 1f1ee4c

Please sign in to comment.