beaker-vmware 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/README.md +8 -6
- data/acceptance/config/nodes/test-nodes.yml +2 -2
- data/beaker-vmware.gemspec +6 -1
- data/docs/acceptance_setup.md +104 -0
- data/docs/fusion_static_ip.md +187 -0
- data/lib/beaker-vmware/version.rb +1 -1
- data/lib/beaker/hypervisor/vsphere_helper.rb +4 -17
- data/spec/beaker/hypervisor/vsphere_helper_spec.rb +2 -2
- data/vmware_fusion.md +1 -1
- data/vsphere.md +15 -12
- metadata +47 -31
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
ZGE5MGIxYTE3OTU4YmZhNTU1MjZiNjFmN2M2YzRlMjM1ODE2MWMxMw==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4f19ed426ac9cf21afe29cf529e14f7306d5762a
|
4
|
+
data.tar.gz: 053c1d47f6a47b3bcbeeaeaf2dec5bb963c88d79
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
MjQ4MzgzNTA2YjBjY2QzYzQ3ZjJmZTBiMjZmMDIwMDA4NmQzNTMyZmRlOGE2
|
11
|
-
YWVjOWFjZGFlZGI2ODVhNTgyYzdlNDkzZGQwZmYyYTExN2M4YmQ=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
NDhiZWVhYmE1MDAxYjY0MDYzNzViYjY2NDk5ZDZmOTg1MjRiMDJkOTEyNGVk
|
14
|
-
YzQ2NDczYTAxM2QwNjQ0YjRkMWZmZTAxZDMzMmQwZjg5MGFjODI1OTdmYTUw
|
15
|
-
ODNlM2E1Y2Q2NjVkM2UzMzg0N2Y4MTUwY2Q3NzZlMDJkNzA4ZGI=
|
6
|
+
metadata.gz: 0e0d82ec7c55e45db89b44bfa261222cf0adfc1fc003d078ac3c7354ef98e0bcc0e0bb09cd2bedb36529aafd196b420dfe795620f8593160723c0c78f89c3c6b
|
7
|
+
data.tar.gz: b79073eff11346ecc27c86f88e50cc1be0974fbdd138cad4ec9c7402714fc2f50ef498e319c67d196c21f9591019f6741890b513e6c4725a7967c7a5c2e1f7eb
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@ Beaker library to use vmware fusion hypervisor
|
|
4
4
|
|
5
5
|
# How to use this wizardry
|
6
6
|
|
7
|
-
This gem
|
7
|
+
This gem allows you to use hosts with [vmware_fusion](vmware_fusion.md) and [vsphere](vsphere.md) hypervisor with [beaker](https://github.com/puppetlabs/beaker).
|
8
8
|
|
9
9
|
### Right Now? (beaker 3.x)
|
10
10
|
|
@@ -20,15 +20,17 @@ next to beaker itself.
|
|
20
20
|
# Spec tests
|
21
21
|
|
22
22
|
Spec test live under the `spec` folder. There are the default rake task and therefore can run with a simple command:
|
23
|
-
|
24
|
-
|
23
|
+
|
24
|
+
```console
|
25
|
+
$ bundle exec rake test:spec
|
25
26
|
```
|
26
27
|
|
27
28
|
# Acceptance tests
|
28
29
|
|
29
|
-
We run beaker's base acceptance tests with this library to see if the hypervisor is working with beaker.
|
30
|
-
|
31
|
-
|
30
|
+
We run beaker's base acceptance tests with this library to see if the hypervisor is working with beaker. You can run the acceptance tests locally; see [Acceptance Setup](/docs/acceptance_setup.md). Once that's setup, there is a simple rake task to invoke acceptance test for the library:
|
31
|
+
|
32
|
+
```console
|
33
|
+
$ bundle exec rake test:acceptance
|
32
34
|
```
|
33
35
|
|
34
36
|
# Contributing
|
@@ -1,5 +1,5 @@
|
|
1
1
|
HOSTS:
|
2
|
-
ubuntu.local:
|
2
|
+
beaker-ubuntu.local:
|
3
3
|
roles:
|
4
4
|
- master
|
5
5
|
- agent
|
@@ -10,7 +10,7 @@ HOSTS:
|
|
10
10
|
vmname: ubuntu-1604-64
|
11
11
|
hypervisor: fusion
|
12
12
|
snapshot: clear-keys
|
13
|
-
ubuntu2.local:
|
13
|
+
beaker-ubuntu2.local:
|
14
14
|
roles:
|
15
15
|
- agent
|
16
16
|
platform: ubuntu-1604-amd64
|
data/beaker-vmware.gemspec
CHANGED
@@ -20,10 +20,15 @@ Gem::Specification.new do |s|
|
|
20
20
|
# Testing dependencies
|
21
21
|
s.add_development_dependency 'rspec', '~> 3.0'
|
22
22
|
s.add_development_dependency 'rspec-its'
|
23
|
-
|
23
|
+
if RUBY_VERSION < "2.3"
|
24
|
+
s.add_development_dependency 'fakefs', '~> 0.6', '< 0.14'
|
25
|
+
else
|
26
|
+
s.add_development_dependency 'fakefs', '~> 0.6'
|
27
|
+
end
|
24
28
|
s.add_development_dependency 'rake', '~> 10.1'
|
25
29
|
s.add_development_dependency 'simplecov'
|
26
30
|
s.add_development_dependency 'pry', '~> 0.10'
|
31
|
+
s.add_development_dependency 'beaker', '~> 3.0'
|
27
32
|
|
28
33
|
# Documentation dependencies
|
29
34
|
s.add_development_dependency 'yard'
|
@@ -0,0 +1,104 @@
|
|
1
|
+
Setting up a local environment for running beaker-vmware's acceptance tests is as follows. This is just Beaker's core acceptance tests run against local VMWare Fusion VMs.
|
2
|
+
|
3
|
+
# Configure Acceptance Testing VMs
|
4
|
+
|
5
|
+
First, provision a base VM to clone for testing. Currently, tests are confirmed to pass on a vanilla Ubuntu 16.04 installation. However, any host supported by Beaker should be suitable. There are no prerequisite libraries and the only special configuration is to enable passwordless SSH access for root.
|
6
|
+
|
7
|
+
## Provision a Base VM
|
8
|
+
|
9
|
+
These instructions cover provisioning a Ubuntu 16.04 VM:
|
10
|
+
|
11
|
+
1. Download [a Ubuntu 16.04 64-bit ISO](http://releases.ubuntu.com/16.04/).
|
12
|
+
2. Create a new VMWare Virtual Machine for it, named `beaker-ubuntu-1604-64`.
|
13
|
+
3. Run the OS installation. Default settings should be adequate. Name the main user whatever you want; testing relies on passwordless root login so this is unimportant.
|
14
|
+
4. Install and configure OpenSSH on the VM:
|
15
|
+
~~~console
|
16
|
+
$ sudo su -
|
17
|
+
root@host $ apt-get install openssh-server
|
18
|
+
root@host $ nano /etc/ssh/sshd_config
|
19
|
+
# Add/uncomment/modify the following lines:
|
20
|
+
PasswordAuthentication yes
|
21
|
+
PermitRootLogin without-password
|
22
|
+
RSAAuthentication yes
|
23
|
+
PubkeyAuthentication yes
|
24
|
+
root@host $ service ssh restart
|
25
|
+
~~~
|
26
|
+
5. Disable automatic package updates so they don't block test running. This can be accomplished easily from the UI: System Settings > Software & Updates > Updates > Automatically check for updates: "Never".
|
27
|
+
|
28
|
+
## Configure Testing VMs
|
29
|
+
|
30
|
+
These instructions cover provisioning the two testing VMs with a new public key for SSH access. We need two instances of the base VM, `beaker-ubuntu-1604-64` and `beaker-ubuntu-1604-64-2`:
|
31
|
+
|
32
|
+
1. You can use the base VM configuration as the first SUT to save space.
|
33
|
+
2. Configure a static IP for the VM. See [fusion_static_ip.md](fusion_static_ip.md).
|
34
|
+
3. Add an entry in /etc/hosts: `<static ip> beaker-ubuntu.local`.
|
35
|
+
4. Set Up password-less SSH access:
|
36
|
+
- Generate a new SSH key *without a passphrase*:
|
37
|
+
~~~console
|
38
|
+
$ ssh-keygen -t rsa -b 4096 -C "you@example.com"
|
39
|
+
# Give this a descriptive name, e.g. "id_rsa-beaker-ubuntu"
|
40
|
+
# Make sure to leave passphrase blank (just hit return at prompt)
|
41
|
+
~~~
|
42
|
+
- Add it to your local keychain:
|
43
|
+
~~~console
|
44
|
+
$ ssh-add -i ~/.ssh/id_rsa-beaker-ubuntu
|
45
|
+
~~~
|
46
|
+
- Add your SSH key to the VM's authorized keys:
|
47
|
+
~~~console
|
48
|
+
$ ssh-copy-id puppetlabs@beaker-ubuntu.local
|
49
|
+
$ ssh puppetlabs@beaker-ubuntu.local
|
50
|
+
~~~
|
51
|
+
- And then copy to root's `authorized_keys`:
|
52
|
+
~~~console
|
53
|
+
$ ssh puppetlabs@beaker-ubuntu.local
|
54
|
+
puppetlabs@beaker-ubuntu.local $ sudo cp ~/.ssh/authorized_keys /root/.ssh/authorized_keys
|
55
|
+
~~~
|
56
|
+
- Ensure that you can SSH in without password, e.g.:
|
57
|
+
~~~console
|
58
|
+
$ ssh root@beaker-ubuntu.local
|
59
|
+
~~~
|
60
|
+
5. Create a new snapshot (of the running VM) in VMWare Fusion: with the VM selected, Virtual Machine > Snapshots... > Take Snapshot (Cmd-Shift-S). Name this new snapshot `clear-keys`. This snapshot name is used in [acceptance/config/nodes/test-nodes.yml](/acceptance/config/nodes/test-nodes.yml); when beaker provisions a VMWare host it restores it to a specified snapshot.
|
61
|
+
6. Clone the second testing VM from this snapshot.
|
62
|
+
1. Right Click > "Create Full Clone" named `beaker-ubuntu-1604-64-2`.
|
63
|
+
2. Resume the clone and note the MAC address: VM > Settings > Network > Advanced. Make sure it's different from the original.
|
64
|
+
3. Configure a new static IP for this VM. See [fusion_static_ip.md](fusion_static_ip.md) again.
|
65
|
+
4. Add another entry in `/etc/hosts`: `<static ip> beaker-ubuntu2.local`.
|
66
|
+
5. Create a new snapshot named `clear-keys`.
|
67
|
+
|
68
|
+
# Configure Fission
|
69
|
+
|
70
|
+
Although originally written for VMWare Fusion 3.x, the Ruby Gem Fission which we use to configure VMWare Fusion VMs appears to work just fine with 10.x. All that is required is changing the local configuration to point to the CLI tools and VM datastore. Create `~/.fissionrc`:
|
71
|
+
|
72
|
+
~~~yaml
|
73
|
+
vm_dir: "/Users/<your user name>/Documents/Virtual Machines.localized/" # or whereved you've decided to store your `.vmwarevm` files
|
74
|
+
vmrun_bin: "/Applications/VMware Fusion.app/Contents/Library/vmrun"
|
75
|
+
~~~
|
76
|
+
|
77
|
+
# DHCP/VMnet Issues
|
78
|
+
|
79
|
+
If you have problems with DHCP leases not being issued automatically when a VM is booted or resumed, and manually restarting vmnet makes it work, follow debugging directions in [Debugging](fusion_static_ip.md#debugging).
|
80
|
+
|
81
|
+
# Test Failures
|
82
|
+
|
83
|
+
If you get test failures related to package installation, e.g.:
|
84
|
+
|
85
|
+
~~~
|
86
|
+
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
|
87
|
+
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?>
|
88
|
+
~~~
|
89
|
+
|
90
|
+
It's probably the VM's automatic upgrades running. Log in and check:
|
91
|
+
|
92
|
+
~~~console
|
93
|
+
$ sudo lsof /var/lib/dpkg/lock
|
94
|
+
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
|
95
|
+
unattende 2441 root 4uW REG 8,1 0 671664 /var/lib/dpkg/lock
|
96
|
+
$ ps -p 2441 -o command=
|
97
|
+
/usr/bin/python3 /usr/bin/unattended-upgrade # yep, autoupdate
|
98
|
+
~~~
|
99
|
+
|
100
|
+
Turn those off if you haven't already; they'll get run on the first resume during every update period (default: daily) and cause your tests to fail. Don't forget to update the `clear-keys` snapshot after you make configuration changes in the testing VMs.
|
101
|
+
|
102
|
+
# Helpful References
|
103
|
+
|
104
|
+
- Passwordless root ssh on Ubuntu: https://askubuntu.com/a/115323
|
@@ -0,0 +1,187 @@
|
|
1
|
+
# Setting Static IP on VMWare Fusion 10
|
2
|
+
|
3
|
+
> Note: this guide last updated 20 June 2018, VMWare Fusion Professional Version 10.1.2 (8502123) on macOS High Sierra 10.13.5 (17F77)
|
4
|
+
|
5
|
+
> Based on: http://henokmikre.com/blog/2015/09/vmware-static-ip
|
6
|
+
|
7
|
+
Beaker expects hosts to be accessible by hostname with passwordless root access via SSH. This guide covers setting a static IP and local hostname on a VMWare Fusion guest.
|
8
|
+
|
9
|
+
## Basics
|
10
|
+
|
11
|
+
VMWare Fusion network configuration files are stored in:
|
12
|
+
|
13
|
+
~~~
|
14
|
+
/Library/Preferences/VMware Fusion/
|
15
|
+
~~~
|
16
|
+
|
17
|
+
These configurations are divided into folders by virtual networking device. In the base configuration, without any custom networking devices defined, the directory structure looks like this:
|
18
|
+
|
19
|
+
~~~
|
20
|
+
VMware Fusion/
|
21
|
+
thnuclnt/ # virtual print server configuration
|
22
|
+
.thnumod
|
23
|
+
manifest
|
24
|
+
thnuclnt
|
25
|
+
thnuclnt.conf
|
26
|
+
thnuclnt.convs
|
27
|
+
thnuclnt.types
|
28
|
+
thnucups
|
29
|
+
thnusetup.sh
|
30
|
+
vmnet1/
|
31
|
+
dhcpd.conf # dhcp daemon configuration
|
32
|
+
vmnet8/
|
33
|
+
dhcpd.conf # dhcp daemon configuration
|
34
|
+
nat.conf # nat configuration
|
35
|
+
nat.mac # list of used VM mac addresses
|
36
|
+
lastLocationUsed # path to "VMWare Fusion.app" last run
|
37
|
+
license-fusion-100-e4-201704 # license file
|
38
|
+
networking # network configuration check file
|
39
|
+
~~~
|
40
|
+
|
41
|
+
Virtual networks are called `vmnet<num>`:
|
42
|
+
|
43
|
+
`vmnet1`:
|
44
|
+
- is the default private (host-only) network
|
45
|
+
- called "Private to my Mac" in VM > Network configuration
|
46
|
+
- DHCP range 172.16.233.128 to 172.16.233.254
|
47
|
+
|
48
|
+
`vmnet8`:
|
49
|
+
- is the default public (NAT-enabled) network
|
50
|
+
- called "Share with my Mac"
|
51
|
+
- DHCP range 192.168.176.128 192.168.176.254
|
52
|
+
|
53
|
+
Every VMWare-generated `dhcpd.conf` file is auto-generated and contains a clearly labeled section for private use, with instructions for custom configuration. Here's an example:
|
54
|
+
|
55
|
+
~~~
|
56
|
+
# Configuration file for ISC 2.0 vmnet-dhcpd operating on vmnet8.
|
57
|
+
#
|
58
|
+
# This file was automatically generated by the VMware configuration program.
|
59
|
+
# See Instructions below if you want to modify it.
|
60
|
+
#
|
61
|
+
# We set domain-name-servers to make some DHCP clients happy
|
62
|
+
# (dhclient as configured in SuSE, TurboLinux, etc.).
|
63
|
+
# We also supply a domain name to make pump (Red Hat 6.x) happy.
|
64
|
+
#
|
65
|
+
|
66
|
+
|
67
|
+
###### VMNET DHCP Configuration. Start of "DO NOT MODIFY SECTION" #####
|
68
|
+
# Modification Instructions: This section of the configuration file contains
|
69
|
+
# information generated by the configuration program. Do not modify this
|
70
|
+
# section.
|
71
|
+
# You are free to modify everything else. Also, this section must start
|
72
|
+
# on a new line
|
73
|
+
# This file will get backed up with a different name in the same directory
|
74
|
+
# if this section is edited and you try to configure DHCP again.
|
75
|
+
|
76
|
+
# Written at: 06/20/2018 14:34:59
|
77
|
+
allow unknown-clients;
|
78
|
+
default-lease-time 1800; # default is 30 minutes
|
79
|
+
max-lease-time 7200; # default is 2 hours
|
80
|
+
|
81
|
+
subnet 192.168.176.0 netmask 255.255.255.0 {
|
82
|
+
range 192.168.176.128 192.168.176.254;
|
83
|
+
option broadcast-address 192.168.176.255;
|
84
|
+
option domain-name-servers 192.168.176.2;
|
85
|
+
option domain-name localdomain;
|
86
|
+
default-lease-time 1800; # default is 30 minutes
|
87
|
+
max-lease-time 7200; # default is 2 hours
|
88
|
+
option netbios-name-servers 192.168.176.2;
|
89
|
+
option routers 192.168.176.2;
|
90
|
+
}
|
91
|
+
host vmnet8 {
|
92
|
+
hardware ethernet 00:50:56:C0:00:08;
|
93
|
+
fixed-address 192.168.176.1;
|
94
|
+
option domain-name-servers 0.0.0.0;
|
95
|
+
option domain-name "";
|
96
|
+
option routers 0.0.0.0;
|
97
|
+
}
|
98
|
+
####### VMNET DHCP Configuration. End of "DO NOT MODIFY SECTION" #######
|
99
|
+
~~~
|
100
|
+
|
101
|
+
## Modifying `dhcpd.conf`
|
102
|
+
|
103
|
+
These configuration files can contain customizations. All custom configuration lines should be written *outside* of the clearly labeled private section. It's not clear if they can safely be placed above this section, so I recommend only placing them below it.
|
104
|
+
|
105
|
+
You shouldn't try to override the `subnet` configuration directive. See [Modifying the DHCP settings of vmnet1 and vmnet8 in Fusion (1026510)
|
106
|
+
](https://kb.vmware.com/s/article/1026510). Tl;DR: change settings in the private area (e.g. netmask and subnet) by modifying `networking`.
|
107
|
+
|
108
|
+
You can, however, provide new `host` directives. This is what we want to do. As far as I can tell, the syntax is like such:
|
109
|
+
|
110
|
+
~~~
|
111
|
+
host <host id> {
|
112
|
+
<command with args>;
|
113
|
+
}
|
114
|
+
~~~
|
115
|
+
|
116
|
+
Known configuration directives:
|
117
|
+
|
118
|
+
~~~
|
119
|
+
hardware ethernet <mac address>;
|
120
|
+
fixed-address <ipv4 address>;
|
121
|
+
option domain-name-servers <ipv4 address>;
|
122
|
+
option domain-name "string";
|
123
|
+
option routers <ipv4 address>;
|
124
|
+
~~~
|
125
|
+
|
126
|
+
## Setting a Static IP for a VM
|
127
|
+
|
128
|
+
1. Gather VM configuration information
|
129
|
+
1. Hostname: VM > Settings > General > name. I don't know what restrictions there are on VM names, so recommend the safe approach of ensuring that you set the VM name only once, upon creation, and only use safe characters like `[a-z0-9\-]`. If you have special characters or spaces, it may be possible to quote the hostname but I haven't tested that. According to [this VMWare forum post](https://communities.vmware.com/message/2730360#2730360), spaces should be stripped. E.g. "Windows 8" becomes "Windows8".
|
130
|
+
2. Virtual network name: VM > Settings > Network. "Share with my Mac" is `vmnet8`, "Private to my Mac" is `vmnet1`.
|
131
|
+
3. MAC address: VM > Settings > Network > Advanced
|
132
|
+
3. Edit the appropriate `dhcpd.conf` in `/Library/Preferences/VMware Fusion/<virtual network name>/dhcpd.conf`. Take note of the line that looks like (last checked: line 27):
|
133
|
+
~~~
|
134
|
+
range 192.168.176.128 192.168.176.254;
|
135
|
+
~~~
|
136
|
+
As this specifies the DHCP reservation range. We must select an IP **outside** of this range. Add the following:
|
137
|
+
~~~
|
138
|
+
host <hostname> {
|
139
|
+
hardware ethernet <host mac>;
|
140
|
+
fixed-address <static ip>;
|
141
|
+
}
|
142
|
+
~~~
|
143
|
+
4. Regenerate the configuration files and restart the virtual networking stack:
|
144
|
+
~~~console
|
145
|
+
$ sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cli --configure
|
146
|
+
$ sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cli --stop
|
147
|
+
$ sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cli --start
|
148
|
+
~~~
|
149
|
+
Note: pretty sure VMWare and even the target VM can be running while you do this.
|
150
|
+
|
151
|
+
Complete example, to set fixed IP address of `192.168.176.127` on host `ubuntu-1604-64` with MAC `192.168.176.127`:
|
152
|
+
|
153
|
+
~~~console
|
154
|
+
$ sudo tee -a "/Library/Preferences/VMware Fusion/vmnet8/dhcpd.conf" <<EOF
|
155
|
+
host ubuntu-1604-64 {
|
156
|
+
hardware ethernet 00:0C:29:C5:28:82;
|
157
|
+
fixed-address 192.168.176.127;
|
158
|
+
}
|
159
|
+
EOF
|
160
|
+
$ sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cli --configure
|
161
|
+
$ sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cli --stop
|
162
|
+
$ sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cli --start
|
163
|
+
~~~
|
164
|
+
|
165
|
+
### Debugging
|
166
|
+
|
167
|
+
If your VMs don't get DHCP leases and VMWare Fusion > Preferences > Network settings is greyed out (and you don't want to restart your machine).
|
168
|
+
- Quit Fusion
|
169
|
+
- Stop networking from the CLI
|
170
|
+
- Look for any leftover processes to kill
|
171
|
+
|
172
|
+
~~~console
|
173
|
+
# Quit VMWare Fusion from the GUI first, then:
|
174
|
+
$ sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cli --stop
|
175
|
+
$ ps aux | grep vm
|
176
|
+
root 90722 0.0 0.0 4377632 3096 ?? Ss 2:15PM 0:00.44 /Library/PrivilegedHelperTools/com.vmware.KextControlHelper
|
177
|
+
root 90721 0.0 0.0 4377632 3140 ?? Ss 2:15PM 0:00.22 /Library/PrivilegedHelperTools/com.vmware.VMMonHelper
|
178
|
+
root 90589 0.0 0.0 4387172 840 ?? S 2:15PM 0:00.06 /Applications/VMware Fusion.app/Contents/Library/vmnet-bridge
|
179
|
+
dakota.schneider 11615 0.0 0.0 4267768 1024 s011 S+ 10:30AM 0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn vm
|
180
|
+
$ sudo kill -9 90589
|
181
|
+
~~~
|
182
|
+
|
183
|
+
Now restart Fusion. If you can access VMWare Fusion > Preferences > Network list (it's not greyed out), then your VMs should get DHCP without having to manually restart vmnet after boot or resume.
|
184
|
+
|
185
|
+
## Edit `/etc/hosts`
|
186
|
+
|
187
|
+
The acceptance tests rely on using hostnames. We need one machine `beaker-ubuntu.local` and one `beaker-ubuntu2.local`, or whatever matches the hostnames in `acceptance/config/nodes/test-nodes.yml`.
|
@@ -12,25 +12,12 @@ class VsphereHelper
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.load_config(dot_fog = '.fog')
|
15
|
-
|
16
|
-
# (ie, someplace besides my made up conf)
|
17
|
-
vsphere_credentials = nil
|
18
|
-
if File.exists?( dot_fog )
|
19
|
-
vsphere_credentials = load_fog_credentials(dot_fog)
|
20
|
-
else
|
21
|
-
raise ArgumentError, ".fog file '#{dot_fog}' does not exist"
|
22
|
-
end
|
23
|
-
|
24
|
-
return vsphere_credentials
|
25
|
-
end
|
26
|
-
|
27
|
-
def self.load_fog_credentials(dot_fog = '.fog')
|
28
|
-
vInfo = YAML.load_file( dot_fog )
|
15
|
+
default = get_fog_credentials(dot_fog)
|
29
16
|
|
30
17
|
vsphere_credentials = {}
|
31
|
-
vsphere_credentials[:server] =
|
32
|
-
vsphere_credentials[:user] =
|
33
|
-
vsphere_credentials[:pass] =
|
18
|
+
vsphere_credentials[:server] = default[:vsphere_server]
|
19
|
+
vsphere_credentials[:user] = default[:vsphere_username]
|
20
|
+
vsphere_credentials[:pass] = default[:vsphere_password]
|
34
21
|
|
35
22
|
return vsphere_credentials
|
36
23
|
end
|
@@ -22,7 +22,7 @@ module Beaker
|
|
22
22
|
describe "#load_config" do
|
23
23
|
|
24
24
|
it 'can load a .fog file' do
|
25
|
-
allow( File ).to receive( :
|
25
|
+
allow( File ).to receive( :exist? ).and_return( true )
|
26
26
|
allow( YAML ).to receive( :load_file ).and_return( fog_file_contents )
|
27
27
|
|
28
28
|
expect( VsphereHelper.load_config ).to be === vInfo
|
@@ -30,7 +30,7 @@ module Beaker
|
|
30
30
|
end
|
31
31
|
|
32
32
|
it 'raises an error when the .fog file is missing' do
|
33
|
-
allow( File ).to receive( :
|
33
|
+
allow( File ).to receive( :exist? ).and_return( false )
|
34
34
|
|
35
35
|
expect{ VsphereHelper.load_config }.to raise_error( ArgumentError )
|
36
36
|
|
data/vmware_fusion.md
CHANGED
@@ -9,7 +9,7 @@ You can then use the following arguments in the node configuration:
|
|
9
9
|
- `hypervisor: fusion` tells us to enable this feature for this host. This is required.
|
10
10
|
- `snapshot: <name>`, where <name> is the snapshot name to revert to. This is required.
|
11
11
|
|
12
|
-
We'll try and match up the hostname with a VM of the same name. Note that the VM is expected to be pre-configured for running acceptance tests
|
12
|
+
We'll try and match up the hostname with a VM of the same name. Note that the VM is expected to be pre-configured for running acceptance tests: a vanilla OS install with internet access and password-less SSH access for root is all that is required.
|
13
13
|
|
14
14
|
There are a few additional options available in your configuration file. Each host
|
15
15
|
section can now use:
|
data/vsphere.md
CHANGED
@@ -3,34 +3,37 @@ that beaker will use to get Systems Under Test (SUTs) from any vSphere
|
|
3
3
|
infrastructure that you might have.
|
4
4
|
|
5
5
|
**Note** that if you're a puppet-internal user, or an external user that is
|
6
|
-
using the vmpooler hypervisor, please refer to our [vmpooler doc](https://github.com/puppetlabs/beaker-vmpooler)
|
7
|
-
for info, as it can be different than the information here.
|
6
|
+
using the vmpooler hypervisor, please refer to our [vmpooler doc](https://github.com/puppetlabs/beaker-vmpooler). beaker-vmpooler is now completely independent from beaker-vmware.
|
8
7
|
|
9
8
|
The harness can use vms and snapshots that live within vSphere as well.
|
10
9
|
To do this create a `~/.fog` file with your vSphere credentials:
|
11
10
|
|
12
|
-
|
11
|
+
~~~yaml
|
12
|
+
default:
|
13
|
+
vsphere_server: 'vsphere.example.com'
|
14
|
+
vsphere_username: 'joe'
|
15
|
+
vsphere_password: 'MyP@$$w0rd'
|
16
|
+
~~~
|
13
17
|
|
14
|
-
|
15
|
-
:vsphere_server: 'vsphere.example.com'
|
16
|
-
:vsphere_username: 'joe'
|
17
|
-
:vsphere_password: 'MyP@$$w0rd'
|
18
|
+
This file follows the conventions used by Cloud Provisioner and Fog. Note:
|
18
19
|
|
19
|
-
|
20
|
+
- You *may* use Strings or Ruby Symbols (e.g. `:default`) for keys, as both are formally supported by both Fog and Beaker, however for maximum interoprability it is recommended to use Strings.
|
21
|
+
- Your fog credential file location may be specified in the 'CONFIG' section using the 'dot_fog' setting. It can also be overridden by setting `ENV["FOG_RC"]` on the beaker coordinator.
|
22
|
+
- Fog supports multiple configuration sections (called "providers") in a single file. Normally you'll just use `default`, but you can also specify other providers. beaker-vmware doesn't select these, but you can specify them by setting `ENV["FOG_CREDENTIAL"]` on the beaker coordinator.
|
20
23
|
|
21
|
-
|
24
|
+
# Hypervisors
|
22
25
|
|
23
26
|
There are two possible `hypervisor` hypervisor-types to use for vSphere testing, `vsphere` and `vcloud`.
|
24
27
|
|
25
|
-
|
28
|
+
## `hypervisor: vsphere`
|
26
29
|
This option locates an existing static VM, optionally reverts it to a pre-existing snapshot, and runs tests on it.
|
27
30
|
|
28
|
-
|
31
|
+
## `hypervisor: vcloud`
|
29
32
|
This option clones a new VM from a pre-existing template, runs tests on the newly-provisioned clone, then deletes the clone once testing completes.
|
30
33
|
|
31
34
|
The `vcloud` option requires a slightly-modified test configuration file, specifying both the target template as well as three additional parameters in the 'CONFIG' section ('datastore', 'datacenter', and 'folder'). Optionally, a resourcepool may be specified via the 'resourcepool' setting in the 'CONFIG' section. Template can be expressed in the 'HOSTS' section, or you can set the template to be used via the `BEAKER_vcloud_template` environment variable.
|
32
35
|
|
33
|
-
####
|
36
|
+
#### Example vcloud hosts file
|
34
37
|
HOSTS:
|
35
38
|
master-vm:
|
36
39
|
roles:
|
metadata
CHANGED
@@ -1,181 +1,195 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beaker-vmware
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rishi Javia, Kevin Imber, Tony Vu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '3.0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '3.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec-its
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: fakefs
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0.6'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0.6'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '10.1'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '10.1'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: simplecov
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: pry
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - ~>
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0.10'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - ~>
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0.10'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: beaker
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '3.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '3.0'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: yard
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
|
-
- -
|
115
|
+
- - ">="
|
102
116
|
- !ruby/object:Gem::Version
|
103
117
|
version: '0'
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
|
-
- -
|
122
|
+
- - ">="
|
109
123
|
- !ruby/object:Gem::Version
|
110
124
|
version: '0'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: markdown
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
114
128
|
requirements:
|
115
|
-
- -
|
129
|
+
- - ">="
|
116
130
|
- !ruby/object:Gem::Version
|
117
131
|
version: '0'
|
118
132
|
type: :development
|
119
133
|
prerelease: false
|
120
134
|
version_requirements: !ruby/object:Gem::Requirement
|
121
135
|
requirements:
|
122
|
-
- -
|
136
|
+
- - ">="
|
123
137
|
- !ruby/object:Gem::Version
|
124
138
|
version: '0'
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
140
|
name: thin
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
128
142
|
requirements:
|
129
|
-
- -
|
143
|
+
- - ">="
|
130
144
|
- !ruby/object:Gem::Version
|
131
145
|
version: '0'
|
132
146
|
type: :development
|
133
147
|
prerelease: false
|
134
148
|
version_requirements: !ruby/object:Gem::Requirement
|
135
149
|
requirements:
|
136
|
-
- -
|
150
|
+
- - ">="
|
137
151
|
- !ruby/object:Gem::Version
|
138
152
|
version: '0'
|
139
153
|
- !ruby/object:Gem::Dependency
|
140
154
|
name: stringify-hash
|
141
155
|
requirement: !ruby/object:Gem::Requirement
|
142
156
|
requirements:
|
143
|
-
- - ~>
|
157
|
+
- - "~>"
|
144
158
|
- !ruby/object:Gem::Version
|
145
159
|
version: 0.0.0
|
146
160
|
type: :runtime
|
147
161
|
prerelease: false
|
148
162
|
version_requirements: !ruby/object:Gem::Requirement
|
149
163
|
requirements:
|
150
|
-
- - ~>
|
164
|
+
- - "~>"
|
151
165
|
- !ruby/object:Gem::Version
|
152
166
|
version: 0.0.0
|
153
167
|
- !ruby/object:Gem::Dependency
|
154
168
|
name: fission
|
155
169
|
requirement: !ruby/object:Gem::Requirement
|
156
170
|
requirements:
|
157
|
-
- - ~>
|
171
|
+
- - "~>"
|
158
172
|
- !ruby/object:Gem::Version
|
159
173
|
version: '0.4'
|
160
174
|
type: :runtime
|
161
175
|
prerelease: false
|
162
176
|
version_requirements: !ruby/object:Gem::Requirement
|
163
177
|
requirements:
|
164
|
-
- - ~>
|
178
|
+
- - "~>"
|
165
179
|
- !ruby/object:Gem::Version
|
166
180
|
version: '0.4'
|
167
181
|
- !ruby/object:Gem::Dependency
|
168
182
|
name: rbvmomi
|
169
183
|
requirement: !ruby/object:Gem::Requirement
|
170
184
|
requirements:
|
171
|
-
- - ~>
|
185
|
+
- - "~>"
|
172
186
|
- !ruby/object:Gem::Version
|
173
187
|
version: '1.9'
|
174
188
|
type: :runtime
|
175
189
|
prerelease: false
|
176
190
|
version_requirements: !ruby/object:Gem::Requirement
|
177
191
|
requirements:
|
178
|
-
- - ~>
|
192
|
+
- - "~>"
|
179
193
|
- !ruby/object:Gem::Version
|
180
194
|
version: '1.9'
|
181
195
|
description: For use for the Beaker acceptance testing tool
|
@@ -186,8 +200,8 @@ executables:
|
|
186
200
|
extensions: []
|
187
201
|
extra_rdoc_files: []
|
188
202
|
files:
|
189
|
-
- .gitignore
|
190
|
-
- .simplecov
|
203
|
+
- ".gitignore"
|
204
|
+
- ".simplecov"
|
191
205
|
- Gemfile
|
192
206
|
- LICENSE
|
193
207
|
- README.md
|
@@ -195,6 +209,8 @@ files:
|
|
195
209
|
- acceptance/config/nodes/test-nodes.yml
|
196
210
|
- beaker-vmware.gemspec
|
197
211
|
- bin/beaker-vmware
|
212
|
+
- docs/acceptance_setup.md
|
213
|
+
- docs/fusion_static_ip.md
|
198
214
|
- lib/beaker-vmware/version.rb
|
199
215
|
- lib/beaker/hypervisor/fusion.rb
|
200
216
|
- lib/beaker/hypervisor/vsphere.rb
|
@@ -215,17 +231,17 @@ require_paths:
|
|
215
231
|
- lib
|
216
232
|
required_ruby_version: !ruby/object:Gem::Requirement
|
217
233
|
requirements:
|
218
|
-
- -
|
234
|
+
- - ">="
|
219
235
|
- !ruby/object:Gem::Version
|
220
236
|
version: '0'
|
221
237
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
222
238
|
requirements:
|
223
|
-
- -
|
239
|
+
- - ">="
|
224
240
|
- !ruby/object:Gem::Version
|
225
241
|
version: '0'
|
226
242
|
requirements: []
|
227
243
|
rubyforge_project:
|
228
|
-
rubygems_version: 2.
|
244
|
+
rubygems_version: 2.5.1
|
229
245
|
signing_key:
|
230
246
|
specification_version: 4
|
231
247
|
summary: Beaker DSL Extension Helpers!
|