beaker 1.8.1 → 1.8.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +8 -8
  2. data/bin/beaker +1 -1
  3. data/lib/beaker.rb +1 -1
  4. data/lib/beaker/cli.rb +15 -35
  5. data/lib/beaker/host_prebuilt_steps.rb +335 -0
  6. data/lib/beaker/hypervisor.rb +53 -4
  7. data/lib/beaker/hypervisor/aixer.rb +2 -2
  8. data/lib/beaker/hypervisor/blimper.rb +5 -5
  9. data/lib/beaker/hypervisor/fusion.rb +3 -3
  10. data/lib/beaker/hypervisor/solaris.rb +2 -2
  11. data/lib/beaker/hypervisor/vagrant.rb +6 -16
  12. data/lib/beaker/hypervisor/vcloud.rb +6 -6
  13. data/lib/beaker/hypervisor/vcloud_pooled.rb +4 -4
  14. data/lib/beaker/hypervisor/vsphere.rb +3 -3
  15. data/lib/beaker/network_manager.rb +51 -37
  16. data/lib/beaker/options/presets.rb +1 -0
  17. data/lib/beaker/shared.rb +2 -2
  18. data/lib/beaker/shared/host_role_parser.rb +36 -0
  19. data/lib/beaker/version.rb +1 -1
  20. data/spec/beaker/host_prebuilt_steps_spec.rb +421 -0
  21. data/spec/beaker/hypervisor/google_compute.rb +23 -0
  22. data/spec/beaker/hypervisor/vagrant_spec.rb +5 -4
  23. data/spec/beaker/hypervisor/vcloud_pooled_spec.rb +2 -2
  24. data/spec/beaker/hypervisor/vcloud_spec.rb +2 -2
  25. data/spec/beaker/hypervisor/vsphere_spec.rb +2 -2
  26. data/spec/beaker/options/parser_spec.rb +1 -1
  27. data/spec/beaker/shared/host_role_parser_spec.rb +58 -0
  28. metadata +10 -18
  29. data/lib/beaker/shared/host_handler.rb +0 -51
  30. data/lib/beaker/utils.rb +0 -7
  31. data/lib/beaker/utils/ntp_control.rb +0 -57
  32. data/lib/beaker/utils/repo_control.rb +0 -90
  33. data/lib/beaker/utils/setup_helper.rb +0 -66
  34. data/lib/beaker/utils/validator.rb +0 -36
  35. data/spec/beaker/shared/host_handler_spec.rb +0 -104
  36. data/spec/beaker/utils/ntp_control_spec.rb +0 -70
  37. data/spec/beaker/utils/repo_control_spec.rb +0 -168
  38. data/spec/beaker/utils/setup_helper_spec.rb +0 -82
  39. data/spec/beaker/utils/validator_spec.rb +0 -91
@@ -1,82 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Beaker
4
- module Utils
5
- describe SetupHelper do
6
- let( :setup_helper ) { Beaker::Utils::SetupHelper.new( make_opts, hosts) }
7
- let( :sync_cmd ) { Beaker::Utils::SetupHelper::ROOT_KEYS_SYNC_CMD }
8
- let( :platform ) { @platform || 'unix' }
9
- let( :ip ) { "ip.address.0.0" }
10
- let( :stdout) { @stdout || ip }
11
- let( :hosts ) { hosts = make_hosts( { :stdout => stdout, :platform => platform } )
12
- hosts[0][:roles] = ['agent']
13
- hosts[1][:roles] = ['master', 'dashboard', 'agent', 'database']
14
- hosts[2][:roles] = ['agent']
15
- hosts }
16
-
17
- context "add_master_entry" do
18
-
19
- it "can configure /etc/hosts on a unix master" do
20
- path = Beaker::Utils::SetupHelper::ETC_HOSTS_PATH
21
- master = setup_helper.only_host_with_role(hosts, :master)
22
-
23
- Command.should_receive( :new ).with( "ip a|awk '/global/{print$2}' | cut -d/ -f1 | head -1" ).once
24
- Command.should_receive( :new ).with( "cp %s %s.old" % [path, path] ).once
25
- Command.should_receive( :new ).with( "cp %s %s.new" % [path, path] ).once
26
- Command.should_receive( :new ).with( "grep -v '#{ip} #{master}' %s > %s.new" % [path, path] ).once
27
- Command.should_receive( :new ).with( "echo '#{ip} #{master}' >> %s.new" % path ).once
28
- Command.should_receive( :new ).with( "mv %s.new %s" % [path, path] ).once
29
-
30
- setup_helper.add_master_entry
31
- end
32
-
33
- it "can configure /etc/hosts on a solaris master" do
34
- @platform = 'solaris'
35
- path = Beaker::Utils::SetupHelper::ETC_HOSTS_PATH_SOLARIS
36
- master = setup_helper.only_host_with_role(hosts, :master)
37
-
38
- Command.should_receive( :new ).with( "ifconfig -a inet| awk '/broadcast/ {print $2}' | cut -d/ -f1 | head -1" ).once
39
- Command.should_receive( :new ).with( "cp %s %s.old" % [path, path] ).once
40
- Command.should_receive( :new ).with( "cp %s %s.new" % [path, path] ).once
41
- Command.should_receive( :new ).with( "grep -v '#{ip} #{master}' %s > %s.new" % [path, path] ).once
42
- Command.should_receive( :new ).with( "echo '#{ip} #{master}' >> %s.new" % path ).once
43
- Command.should_receive( :new ).with( "mv %s.new %s" % [path, path] ).once
44
-
45
- setup_helper.add_master_entry
46
- end
47
-
48
- it "does nothing on a vagrant master" do
49
- master = setup_helper.only_host_with_role(hosts, :master)
50
- master[:hypervisor] = 'vagrant'
51
-
52
- Command.should_receive( :new ).never
53
-
54
- setup_helper.add_master_entry
55
-
56
- end
57
- end
58
-
59
- context "sync_root_keys" do
60
-
61
- it "can sync keys on a solaris host" do
62
- @platform = 'solaris'
63
-
64
- Command.should_receive( :new ).with( sync_cmd % "bash" ).exactly( 3 ).times
65
-
66
- setup_helper.sync_root_keys
67
-
68
- end
69
-
70
- it "can sync keys on a non-solaris host" do
71
-
72
- Command.should_receive( :new ).with( sync_cmd % "env PATH=/usr/gnu/bin:$PATH bash" ).exactly( 3 ).times
73
-
74
- setup_helper.sync_root_keys
75
-
76
- end
77
-
78
- end
79
-
80
- end
81
- end
82
- end
@@ -1,91 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Beaker
4
- module Utils
5
- describe Validator do
6
- let( :validator ) { Beaker::Utils::Validator }
7
- let( :pkgs ) { Beaker::Utils::Validator::PACKAGES }
8
- let( :unix_only_pkgs ) { Beaker::Utils::Validator::UNIX_PACKAGES }
9
- let( :sles_only_pkgs ) { Beaker::Utils::Validator::SLES_PACKAGES }
10
- let( :platform ) { @platform || 'unix' }
11
- let( :hosts ) { hosts = make_hosts( { :platform => platform } )
12
- hosts[0][:roles] = ['agent']
13
- hosts[1][:roles] = ['master', 'dashboard', 'agent', 'database']
14
- hosts[2][:roles] = ['agent']
15
- hosts }
16
-
17
- context "can validate the SUTs" do
18
-
19
- it "can validate unix hosts" do
20
-
21
- hosts.each do |host|
22
- pkgs.each do |pkg|
23
- host.should_receive( :check_for_package ).with( pkg ).once.and_return( false )
24
- host.should_receive( :install_package ).with( pkg ).once
25
- end
26
- unix_only_pkgs.each do |pkg|
27
- host.should_receive( :check_for_package ).with( pkg ).once.and_return( false )
28
- host.should_receive( :install_package ).with( pkg ).once
29
- end
30
- sles_only_pkgs.each do |pkg|
31
- host.should_receive( :check_for_package).with( pkg ).never
32
- host.should_receive( :install_package ).with( pkg ).never
33
- end
34
-
35
- end
36
-
37
- validator.validate(hosts, logger)
38
-
39
- end
40
-
41
- it "can validate windows hosts" do
42
- @platform = 'windows'
43
-
44
- hosts.each do |host|
45
- pkgs.each do |pkg|
46
- host.should_receive( :check_for_package ).with( pkg ).once.and_return( false )
47
- host.should_receive( :install_package ).with( pkg ).once
48
- end
49
- unix_only_pkgs.each do |pkg|
50
- host.should_receive( :check_for_package).with( pkg ).never
51
- host.should_receive( :install_package ).with( pkg ).never
52
- end
53
- sles_only_pkgs.each do |pkg|
54
- host.should_receive( :check_for_package).with( pkg ).never
55
- host.should_receive( :install_package ).with( pkg ).never
56
- end
57
-
58
- end
59
-
60
- validator.validate(hosts, logger)
61
-
62
- end
63
-
64
- it "can validate SLES hosts" do
65
- @platform = 'sles-13.1-x64'
66
-
67
- hosts.each do |host|
68
- pkgs.each do |pkg|
69
- host.should_receive( :check_for_package ).with( pkg ).once.and_return( false )
70
- host.should_receive( :install_package ).with( pkg ).once
71
- end
72
- unix_only_pkgs.each do |pkg|
73
- host.should_receive( :check_for_package).with( pkg ).never
74
- host.should_receive( :install_package ).with( pkg ).never
75
- end
76
- sles_only_pkgs.each do |pkg|
77
- host.should_receive( :check_for_package).with( pkg ).once.and_return( false )
78
- host.should_receive( :install_package ).with( pkg ).once
79
- end
80
-
81
- end
82
-
83
- validator.validate(hosts, logger)
84
-
85
- end
86
- end
87
-
88
-
89
- end
90
- end
91
- end