File: tag.bats

package info (click to toggle)
golang-github-containers-buildah 1.39.3%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,724 kB
  • sloc: sh: 2,398; makefile: 236; perl: 187; asm: 16; awk: 12; ansic: 1
file content (42 lines) | stat: -rw-r--r-- 1,456 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/env bats

load helpers

@test "tag by name" {
  run_buildah from --pull=false $WITH_POLICY_JSON scratch
  cid=$output
  run_buildah commit $WITH_POLICY_JSON "$cid" scratch-image
  run_buildah 125 inspect --type image tagged-image
  run_buildah tag scratch-image tagged-image tagged-also-image named-image
  run_buildah inspect --type image tagged-image
  run_buildah inspect --type image tagged-also-image
  run_buildah inspect --type image named-image
}

@test "tag by id" {
  _prefetch busybox
  run_buildah pull --quiet $WITH_POLICY_JSON busybox
  id=$output

  # Tag by ID, then make a container from that tag
  run_buildah tag $id busybox1
  run_buildah from busybox1            # gives us busybox1-working-container

  # The from-name should be busybox1, but ID should be same as pulled image
  run_buildah inspect --format '{{ .FromImage }}' busybox1-working-container
  expect_output "localhost/busybox1:latest"
  run_buildah inspect --format '{{ .FromImageID }}' busybox1-working-container
  expect_output $id
}

# Tagging a manifest list should tag manifest list instead of resolved image
@test "tag a manifest list" {
    run_buildah manifest create foobar
    run_buildah manifest add foobar busybox
    run_buildah tag foobar foobar2
    run_buildah manifest inspect foobar
    foobar_inspect=$output
    run_buildah manifest inspect foobar2
    # Output of tagged manifest list should be same
    expect_output "$foobar_inspect"
}