File: export.bats

package info (click to toggle)
golang-github-vmware-govmomi 0.24.2-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 11,848 kB
  • sloc: sh: 2,285; lisp: 1,560; ruby: 948; xml: 139; makefile: 54
file content (39 lines) | stat: -rwxr-xr-x 851 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/env bats

load test_helper

# ovftool -tt=ovf --noSSLVerify --skipManifestCheck "vi://$GOVC_URL/$GOVC_VM" .
@test "export.ovf" {
  esx_env

  id=$(new_ttylinux_vm)
  dir=$BATS_TMPDIR/$id-export

  run govc export.ovf -vm "$id" "$dir"
  assert_success

  run ls "$dir/$id/$id-disk-0.vmdk" "$dir/$id/$id.ovf"
  assert_success

  if [ -e "$dir/$id/$id.mf" ] ; then
    flunk ".mf was created"
  fi

  run govc export.ovf -vm "$id" "$dir"
  assert_failure

  run govc export.ovf -i -f -sha 256 -vm "$id" "$dir"
  assert_success

  run ls "$dir/$id/$id.mf"
  assert_success

  # make it an ova
  (cd "$dir/$id" && tar -cf "../$id.ova" .)

  # ovftool --noSSLVerify --skipManifestCheck --name="$GOVC_VM-import" "$GOVC_VM/$GOVC_VM.ovf" "vi://$GOVC_URL"
  run govc import.ova -name "${id}-import" "$dir/$id.ova"
  assert_success

  rm -rf "$dir"
}