aboutsummaryrefslogtreecommitdiff
path: root/test/podman_run_memory.bats
blob: 2eaebe1043b18139098c96ee983c443ac6ddf8f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env bats

load helpers

function teardown() {
    cleanup_test
}

function setup() {
    copy_images
}

@test "run memory test" {
    run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --rm --memory=40m ${ALPINE}  cat /sys/fs/cgroup/memory/memory.limit_in_bytes | tr -d '\r'"
    echo $output
    [ "$status" -eq 0 ]
    [ "$output" = 41943040 ]
}

@test "run memory-reservation test" {
    run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --rm --memory-reservation=40m ${ALPINE} cat /sys/fs/cgroup/memory/memory.soft_limit_in_bytes | tr -d '\r'"
    echo "$output"
    [ "$status" -eq 0 ]
    [ "$output" = 41943040 ]
}

@test "run memory-swappiness test" {
    run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --rm --memory-swappiness=15 ${ALPINE} cat /sys/fs/cgroup/memory/memory.swappiness | tr -d '\r'"
    echo "$output"
    [ "$status" -eq 0 ]
    [ "$output" = 15 ]
}

@test "run kernel-memory test" {
    run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --rm --kernel-memory=40m ${ALPINE} cat /sys/fs/cgroup/memory/memory.kmem.limit_in_bytes | tr -d '\r'"
    echo "$output"
    [ "$status" -eq 0 ]
    [ "$output" = 41943040 ]
}