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

     1  #!/usr/bin/env bats
     2  
     3  load test_helper
     4  
     5  @test "network vm list" {
     6    esx_env
     7  
     8    # make sure there's at least 1 VM so we get a table header to count against
     9    vm=$(new_empty_vm)
    10    govc vm.power -on $vm
    11  
    12    nlines=$(govc host.esxcli network vm list | wc -l)
    13  
    14    vm=$(new_empty_vm)
    15    govc vm.power -on $vm
    16  
    17    xlines=$(govc host.esxcli network vm list | wc -l)
    18  
    19    # test that we see a new row
    20    [ $(($nlines + 1)) -eq $xlines ]
    21  
    22    run govc host.esxcli network vm list enoent
    23    assert_failure
    24  }
    25  
    26  @test "network ip connection list" {
    27    esx_env
    28  
    29    run govc host.esxcli -- network ip connection list -t tcp
    30    assert_success
    31  
    32    # test that we get the expected number of table columns
    33    nf=$(echo "${lines[3]}" | awk '{print NF}')
    34    [ $nf -eq 9 ]
    35  
    36    run govc host.esxcli -- network ip connection list -t enoent
    37    assert_failure
    38  }
    39  
    40  @test "system settings advanced list" {
    41    esx_env
    42  
    43    run govc host.esxcli -- system settings advanced list -o /Net/GuestIPHack
    44    assert_success
    45    assert_line "Path: /Net/GuestIPHack"
    46  
    47    run govc host.esxcli -- system settings advanced list -o /Net/ENOENT
    48    assert_failure
    49  }