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

« back to all changes in this revision

Viewing changes to src/github.com/juju/govmomi/govc/test/host.bats

  • Committer: Package Import Robot
  • Author(s): Curtis C. Hovey
  • Date: 2015-09-29 19:43:29 UTC
  • mfrom: (47.1.4 wily-proposed)
  • Revision ID: package-import@ubuntu.com-20150929194329-9y496tbic30hc7vp
Tags: 1.24.6-0ubuntu1~15.04.1
Backport of 1.24.6 from wily. (LP: #1500916, #1497087)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env bats
 
2
 
 
3
load test_helper
 
4
 
 
5
@test "host info esx" {
 
6
  run govc host.info
 
7
  assert_success
 
8
  grep -q Manufacturer: <<<$output
 
9
 
 
10
  run govc host.info -host enoent
 
11
  assert_failure "Error: host 'enoent' not found"
 
12
 
 
13
  for opt in dns ip ipath uuid
 
14
  do
 
15
    run govc host.info "-host.$opt" enoent
 
16
    assert_failure "Error: no such host"
 
17
  done
 
18
 
 
19
  # avoid hardcoding the esxbox hostname
 
20
  local name=$(govc ls '/*/host/*' | grep -v Resources)
 
21
 
 
22
  run govc host.info -host $name
 
23
  assert_success
 
24
  grep -q Manufacturer: <<<$output
 
25
 
 
26
  run govc host.info -host ${name##*/}
 
27
  assert_success
 
28
  grep -q Manufacturer: <<<$output
 
29
 
 
30
  run govc host.info -host.ipath $name
 
31
  assert_success
 
32
 
 
33
  run govc host.info -host.dns $(basename $(dirname $name))
 
34
  assert_success
 
35
 
 
36
  uuid=$(govc host.info -json | jq -r .HostSystems[].Hardware.SystemInfo.Uuid)
 
37
  run govc host.info -host.uuid $uuid
 
38
  assert_success
 
39
}
 
40
 
 
41
@test "host info vc" {
 
42
  vcsim_env
 
43
 
 
44
  run govc host.info
 
45
  assert_success
 
46
  grep -q Manufacturer: <<<$output
 
47
 
 
48
  run govc host.info -host enoent
 
49
  assert_failure "Error: host 'enoent' not found"
 
50
 
 
51
  for opt in dns ip ipath uuid
 
52
  do
 
53
    run govc host.info "-host.$opt" enoent
 
54
    assert_failure "Error: no such host"
 
55
  done
 
56
 
 
57
  local name=$GOVC_HOST
 
58
 
 
59
  unset GOVC_HOST
 
60
  run govc host.info
 
61
  assert_failure "Error: please specify a host"
 
62
 
 
63
  run govc host.info -host $name
 
64
  assert_success
 
65
  grep -q Manufacturer: <<<$output
 
66
 
 
67
  run govc host.info -host.ipath $name
 
68
  assert_success
 
69
 
 
70
  run govc host.info -host.dns $(basename $name)
 
71
  assert_success
 
72
 
 
73
  uuid=$(govc host.info -host $name -json | jq -r .HostSystems[].Hardware.SystemInfo.Uuid)
 
74
  run govc host.info -host.uuid $uuid
 
75
  assert_success
 
76
}