beaker 3.19.0 → 3.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
 - data/acceptance/tests/base/dsl/install_utils/clone_git_repo_on_test.rb +2 -0
 - data/acceptance/tests/base/host/host_test.rb +2 -2
 - data/beaker.gemspec +1 -1
 - data/docs/concepts/beaker_libraries.md +1 -0
 - data/docs/how_to/hypervisors/README.md +15 -10
 - data/docs/how_to/hypervisors/aws.md +3 -0
 - data/docs/how_to/hypervisors/vsphere.md +1 -1
 - data/lib/beaker/command.rb +5 -1
 - data/lib/beaker/host/unix/exec.rb +1 -1
 - data/lib/beaker/hypervisor.rb +17 -9
 - data/lib/beaker/hypervisor/aws_sdk.rb +12 -0
 - data/lib/beaker/hypervisor/vagrant.rb +18 -1
 - data/lib/beaker/version.rb +1 -1
 - data/spec/beaker/host_prebuilt_steps_spec.rb +9 -1
 - data/spec/beaker/hypervisor/hypervisor_spec.rb +4 -14
 - data/spec/beaker/hypervisor/vagrant_spec.rb +7 -0
 - metadata +16 -21
 - data/docs/how_to/hypervisors/vmpooler.md +0 -45
 - data/lib/beaker/hypervisor/vcloud.rb +0 -229
 - data/lib/beaker/hypervisor/vmpooler.rb +0 -354
 - data/spec/beaker/hypervisor/vcloud_spec.rb +0 -72
 - data/spec/beaker/hypervisor/vmpooler_spec.rb +0 -276
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,15 +1,15 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            !binary "U0hBMQ==":
         
     | 
| 
       3 
3 
     | 
    
         
             
              metadata.gz: !binary |-
         
     | 
| 
       4 
     | 
    
         
            -
                 
     | 
| 
      
 4 
     | 
    
         
            +
                NDQ3ZThiZTEzNTZkODA0ZTQ3YjI1NDA5MzkxZTAzMDE4NjljM2M1Zg==
         
     | 
| 
       5 
5 
     | 
    
         
             
              data.tar.gz: !binary |-
         
     | 
| 
       6 
     | 
    
         
            -
                 
     | 
| 
      
 6 
     | 
    
         
            +
                NjVhMDY5ZDE5ZmI0ZTc0OWQ4MTIyZGM5YWM2YTVhNTc2YjUyMGYyMw==
         
     | 
| 
       7 
7 
     | 
    
         
             
            SHA512:
         
     | 
| 
       8 
8 
     | 
    
         
             
              metadata.gz: !binary |-
         
     | 
| 
       9 
     | 
    
         
            -
                 
     | 
| 
       10 
     | 
    
         
            -
                 
     | 
| 
       11 
     | 
    
         
            -
                 
     | 
| 
      
 9 
     | 
    
         
            +
                Y2Q1ZDBjOGVmMGJkNzA2MmVjMGFmOGUzNWRlMTEzZjVlNTkxZTA5ODkwNmU2
         
     | 
| 
      
 10 
     | 
    
         
            +
                ZjdjZTFiMTdmZjg5OTVlNDMwMmQ0NjI5MDhiYTRlNzg4ZTFhMjQ4NGExODJk
         
     | 
| 
      
 11 
     | 
    
         
            +
                OTgxN2RmMTkyM2Q0MmNmOTg5ZjMwNTBlZTRlZDI1MjFhNThlYjE=
         
     | 
| 
       12 
12 
     | 
    
         
             
              data.tar.gz: !binary |-
         
     | 
| 
       13 
     | 
    
         
            -
                 
     | 
| 
       14 
     | 
    
         
            -
                 
     | 
| 
       15 
     | 
    
         
            -
                 
     | 
| 
      
 13 
     | 
    
         
            +
                ODJhZTkyNDgzMzA4Y2M2Y2FhNGJiOGI3YTI3NWQ5NjAzNzg5NTEyNTNmZjFj
         
     | 
| 
      
 14 
     | 
    
         
            +
                MzIyMjYyNDlmNjQ3ZDUwNTlmNGM2YWM2YjBiZWYwNzcyNjU3MjY2NmExZWQ5
         
     | 
| 
      
 15 
     | 
    
         
            +
                MTlmMjYxMTVkMDU0YzQ1ODllNDEzZjY1YzIzNzRlYWFjMGZiNjY=
         
     | 
| 
         @@ -228,7 +228,7 @@ hosts.each do |host| 
     | 
|
| 
       228 
228 
     | 
    
         
             
              logger.debug("can recursively copy a module over, ignoring some files/dirs")
         
     | 
| 
       229 
229 
     | 
    
         
             
              #make sure that we are clean on the test host
         
     | 
| 
       230 
230 
     | 
    
         
             
              host.rm_rf("module")
         
     | 
| 
       231 
     | 
    
         
            -
              host.do_scp_to(module_fixture, ".", {:ignore => [' 
     | 
| 
      
 231 
     | 
    
         
            +
              host.do_scp_to(module_fixture, ".", {:ignore => ['tests', 'Gemfile']})
         
     | 
| 
       232 
232 
     | 
    
         
             
              Dir.mktmpdir do |tmp_dir|
         
     | 
| 
       233 
233 
     | 
    
         
             
                #grab copy from host
         
     | 
| 
       234 
234 
     | 
    
         
             
                host.do_scp_from("module", tmp_dir, {})
         
     | 
| 
         @@ -239,7 +239,7 @@ hosts.each do |host| 
     | 
|
| 
       239 
239 
     | 
    
         
             
                local_paths.each do |path|
         
     | 
| 
       240 
240 
     | 
    
         
             
                  search_name = path.gsub(/^.*fixtures\//, '') #reduce down to the path that should match
         
     | 
| 
       241 
241 
     | 
    
         
             
                  matched = host_paths.select{ |check| check =~ /#{Regexp.escape(search_name)}$/ }
         
     | 
| 
       242 
     | 
    
         
            -
                  re =  /((\/|\A) 
     | 
| 
      
 242 
     | 
    
         
            +
                  re =  /((\/|\A)tests(\/|\z))|((\/|\A)Gemfile(\/|\z))/
         
     | 
| 
       243 
243 
     | 
    
         
             
                  if path !~ re
         
     | 
| 
       244 
244 
     | 
    
         
             
                    assert_equal(1, matched.length, "should have found a single instance of path #{search_name}, found #{matched.length}: \n #{matched}")
         
     | 
| 
       245 
245 
     | 
    
         
             
                  else
         
     | 
    
        data/beaker.gemspec
    CHANGED
    
    | 
         @@ -51,12 +51,12 @@ Gem::Specification.new do |s| 
     | 
|
| 
       51 
51 
     | 
    
         
             
              s.add_runtime_dependency 'beaker-puppet', '~> 0.0'
         
     | 
| 
       52 
52 
     | 
    
         | 
| 
       53 
53 
     | 
    
         
             
              # Optional provisioner specific support
         
     | 
| 
       54 
     | 
    
         
            -
              s.add_runtime_dependency 'rbvmomi', '~> 1.9'
         
     | 
| 
       55 
54 
     | 
    
         
             
              s.add_runtime_dependency 'fission', '~> 0.4'
         
     | 
| 
       56 
55 
     | 
    
         
             
              s.add_runtime_dependency 'google-api-client', '~> 0.9'
         
     | 
| 
       57 
56 
     | 
    
         
             
              s.add_runtime_dependency 'aws-sdk-v1', '~> 1.57'
         
     | 
| 
       58 
57 
     | 
    
         
             
              s.add_runtime_dependency 'docker-api'
         
     | 
| 
       59 
58 
     | 
    
         
             
              s.add_runtime_dependency 'fog', '~> 1.38'
         
     | 
| 
      
 59 
     | 
    
         
            +
              s.add_runtime_dependency 'beaker-vmpooler', '~> 0.1'
         
     | 
| 
       60 
60 
     | 
    
         | 
| 
       61 
61 
     | 
    
         
             
              # So fog doesn't always complain of unmet AWS dependencies
         
     | 
| 
       62 
62 
     | 
    
         
             
              s.add_runtime_dependency 'unf', '~> 0.1'
         
     | 
| 
         @@ -16,4 +16,5 @@ To learn how to create beaker libraries, see the [Beaker-Template](https://githu 
     | 
|
| 
       16 
16 
     | 
    
         
             
            | beaker-http | Adds ability to dispatch http traffic from the coordinator | [Github Repo](https://github.com/puppetlabs/beaker-http/) |
         
     | 
| 
       17 
17 
     | 
    
         
             
            | Beaker Rubymine Plugin | An IntelliJ IDEA plugin making Beaker test runs a native IDE experience | [Github Repo](https://github.com/samwoods1/BeakerRubyMinePlugin) |
         
     | 
| 
       18 
18 
     | 
    
         
             
            | beaker-rspec | A bridge between beaker itself and [rspec](https://github.com/rspec/rspec); also integrates [serverspec](http://serverspec.org/) | [Github Repo](https://github.com/puppetlabs/beaker-rspec/) |
         
     | 
| 
      
 19 
     | 
    
         
            +
            | beaker-puppet | Adds helper & install methods for Puppet-specific tasks | [Github Repo](https://github.com/puppetlabs/beaker-puppet/)
         
     | 
| 
       19 
20 
     | 
    
         | 
| 
         @@ -32,17 +32,22 @@ that are needed for it. An example `.fog` file is below: 
     | 
|
| 
       32 
32 
     | 
    
         | 
| 
       33 
33 
     | 
    
         
             
            # External Hypervisors
         
     | 
| 
       34 
34 
     | 
    
         | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
            Beaker itself. The reason for this is that we're looking to decrease Beaker's
         
     | 
| 
      
 35 
     | 
    
         
            +
            Puppetlabs and its community have made several gems that support different hypervisors with beaker, the reason for this is that we're looking to decrease Beaker's
         
     | 
| 
       37 
36 
     | 
    
         
             
            dependency footprint, and hypervisors are one of the places where we can often
         
     | 
| 
       38 
37 
     | 
    
         
             
            increase the load across all Beaker uses to benefit a small group that uses a
         
     | 
| 
       39 
     | 
    
         
            -
            particular hypervisor.
         
     | 
| 
      
 38 
     | 
    
         
            +
            particular hypervisor. 
         
     | 
| 
       40 
39 
     | 
    
         | 
| 
       41 
     | 
    
         
            -
            In order to offset this, we've made a listing of forks  
     | 
| 
       42 
     | 
    
         
            -
            hypervisors not included in Beaker. Please check them out if you'd
         
     | 
| 
       43 
     | 
    
         
            -
            like to use their hypervisor, hopefully it'll save you from spending time
         
     | 
| 
       44 
     | 
    
         
            -
            trying to support a new hypervisor yourself.
         
     | 
| 
      
 40 
     | 
    
         
            +
            In order to offset this, we've made a listing of gems and community-supported forks that support other external hypervisors. Please check them out if you'd like to use those hypervisors, hopefully it'll save you from spending time trying to support a new hypervisor yourself.
         
     | 
| 
       45 
41 
     | 
    
         | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
            |  
     | 
| 
      
 42 
     | 
    
         
            +
            Hypervisor gems made by puppet (pre-included in beaker 3.x):
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
            | Hypervisor             | Fork                                                      |
         
     | 
| 
      
 45 
     | 
    
         
            +
            |:----------------------:|:---------------------------------------------------------:|
         
     | 
| 
      
 46 
     | 
    
         
            +
            | Vmpooler        | [beaker-vmpooler](https://github.com/puppetlabs/beaker-vmpooler) |
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
            Hypervisor gems and beaker forks made by community:
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
            | Hypervisor   | Fork                                                                 |
         
     | 
| 
      
 51 
     | 
    
         
            +
            |:------------:|:--------------------------------------------------------------------:|
         
     | 
| 
      
 52 
     | 
    
         
            +
            | LXC          | [Obmondo](https://github.com/Obmondo/beaker)                         |
         
     | 
| 
      
 53 
     | 
    
         
            +
            | DigitalOcean | [beaker-digitalocean](https://github.com/tiengo/beaker-digitalocean) |
         
     | 
| 
         @@ -66,11 +66,14 @@ the AWS hypervisor to provision hosts properly.  They come in this form: 
     | 
|
| 
       66 
66 
     | 
    
         
             
                  hypervisor: ec2
         
     | 
| 
       67 
67 
     | 
    
         
             
                  snapshot: <type>
         
     | 
| 
       68 
68 
     | 
    
         
             
                  amisize: <ami-size>
         
     | 
| 
      
 69 
     | 
    
         
            +
                  platform: <platform-name>
         
     | 
| 
       69 
70 
     | 
    
         | 
| 
       70 
71 
     | 
    
         
             
            The `host-vmname-value` references the ID created in the Amazon Image Config file
         
     | 
| 
       71 
72 
     | 
    
         
             
            above.  If not provided, Beaker will try to name an AMI Config using the host's
         
     | 
| 
       72 
73 
     | 
    
         
             
            platform string.
         
     | 
| 
       73 
74 
     | 
    
         | 
| 
      
 75 
     | 
    
         
            +
            **Note:** If you are using `amazon-6-x86_64` as `vmname`, you have to specify `platform` as `el-6-x86_64`. Similarly for `amazon-6-i386` use `el-6-i386` as `platform`. 
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
       74 
77 
     | 
    
         
             
            The `type` references the type variable in the Amazon Image Config file as well,
         
     | 
| 
       75 
78 
     | 
    
         
             
            so this key picks out the particular AMI ID from the set available for this type
         
     | 
| 
       76 
79 
     | 
    
         
             
            of host platform.
         
     | 
| 
         @@ -3,7 +3,7 @@ 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](vmpooler 
     | 
| 
      
 6 
     | 
    
         
            +
            using the vmpooler hypervisor, please refer to our [vmpooler doc](https://github.com/puppetlabs/beaker-vmpooler)
         
     | 
| 
       7 
7 
     | 
    
         
             
            for info, as it can be different than the information here. 
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
            The harness can use vms and snapshots that live within vSphere as well.
         
     | 
    
        data/lib/beaker/command.rb
    CHANGED
    
    | 
         @@ -78,7 +78,11 @@ module Beaker 
     | 
|
| 
       78 
78 
     | 
    
         
             
                  end
         
     | 
| 
       79 
79 
     | 
    
         | 
| 
       80 
80 
     | 
    
         
             
                  # This will cause things like `puppet -t -v agent` which is maybe bad.
         
     | 
| 
       81 
     | 
    
         
            -
                   
     | 
| 
      
 81 
     | 
    
         
            +
                  if host[:platform] =~ /cisco/ 
         
     | 
| 
      
 82 
     | 
    
         
            +
                    cmd_line_array = [prepend_commands, env_string, cmd, options_string, args_string]
         
     | 
| 
      
 83 
     | 
    
         
            +
                  else
         
     | 
| 
      
 84 
     | 
    
         
            +
                    cmd_line_array = [env_string, prepend_commands, cmd, options_string, args_string]
         
     | 
| 
      
 85 
     | 
    
         
            +
                  end
         
     | 
| 
       82 
86 
     | 
    
         
             
                  cmd_line_array << append_command unless (cmd =~ /ntpdate/ && host[:platform] =~ /cisco_nexus/)
         
     | 
| 
       83 
87 
     | 
    
         
             
                  cmd_line_array.compact.reject( &:empty? ).join( ' ' )
         
     | 
| 
       84 
88 
     | 
    
         
             
                end
         
     | 
| 
         @@ -26,7 +26,7 @@ module Unix::Exec 
     | 
|
| 
       26 
26 
     | 
    
         
             
                if self['platform'].include?('solaris') || self['platform'].include?('osx')
         
     | 
| 
       27 
27 
     | 
    
         
             
                  execute("ifconfig -a inet| awk '/broadcast/ {print $2}' | cut -d/ -f1 | head -1").strip
         
     | 
| 
       28 
28 
     | 
    
         
             
                else
         
     | 
| 
       29 
     | 
    
         
            -
                  execute("ip a|awk '/global/{print$2}' | cut -d/ -f1 | head -1").strip
         
     | 
| 
      
 29 
     | 
    
         
            +
                  execute("ip a | awk '/global/{print$2}' | cut -d/ -f1 | #{self['hypervisor'] == 'vagrant' ? 'tail' : 'head'} -1").strip
         
     | 
| 
       30 
30 
     | 
    
         
             
                end
         
     | 
| 
       31 
31 
     | 
    
         
             
              end
         
     | 
| 
       32 
32 
     | 
    
         | 
    
        data/lib/beaker/hypervisor.rb
    CHANGED
    
    | 
         @@ -32,14 +32,6 @@ module Beaker 
     | 
|
| 
       32 
32 
     | 
    
         
             
                      Beaker::Fusion
         
     | 
| 
       33 
33 
     | 
    
         
             
                    when /^ec2$/
         
     | 
| 
       34 
34 
     | 
    
         
             
                      Beaker::AwsSdk
         
     | 
| 
       35 
     | 
    
         
            -
                    when /^vmpooler$/
         
     | 
| 
       36 
     | 
    
         
            -
                      Beaker::Vmpooler
         
     | 
| 
       37 
     | 
    
         
            -
                    when /^vcloud$/
         
     | 
| 
       38 
     | 
    
         
            -
                      if options['pooling_api']
         
     | 
| 
       39 
     | 
    
         
            -
                        Beaker::Vmpooler
         
     | 
| 
       40 
     | 
    
         
            -
                      else
         
     | 
| 
       41 
     | 
    
         
            -
                        Beaker::Vcloud
         
     | 
| 
       42 
     | 
    
         
            -
                      end
         
     | 
| 
       43 
35 
     | 
    
         
             
                    when /^vagrant$/
         
     | 
| 
       44 
36 
     | 
    
         
             
                      Beaker::Vagrant
         
     | 
| 
       45 
37 
     | 
    
         
             
                    when /^vagrant_custom$/
         
     | 
| 
         @@ -150,6 +142,22 @@ module Beaker 
     | 
|
| 
       150 
142 
     | 
    
         
             
              end
         
     | 
| 
       151 
143 
     | 
    
         
             
            end
         
     | 
| 
       152 
144 
     | 
    
         | 
| 
       153 
     | 
    
         
            -
            [ 
     | 
| 
      
 145 
     | 
    
         
            +
            [
         
     | 
| 
      
 146 
     | 
    
         
            +
              'vsphere_helper',
         
     | 
| 
      
 147 
     | 
    
         
            +
              'vagrant',
         
     | 
| 
      
 148 
     | 
    
         
            +
              'vagrant_custom',
         
     | 
| 
      
 149 
     | 
    
         
            +
              'vagrant_virtualbox',
         
     | 
| 
      
 150 
     | 
    
         
            +
              'vagrant_parallels',
         
     | 
| 
      
 151 
     | 
    
         
            +
              'vagrant_libvirt',
         
     | 
| 
      
 152 
     | 
    
         
            +
              'vagrant_fusion',
         
     | 
| 
      
 153 
     | 
    
         
            +
              'vagrant_workstation',
         
     | 
| 
      
 154 
     | 
    
         
            +
              'fusion',
         
     | 
| 
      
 155 
     | 
    
         
            +
              'aws_sdk',
         
     | 
| 
      
 156 
     | 
    
         
            +
              'vsphere',
         
     | 
| 
      
 157 
     | 
    
         
            +
              'docker',
         
     | 
| 
      
 158 
     | 
    
         
            +
              'google_compute',
         
     | 
| 
      
 159 
     | 
    
         
            +
              'openstack',
         
     | 
| 
      
 160 
     | 
    
         
            +
              'noop'
         
     | 
| 
      
 161 
     | 
    
         
            +
            ].each do |lib|
         
     | 
| 
       154 
162 
     | 
    
         
             
                require "beaker/hypervisor/#{lib}"
         
     | 
| 
       155 
163 
     | 
    
         
             
            end
         
     | 
| 
         @@ -649,6 +649,14 @@ module Beaker 
     | 
|
| 
       649 
649 
     | 
    
         
             
                      else
         
     | 
| 
       650 
650 
     | 
    
         
             
                        next if host['platform'] =~ /netscaler/
         
     | 
| 
       651 
651 
     | 
    
         
             
                        host.exec(Command.new("hostname #{host.name}"))
         
     | 
| 
      
 652 
     | 
    
         
            +
                        if host['vmname'] =~ /^amazon/
         
     | 
| 
      
 653 
     | 
    
         
            +
                          # Amazon Linux requires this to preserve host name changes across reboots.
         
     | 
| 
      
 654 
     | 
    
         
            +
                          # http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/set-hostname.html
         
     | 
| 
      
 655 
     | 
    
         
            +
                          # Also note that without an elastic ip set, while this will
         
     | 
| 
      
 656 
     | 
    
         
            +
                          # preserve the hostname across a full shutdown/startup of the vm
         
     | 
| 
      
 657 
     | 
    
         
            +
                          # (as opposed to a reboot) -- the ip address will have changed. 
         
     | 
| 
      
 658 
     | 
    
         
            +
                          host.exec(Command.new("sed -ie '/^HOSTNAME/ s/=.*/=#{host.name}/' /etc/sysconfig/network"))
         
     | 
| 
      
 659 
     | 
    
         
            +
                        end
         
     | 
| 
       652 
660 
     | 
    
         
             
                      end
         
     | 
| 
       653 
661 
     | 
    
         
             
                    end
         
     | 
| 
       654 
662 
     | 
    
         
             
                  else
         
     | 
| 
         @@ -660,6 +668,10 @@ module Beaker 
     | 
|
| 
       660 
668 
     | 
    
         
             
                      else
         
     | 
| 
       661 
669 
     | 
    
         
             
                        next if host['platform'] =~ /netscaler/
         
     | 
| 
       662 
670 
     | 
    
         
             
                        host.exec(Command.new("hostname #{host.hostname}"))
         
     | 
| 
      
 671 
     | 
    
         
            +
                        if host['vmname'] =~ /^amazon/
         
     | 
| 
      
 672 
     | 
    
         
            +
                          # See note above
         
     | 
| 
      
 673 
     | 
    
         
            +
                          host.exec(Command.new("sed -ie '/^HOSTNAME/ s/=.*/=#{host.hostname}/' /etc/sysconfig/network"))
         
     | 
| 
      
 674 
     | 
    
         
            +
                        end
         
     | 
| 
       663 
675 
     | 
    
         
             
                      end
         
     | 
| 
       664 
676 
     | 
    
         
             
                    end
         
     | 
| 
       665 
677 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -175,7 +175,24 @@ module Beaker 
     | 
|
| 
       175 
175 
     | 
    
         
             
                  if @options[:provision]
         
     | 
| 
       176 
176 
     | 
    
         
             
                    #setting up new vagrant hosts
         
     | 
| 
       177 
177 
     | 
    
         
             
                    #make sure that any old boxes are dead dead dead
         
     | 
| 
       178 
     | 
    
         
            -
                     
     | 
| 
      
 178 
     | 
    
         
            +
                    begin
         
     | 
| 
      
 179 
     | 
    
         
            +
                      vagrant_cmd("destroy --force") if File.file?(@vagrant_file)
         
     | 
| 
      
 180 
     | 
    
         
            +
                    rescue RuntimeError => e
         
     | 
| 
      
 181 
     | 
    
         
            +
                      # LATER: use <<~MESSAGE once we're on Ruby 2.3
         
     | 
| 
      
 182 
     | 
    
         
            +
                      @logger.debug(%Q{
         
     | 
| 
      
 183 
     | 
    
         
            +
                        Beaker failed to destroy the existing VM's. If you think this is
         
     | 
| 
      
 184 
     | 
    
         
            +
                        an error or you upgraded from an older version of beaker try
         
     | 
| 
      
 185 
     | 
    
         
            +
                        verifying the VM exists and deleting the existing Vagrantfile if
         
     | 
| 
      
 186 
     | 
    
         
            +
                        you believe it is safe to do so. WARNING: If a VM still exists
         
     | 
| 
      
 187 
     | 
    
         
            +
                        please run 'vagrant destroy'.
         
     | 
| 
      
 188 
     | 
    
         
            +
             
     | 
| 
      
 189 
     | 
    
         
            +
                        cd #{@vagrant_path}
         
     | 
| 
      
 190 
     | 
    
         
            +
                        vagrant status
         
     | 
| 
      
 191 
     | 
    
         
            +
                        vagrant destroy # only need to run this is a VM is not created
         
     | 
| 
      
 192 
     | 
    
         
            +
                        rm #{@vagrant_file} # only do this if all VM's are actually destroyed
         
     | 
| 
      
 193 
     | 
    
         
            +
                      }.each_line.map(&:strip).join("\n"))
         
     | 
| 
      
 194 
     | 
    
         
            +
                      raise e
         
     | 
| 
      
 195 
     | 
    
         
            +
                    end
         
     | 
| 
       179 
196 
     | 
    
         | 
| 
       180 
197 
     | 
    
         
             
                    make_vfile @hosts, @options
         
     | 
| 
       181 
198 
     | 
    
         | 
    
        data/lib/beaker/version.rb
    CHANGED
    
    
| 
         @@ -516,12 +516,20 @@ describe Beaker do 
     | 
|
| 
       516 
516 
     | 
    
         
             
                it "can exec the get_ip command" do
         
     | 
| 
       517 
517 
     | 
    
         
             
                  host = make_host('name', { :stdout => "192.168.2.130\n" } )
         
     | 
| 
       518 
518 
     | 
    
         | 
| 
       519 
     | 
    
         
            -
                  expect( Beaker::Command ).to receive( :new ).with( "ip a|awk '/global/{print$2}' | cut -d/ -f1 | head -1", [], {:prepend_cmds=>nil, :cmdexe=>false} ).once
         
     | 
| 
      
 519 
     | 
    
         
            +
                  expect( Beaker::Command ).to receive( :new ).with( "ip a | awk '/global/{print$2}' | cut -d/ -f1 | head -1", [], {:prepend_cmds=>nil, :cmdexe=>false} ).once
         
     | 
| 
       520 
520 
     | 
    
         | 
| 
       521 
521 
     | 
    
         
             
                  expect( subject.get_ip( host ) ).to be === "192.168.2.130"
         
     | 
| 
       522 
522 
     | 
    
         | 
| 
       523 
523 
     | 
    
         
             
                end
         
     | 
| 
       524 
524 
     | 
    
         | 
| 
      
 525 
     | 
    
         
            +
                it "can exec the get_ip command with tail with vagrant hypervisor" do
         
     | 
| 
      
 526 
     | 
    
         
            +
                  host = make_host('name', { :stdout => "192.168.2.131\n", :hypervisor => "vagrant" } )
         
     | 
| 
      
 527 
     | 
    
         
            +
             
     | 
| 
      
 528 
     | 
    
         
            +
                  expect( Beaker::Command ).to receive( :new ).with( "ip a | awk '/global/{print$2}' | cut -d/ -f1 | tail -1", [], {:prepend_cmds=>nil, :cmdexe=>false} ).once
         
     | 
| 
      
 529 
     | 
    
         
            +
             
     | 
| 
      
 530 
     | 
    
         
            +
                  expect( subject.get_ip( host ) ).to be === "192.168.2.131"
         
     | 
| 
      
 531 
     | 
    
         
            +
                end
         
     | 
| 
      
 532 
     | 
    
         
            +
             
     | 
| 
       525 
533 
     | 
    
         
             
              end
         
     | 
| 
       526 
534 
     | 
    
         | 
| 
       527 
535 
     | 
    
         
             
              context "set_etc_hosts" do
         
     | 
| 
         @@ -4,6 +4,10 @@ module Beaker 
     | 
|
| 
       4 
4 
     | 
    
         
             
              describe Hypervisor do
         
     | 
| 
       5 
5 
     | 
    
         
             
                let( :hypervisor ) { Beaker::Hypervisor }
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
      
 7 
     | 
    
         
            +
                it "includes custom hypervisor" do
         
     | 
| 
      
 8 
     | 
    
         
            +
                  expect{ hypervisor.create('custom_hypervisor', [], make_opts() )}.to raise_error(RuntimeError, "Invalid hypervisor: custom_hypervisor")
         
     | 
| 
      
 9 
     | 
    
         
            +
                end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
       7 
11 
     | 
    
         
             
                it "creates a vsphere hypervisor for vsphere hosts" do
         
     | 
| 
       8 
12 
     | 
    
         
             
                  vsphere = double( 'vsphere' )
         
     | 
| 
       9 
13 
     | 
    
         
             
                  allow( vsphere ).to receive( :provision ).and_return( true )
         
     | 
| 
         @@ -18,20 +22,6 @@ module Beaker 
     | 
|
| 
       18 
22 
     | 
    
         
             
                  expect( hypervisor.create( 'fusion', [], make_opts() ) ).to be === fusion
         
     | 
| 
       19 
23 
     | 
    
         
             
                end
         
     | 
| 
       20 
24 
     | 
    
         | 
| 
       21 
     | 
    
         
            -
                it "creates a vmpooler hypervisor for hosts that are pooled" do
         
     | 
| 
       22 
     | 
    
         
            -
                  vcloud = double( 'vcloud' )
         
     | 
| 
       23 
     | 
    
         
            -
                  allow( vcloud ).to receive( :provision ).and_return( true )
         
     | 
| 
       24 
     | 
    
         
            -
                  expect( Vmpooler ).to receive( :new ).once.and_return( vcloud )
         
     | 
| 
       25 
     | 
    
         
            -
                  expect( hypervisor.create( 'vcloud', [], make_opts().merge( { 'pooling_api' => true } ) ) ).to be === vcloud
         
     | 
| 
       26 
     | 
    
         
            -
                end
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
                it "creates a vcloud hypervisor for vcloud hosts that are not pooled" do
         
     | 
| 
       29 
     | 
    
         
            -
                  vcloud = double( 'vcloud' )
         
     | 
| 
       30 
     | 
    
         
            -
                  allow( vcloud ).to receive( :provision ).and_return( true )
         
     | 
| 
       31 
     | 
    
         
            -
                  expect( Vcloud ).to receive( :new ).once.and_return( vcloud )
         
     | 
| 
       32 
     | 
    
         
            -
                  expect( hypervisor.create( 'vcloud', [], make_opts().merge( { 'pooling_api' => false } ) ) ).to be === vcloud
         
     | 
| 
       33 
     | 
    
         
            -
                end
         
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
25 
     | 
    
         
             
                it "creates a vagrant hypervisor for vagrant hosts" do
         
     | 
| 
       36 
26 
     | 
    
         
             
                  vagrant = double( 'vagrant' )
         
     | 
| 
       37 
27 
     | 
    
         
             
                  allow( vagrant ).to receive( :provision ).and_return( true )
         
     | 
| 
         @@ -420,6 +420,13 @@ EOF 
     | 
|
| 
       420 
420 
     | 
    
         
             
                    vagrant.provision
         
     | 
| 
       421 
421 
     | 
    
         
             
                  end
         
     | 
| 
       422 
422 
     | 
    
         | 
| 
      
 423 
     | 
    
         
            +
                  it "notifies user of failed provision" do
         
     | 
| 
      
 424 
     | 
    
         
            +
                    vagrant.provision
         
     | 
| 
      
 425 
     | 
    
         
            +
                    expect( vagrant ).to receive( :vagrant_cmd ).with( "destroy --force" ).and_raise( RuntimeError )
         
     | 
| 
      
 426 
     | 
    
         
            +
                    expect( options['logger'] ).to receive( :debug ).with( /Vagrantfile/ )
         
     | 
| 
      
 427 
     | 
    
         
            +
                    expect{ vagrant.provision }.to raise_error( RuntimeError )
         
     | 
| 
      
 428 
     | 
    
         
            +
                  end
         
     | 
| 
      
 429 
     | 
    
         
            +
             
     | 
| 
       423 
430 
     | 
    
         
             
                  it "can cleanup" do
         
     | 
| 
       424 
431 
     | 
    
         
             
                    expect( vagrant ).to receive( :vagrant_cmd ).with( "destroy --force" ).once
         
     | 
| 
       425 
432 
     | 
    
         
             
                    expect( FileUtils ).to receive( :rm_rf ).once
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: beaker
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 3. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 3.20.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Puppet
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2017- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2017-07-12 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: rspec
         
     | 
| 
         @@ -304,20 +304,6 @@ dependencies: 
     | 
|
| 
       304 
304 
     | 
    
         
             
                - - ~>
         
     | 
| 
       305 
305 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       306 
306 
     | 
    
         
             
                    version: '0.0'
         
     | 
| 
       307 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency
         
     | 
| 
       308 
     | 
    
         
            -
              name: rbvmomi
         
     | 
| 
       309 
     | 
    
         
            -
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       310 
     | 
    
         
            -
                requirements:
         
     | 
| 
       311 
     | 
    
         
            -
                - - ~>
         
     | 
| 
       312 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       313 
     | 
    
         
            -
                    version: '1.9'
         
     | 
| 
       314 
     | 
    
         
            -
              type: :runtime
         
     | 
| 
       315 
     | 
    
         
            -
              prerelease: false
         
     | 
| 
       316 
     | 
    
         
            -
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       317 
     | 
    
         
            -
                requirements:
         
     | 
| 
       318 
     | 
    
         
            -
                - - ~>
         
     | 
| 
       319 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       320 
     | 
    
         
            -
                    version: '1.9'
         
     | 
| 
       321 
307 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       322 
308 
     | 
    
         
             
              name: fission
         
     | 
| 
       323 
309 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -388,6 +374,20 @@ dependencies: 
     | 
|
| 
       388 
374 
     | 
    
         
             
                - - ~>
         
     | 
| 
       389 
375 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       390 
376 
     | 
    
         
             
                    version: '1.38'
         
     | 
| 
      
 377 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 378 
     | 
    
         
            +
              name: beaker-vmpooler
         
     | 
| 
      
 379 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 380 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 381 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 382 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 383 
     | 
    
         
            +
                    version: '0.1'
         
     | 
| 
      
 384 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 385 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 386 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 387 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 388 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 389 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 390 
     | 
    
         
            +
                    version: '0.1'
         
     | 
| 
       391 
391 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       392 
392 
     | 
    
         
             
              name: unf
         
     | 
| 
       393 
393 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -564,7 +564,6 @@ files: 
     | 
|
| 
       564 
564 
     | 
    
         
             
            - docs/how_to/hypervisors/vagrant.md
         
     | 
| 
       565 
565 
     | 
    
         
             
            - docs/how_to/hypervisors/vagrant_hosts_file_examples.md
         
     | 
| 
       566 
566 
     | 
    
         
             
            - docs/how_to/hypervisors/vagrant_libvirt.md
         
     | 
| 
       567 
     | 
    
         
            -
            - docs/how_to/hypervisors/vmpooler.md
         
     | 
| 
       568 
567 
     | 
    
         
             
            - docs/how_to/hypervisors/vmware_fusion.md
         
     | 
| 
       569 
568 
     | 
    
         
             
            - docs/how_to/hypervisors/vsphere.md
         
     | 
| 
       570 
569 
     | 
    
         
             
            - docs/how_to/install_puppet.md
         
     | 
| 
         @@ -663,8 +662,6 @@ files: 
     | 
|
| 
       663 
662 
     | 
    
         
             
            - lib/beaker/hypervisor/vagrant_parallels.rb
         
     | 
| 
       664 
663 
     | 
    
         
             
            - lib/beaker/hypervisor/vagrant_virtualbox.rb
         
     | 
| 
       665 
664 
     | 
    
         
             
            - lib/beaker/hypervisor/vagrant_workstation.rb
         
     | 
| 
       666 
     | 
    
         
            -
            - lib/beaker/hypervisor/vcloud.rb
         
     | 
| 
       667 
     | 
    
         
            -
            - lib/beaker/hypervisor/vmpooler.rb
         
     | 
| 
       668 
665 
     | 
    
         
             
            - lib/beaker/hypervisor/vsphere.rb
         
     | 
| 
       669 
666 
     | 
    
         
             
            - lib/beaker/hypervisor/vsphere_helper.rb
         
     | 
| 
       670 
667 
     | 
    
         
             
            - lib/beaker/junit.xsl
         
     | 
| 
         @@ -750,8 +747,6 @@ files: 
     | 
|
| 
       750 
747 
     | 
    
         
             
            - spec/beaker/hypervisor/vagrant_spec.rb
         
     | 
| 
       751 
748 
     | 
    
         
             
            - spec/beaker/hypervisor/vagrant_virtualbox_spec.rb
         
     | 
| 
       752 
749 
     | 
    
         
             
            - spec/beaker/hypervisor/vagrant_workstation_spec.rb
         
     | 
| 
       753 
     | 
    
         
            -
            - spec/beaker/hypervisor/vcloud_spec.rb
         
     | 
| 
       754 
     | 
    
         
            -
            - spec/beaker/hypervisor/vmpooler_spec.rb
         
     | 
| 
       755 
750 
     | 
    
         
             
            - spec/beaker/hypervisor/vsphere_helper_spec.rb
         
     | 
| 
       756 
751 
     | 
    
         
             
            - spec/beaker/hypervisor/vsphere_spec.rb
         
     | 
| 
       757 
752 
     | 
    
         
             
            - spec/beaker/logger_junit_spec.rb
         
     | 
| 
         @@ -1,45 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            [vmpooler](https://github.com/puppetlabs/vmpooler) is a puppet-built abstraction
         
     | 
| 
       2 
     | 
    
         
            -
            layer over vSphere infrastructure that pools VMs to be used by beaker & other
         
     | 
| 
       3 
     | 
    
         
            -
            systems.
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
            beaker's vmpooler hypervisor interacts with vmpooler to get Systems Under Test
         
     | 
| 
       6 
     | 
    
         
            -
            (SUTs) for testing purposes.
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
            **Note** that if you're a puppet-internal user, you'll have to setup your SSH
         
     | 
| 
       9 
     | 
    
         
            -
            keys to communicate with vmpooler SUTs. To do that, refer to our
         
     | 
| 
       10 
     | 
    
         
            -
            [internal doc](https://confluence.puppetlabs.com/display/SRE/SSH+access+to+vmpooler+VMs).
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
            # Tokens
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
            Using tokens will allow you to extend your VMs lifetime, as well as interact
         
     | 
| 
       15 
     | 
    
         
            -
            with vmpooler and your VMs in more complex ways. You can have beaker do these
         
     | 
| 
       16 
     | 
    
         
            -
            same things by providing your `vmpooler_token` in the `~/.fog` file. For more
         
     | 
| 
       17 
     | 
    
         
            -
            info about how the `.fog` file works, please refer to the
         
     | 
| 
       18 
     | 
    
         
            -
            [hypervisor README](README.md).
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
            An example of a `.fog` file with just the vmpooler details is below:
         
     | 
| 
       21 
     | 
    
         
            -
            ```yaml
         
     | 
| 
       22 
     | 
    
         
            -
            :default:
         
     | 
| 
       23 
     | 
    
         
            -
              :vmpooler_token: 'randomtokentext'
         
     | 
| 
       24 
     | 
    
         
            -
            ```
         
     | 
| 
       25 
     | 
    
         
            -
            # Additional Disks
         
     | 
| 
       26 
     | 
    
         
            -
            Using the vmpooler API, Beaker enables you to attach additional storage disks in the host configuration file. The disks are added at the time the VM is created. Logic for using the disk must go into your tests.
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
            Simply add the `disks` key and a list containing the sizes(in GB) of the disks you want to create and attach to that host.
         
     | 
| 
       29 
     | 
    
         
            -
            For example, to create 2 disks sized 8GB and 16GB to example-box:
         
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
            ```yaml
         
     | 
| 
       32 
     | 
    
         
            -
             example-box:
         
     | 
| 
       33 
     | 
    
         
            -
                disks:
         
     | 
| 
       34 
     | 
    
         
            -
                  - 8
         
     | 
| 
       35 
     | 
    
         
            -
                  - 16
         
     | 
| 
       36 
     | 
    
         
            -
                roles:
         
     | 
| 
       37 
     | 
    
         
            -
                  - satellite
         
     | 
| 
       38 
     | 
    
         
            -
                platform: el-7-x86_64
         
     | 
| 
       39 
     | 
    
         
            -
                hypervisor: vmpooler
         
     | 
| 
       40 
     | 
    
         
            -
                template: redhat-7-x86_64
         
     | 
| 
       41 
     | 
    
         
            -
            ```
         
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
            Users with Puppet credentials can follow our instructions for getting & using
         
     | 
| 
       44 
     | 
    
         
            -
            vmpooler tokens in our
         
     | 
| 
       45 
     | 
    
         
            -
            [internal documentation](https://confluence.puppetlabs.com/pages/viewpage.action?spaceKey=SRE&title=Generating+and+using+vmpooler+tokens).
         
     |