~ubuntu-branches/ubuntu/vivid/juju-core/vivid-updates

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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env bats

load test_helper

@test "host info esx" {
  run govc host.info
  assert_success
  grep -q Manufacturer: <<<$output

  run govc host.info -host enoent
  assert_failure "Error: host 'enoent' not found"

  for opt in dns ip ipath uuid
  do
    run govc host.info "-host.$opt" enoent
    assert_failure "Error: no such host"
  done

  # avoid hardcoding the esxbox hostname
  local name=$(govc ls '/*/host/*' | grep -v Resources)

  run govc host.info -host $name
  assert_success
  grep -q Manufacturer: <<<$output

  run govc host.info -host ${name##*/}
  assert_success
  grep -q Manufacturer: <<<$output

  run govc host.info -host.ipath $name
  assert_success

  run govc host.info -host.dns $(basename $(dirname $name))
  assert_success

  uuid=$(govc host.info -json | jq -r .HostSystems[].Hardware.SystemInfo.Uuid)
  run govc host.info -host.uuid $uuid
  assert_success
}

@test "host info vc" {
  vcsim_env

  run govc host.info
  assert_success
  grep -q Manufacturer: <<<$output

  run govc host.info -host enoent
  assert_failure "Error: host 'enoent' not found"

  for opt in dns ip ipath uuid
  do
    run govc host.info "-host.$opt" enoent
    assert_failure "Error: no such host"
  done

  local name=$GOVC_HOST

  unset GOVC_HOST
  run govc host.info
  assert_failure "Error: please specify a host"

  run govc host.info -host $name
  assert_success
  grep -q Manufacturer: <<<$output

  run govc host.info -host.ipath $name
  assert_success

  run govc host.info -host.dns $(basename $name)
  assert_success

  uuid=$(govc host.info -host $name -json | jq -r .HostSystems[].Hardware.SystemInfo.Uuid)
  run govc host.info -host.uuid $uuid
  assert_success
}