summaryrefslogtreecommitdiff
path: root/test/podman_run_dns.bats
blob: d37737093bd547f38920a915a763dc15cac05d47 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env bats

load helpers

function teardown() {
    cleanup_test
}

function setup() {
    copy_images
}

@test "test addition of a search domain" {
    run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --rm --dns-search=foobar.com ${ALPINE} cat /etc/resolv.conf | grep foo"
    echo "$output"
    [ "$status" -eq 0 ]
}

@test "test addition of a bad dns server" {
    run ${PODMAN_BINARY} ${PODMAN_OPTIONS} create --dns="foo" ${ALPINE} ls
    echo "$output"
    [ "$status" -ne 0 ]
}

@test "test addition of a dns server" {
    run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --rm --dns='1.2.3.4' ${ALPINE} cat /etc/resolv.conf | grep '1.2.3.4'"
    echo "$output"
    [ "$status" -eq 0 ]
}

@test "test addition of a dns option" {
    run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --rm --dns-opt='debug' ${ALPINE} cat /etc/resolv.conf | grep 'options debug'"
    echo "$output"
    [ "$status" -eq 0 ]
}

@test "test addition of a bad add-host" {
    run ${PODMAN_BINARY} ${PODMAN_OPTIONS} create --add-host="foo:1.2" ${ALPINE} ls
    echo "$output"
    [ "$status" -ne 0 ]
}

@test "test addition of add-host" {
    run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --rm --add-host='foobar:1.1.1.1' ${ALPINE} cat /etc/hosts | grep 'foobar'"
    echo "$output"
    [ "$status" -eq 0 ]
}

@test "test addition of hostname" {
    run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --rm --hostname='foobar' ${ALPINE} cat /etc/hostname | grep foobar"
    echo "$output"
    [ "$status" -eq 0 ]
    run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --rm --hostname='foobar' ${ALPINE} hostname | grep foobar"
    echo "$output"
    [ "$status" -eq 0 ]
}