summaryrefslogtreecommitdiff
path: root/test/system/140-diff.bats
blob: 9f4a2c0debf0175d65bf4eb434511a719ef86db0 (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
#!/usr/bin/env bats   -*- bats -*-
#
# Tests for podman diff
#

load helpers

@test "podman diff" {
    rand_file=$(random_string 10)
    run_podman run $IMAGE sh -c "touch /$rand_file;rm /etc/services"
    run_podman diff --format json -l

    # Expected results for each type of diff
    declare -A expect=(
        [added]="/$rand_file"
        [changed]="/etc"
        [deleted]="/etc/services"
    )

    for field in ${!expect[@]}; do
        result=$(jq -r -c ".${field}[]" <<<"$output")
        is "$result" "${expect[$field]}" "$field"
    done

    run_podman rm -l
}

# vim: filetype=sh