github.com/containers/podman/v5@v5.1.0-rc1/test/farm/001-farm.bats (about)

     1  #!/usr/bin/env bats
     2  #
     3  # Tests of podman farm commands
     4  #
     5  
     6  load helpers.bash
     7  
     8  @test "farm - check farm has been created" {
     9      run_podman farm ls
    10      assert "$output" =~ $FARMNAME
    11      assert "$output" =~ "test-node"
    12  }
    13  
    14  @test "farm - build on local only" {
    15      iname="test-image-1"
    16      empty_farm="empty-farm"
    17      # create an empty farm
    18      run_podman farm create $empty_farm
    19      run_podman farm build --farm $empty_farm --authfile $AUTHFILE --tls-verify=false -t $REGISTRY/$iname $FARM_TMPDIR
    20      assert "$output" =~ "Local builder ready"
    21  
    22      # get the system architecture
    23      run_podman info --format '{{.Host.Arch}}'
    24      ARCH=$output
    25      # inspect manifest list built and saved in local containers-storage
    26      run_podman manifest inspect $iname
    27      assert "$output" =~ $ARCH
    28  
    29      echo "# skopeo inspect ..."
    30      run skopeo inspect "$@" --tls-verify=false --authfile $AUTHFILE docker://$REGISTRY/$iname
    31      echo "$output"
    32      is "$status" "0" "skopeo inspect - exit status"
    33  
    34      # FIXME-someday: why do we need the prune?
    35      run_podman manifest rm $iname
    36      run_podman image prune -f
    37  }
    38  
    39  @test "farm - build on farm node only with --cleanup" {
    40      iname="test-image-2"
    41      run_podman farm build --cleanup --local=false --authfile $AUTHFILE --tls-verify=false -t $REGISTRY/$iname $FARM_TMPDIR
    42      assert "$output" =~ "Farm \"$FARMNAME\" ready"
    43      # get the system architecture
    44      run_podman info --format '{{.Host.Arch}}'
    45      ARCH=$output
    46      # inspect manifest list built and saved in local containers-storage
    47      run_podman manifest inspect $iname
    48      assert "$output" =~ $ARCH
    49  
    50      echo "# skopeo inspect ..."
    51      run skopeo inspect "$@" --tls-verify=false --authfile $AUTHFILE docker://$REGISTRY/$iname
    52      echo "$output"
    53      is "$status" "0" "skopeo inspect - exit status"
    54  
    55      # see if we can ssh into node to check the image was cleaned up
    56      run ssh $ROOTLESS_USER@localhost podman images --filter dangling=true --noheading
    57      assert "$output" = "" "podman images on remote host"
    58  
    59      # check that no image was built locally
    60      run_podman images --filter dangling=true --noheading
    61      assert "$output" = "" "podman images on local host"
    62  
    63      run_podman manifest rm $iname
    64      run_podman image prune -f
    65  }
    66  
    67  @test "farm - build on farm node and local" {
    68      iname="test-image-3"
    69      run_podman farm build --authfile $AUTHFILE --tls-verify=false -t $REGISTRY/$iname $FARM_TMPDIR
    70      assert "$output" =~ "Farm \"$FARMNAME\" ready"
    71  
    72      # get the system architecture
    73      run_podman info --format '{{.Host.Arch}}'
    74      ARCH=$output
    75      # inspect manifest list built and saved
    76      run_podman manifest inspect $iname
    77      assert "$output" =~ $ARCH
    78  
    79      echo "# skopeo inspect ..."
    80      run skopeo inspect "$@" --tls-verify=false --authfile $AUTHFILE docker://$REGISTRY/$iname
    81      echo "$output"
    82      is "$status" "0" "skopeo inspect - exit status"
    83  
    84      run_podman manifest rm $iname
    85      run_podman image prune -f
    86  }
    87  
    88  @test "farm - build on farm node only with registries.conf" {
    89      cat >$PODMAN_TMPDIR/registries.conf <<EOF
    90  [[registry]]
    91  location="$REGISTRY"
    92  insecure=true
    93  EOF
    94  
    95      iname="test-image-4"
    96      CONTAINERS_REGISTRIES_CONF="$PODMAN_TMPDIR/registries.conf" run_podman farm build --authfile $AUTHFILE -t $REGISTRY/$iname $FARM_TMPDIR
    97      assert "$output" =~ "Farm \"$FARMNAME\" ready"
    98  
    99      # get the system architecture
   100      CONTAINERS_REGISTRIES_CONF="$PODMAN_TMPDIR/registries.conf" run_podman info --format '{{.Host.Arch}}'
   101      ARCH=$output
   102      # inspect manifest list built and saved
   103      CONTAINERS_REGISTRIES_CONF="$PODMAN_TMPDIR/registries.conf" run_podman manifest inspect $iname
   104      assert "$output" =~ $ARCH
   105  
   106      echo "# skopeo inspect ..."
   107      run skopeo inspect "$@" --tls-verify=false --authfile $AUTHFILE docker://$REGISTRY/$iname
   108      echo "$output"
   109      is "$status" "0" "skopeo inspect - exit status"
   110  
   111      run_podman manifest rm $iname
   112      run_podman image prune -f
   113  }
   114  
   115  # Test out podman-remote
   116  
   117  @test "farm - build on farm node only (podman-remote)" {
   118      iname="test-image-5"
   119      # ManifestAdd only
   120      echo "Running test with ManifestAdd only..."
   121      run_podman --remote farm build --authfile $AUTHFILE --tls-verify=false -t $REGISTRY/$iname $FARM_TMPDIR
   122      assert "$output" =~ "Farm \"$FARMNAME\" ready"
   123  
   124      # ManifestListClear and ManifestAdd
   125      echo "Running test with ManifestListClear and ManifestAdd..."
   126      run_podman --remote farm build --authfile $AUTHFILE --tls-verify=false -t $REGISTRY/$iname $FARM_TMPDIR
   127      assert "$output" =~ "Farm \"$FARMNAME\" ready"
   128  
   129      # get the system architecture
   130      run_podman --remote info --format '{{.Host.Arch}}'
   131      ARCH=$output
   132      # inspect manifest list built and saved
   133      run_podman manifest inspect $iname
   134      assert "$output" =~ $ARCH
   135  
   136      echo "# skopeo inspect ..."
   137      run skopeo inspect "$@" --tls-verify=false --authfile $AUTHFILE docker://$REGISTRY/$iname
   138      echo "$output"
   139      is "$status" "0" "skopeo inspect - exit status"
   140  
   141      run_podman manifest rm $iname
   142      run_podman image prune -f
   143  }