File: registries.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 (32 lines) | stat: -rw-r--r-- 1,021 bytes parent folder | download
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
#!/usr/bin/env bats

load helpers

@test "registries" {
  registrypair() {
    image1=$1
    image2=$2

    # Create a container by specifying the image with one name.
    run_buildah --retry from --quiet --pull=ifmissing $WITH_POLICY_JSON $image1
    cid1=$output

    # Create a container by specifying the image with another name.
    run_buildah --retry from --quiet --pull=ifmissing $WITH_POLICY_JSON $image2
    cid2=$output

    # Get their image IDs.  They should be the same one.
    run_buildah inspect -f "{{.FromImageID}}" $cid1
    iid1=$output
    run_buildah inspect -f "{{.FromImageID}}" $cid2
    expect_output $iid1 "$image2.FromImageID == $image1.FromImageID"

    # Clean up.
    run_buildah rm -a
    run_buildah rmi -a
  }
  # Test with pairs of short and fully-qualified names that should be the same image.
  registrypair busybox           docker.io/busybox
  registrypair busybox           docker.io/library/busybox
  registrypair fedora-minimal:32 registry.fedoraproject.org/fedora-minimal:32
}