podman

Форк
0
/
020-tag.bats 
54 строки · 1.5 Кб
1
#!/usr/bin/env bats
2

3
load helpers
4

5
# helper function for "podman tag/untag" test
6
function _tag_and_check() {
7
    local tag_as="$1"
8
    local check_as="$2"
9

10
    run_podman tag $IMAGE $tag_as
11
    run_podman image exists $check_as
12
    run_podman untag $IMAGE $check_as
13
    run_podman 1 image exists $check_as
14
}
15

16
@test "podman tag/untag" {
17
    # Test a fully-qualified image reference.
18
    _tag_and_check registry.com/image:latest registry.com/image:latest
19

20
    # Test a reference without tag and make sure ":latest" is appended.
21
    _tag_and_check registry.com/image registry.com/image:latest
22

23
    # Test a tagged short image and make sure "localhost/" is prepended.
24
    _tag_and_check image:latest localhost/image:latest
25

26
    # Test a short image without tag and make sure "localhost/" is
27
    # prepended and ":latest" is appended.
28
    _tag_and_check image localhost/image:latest
29

30
    # Test error case.
31
    run_podman 125 untag $IMAGE registry.com/foo:bar
32
    is "$output" "Error: registry.com/foo:bar: tag not known"
33
}
34

35
@test "podman untag all" {
36
    # First get the image ID
37
    run_podman inspect --format '{{.ID}}' $IMAGE
38
    iid=$output
39

40
    # Add a couple of tags
41
    run_podman tag $IMAGE registry.com/1:latest registry.com/2:latest registry.com/3:latest
42

43
    # Untag with arguments to for all tags to be removed
44
    run_podman untag $iid
45

46
    # Now make sure all tags are removed
47
    run_podman image inspect $iid --format "{{.RepoTags}}"
48
    is "$output" "\[\]" "untag by ID leaves empty set of tags"
49

50
    # Restore image
51
    run_podman tag $iid $IMAGE
52
}
53

54
# vim: filetype=sh
55

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.