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

     1  #!/usr/bin/env bats
     2  
     3  load test_helper
     4  
     5  @test "logs" {
     6    esx_env
     7  
     8    run govc logs
     9    assert_success
    10    nlogs=${#lines[@]}
    11    # there should be plenty more than 1 line of hostd logs
    12    [ $nlogs -ge 1 ]
    13  
    14    # test -n flag
    15    run govc logs -n $((nlogs - 10))
    16    assert_success
    17    [ ${#lines[@]} -le $nlogs ]
    18  
    19    run govc logs -log vmkernel
    20    assert_success
    21    nlogs=${#lines[@]}
    22    # there should be plenty more than 1 line of vmkernel logs
    23    [ $nlogs -ge 1 ]
    24  
    25    # test > 1 call to BrowseLog()
    26    run govc logs -n 2002
    27    assert_success
    28  
    29    # -host ignored against ESX
    30    run govc logs -host enoent
    31    assert_success
    32  
    33    run govc logs -log enoent
    34    assert_failure
    35  }
    36  
    37  @test "logs.ls" {
    38    esx_env
    39  
    40    run govc logs.ls
    41    assert_success
    42  
    43    # -host ignored against ESX
    44    run govc logs.ls -host enoent
    45    assert_success
    46  }
    47  
    48  @test "logs opid" {
    49    esx_env
    50  
    51    id=$(new_id)
    52  
    53    run env GOVC_OPERATION_ID="$id" govc events
    54    assert_success
    55  
    56    govc logs | grep "$id"
    57  }