github.com/vmware/govmomi@v0.37.2/govc/test/export.bats (about)

     1  #!/usr/bin/env bats
     2  
     3  load test_helper
     4  
     5  # ovftool -tt=ovf --noSSLVerify --skipManifestCheck "vi://$GOVC_URL/$GOVC_VM" .
     6  @test "export.ovf" {
     7    esx_env
     8  
     9    id=$(new_ttylinux_vm)
    10    dir=$BATS_TMPDIR/$id-export
    11  
    12    run govc export.ovf -vm "$id" "$dir"
    13    assert_success
    14  
    15    run ls "$dir/$id/$id-disk-0.vmdk" "$dir/$id/$id.ovf"
    16    assert_success
    17  
    18    if [ -e "$dir/$id/$id.mf" ] ; then
    19      flunk ".mf was created"
    20    fi
    21  
    22    run govc export.ovf -vm "$id" "$dir"
    23    assert_failure
    24  
    25    run govc export.ovf -i -f -sha 256 -vm "$id" "$dir"
    26    assert_success
    27  
    28    run ls "$dir/$id/$id.mf"
    29    assert_success
    30  
    31    # make it an ova
    32    (cd "$dir/$id" && tar -cf "../$id.ova" .)
    33  
    34    # ovftool --noSSLVerify --skipManifestCheck --name="$GOVC_VM-import" "$GOVC_VM/$GOVC_VM.ovf" "vi://$GOVC_URL"
    35    run govc import.ova -name "${id}-import" "$dir/$id.ova"
    36    assert_success
    37  
    38    rm -rf "$dir"
    39  }