beaker-pe 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +25 -0
- data/.rspec +3 -0
- data/.simplecov +9 -0
- data/Gemfile +31 -0
- data/HISTORY.md +8 -0
- data/LICENSE +202 -0
- data/README.md +37 -0
- data/Rakefile +154 -0
- data/acceptance/config/nodes/vagrant-ubuntu-1404.yml +8 -0
- data/acceptance/tests/first.rb +14 -0
- data/beaker-pe.gemspec +37 -0
- data/bin/beaker-template +32 -0
- data/lib/beaker-pe.rb +25 -0
- data/lib/beaker-pe/install/pe_utils.rb +728 -0
- data/lib/beaker-pe/options/pe_version_scraper.rb +35 -0
- data/lib/beaker-pe/version.rb +11 -0
- data/spec/beaker-pe/helpers_spec.rb +21 -0
- data/spec/beaker-pe/install/pe_utils_spec.rb +916 -0
- data/spec/beaker-pe/options/pe_version_scaper_spec.rb +30 -0
- data/spec/helpers.rb +109 -0
- data/spec/spec_helper.rb +10 -0
- metadata +207 -0
@@ -0,0 +1,30 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
module Beaker
|
4
|
+
module Options
|
5
|
+
describe PEVersionScraper do
|
6
|
+
it "can pull version from local LATEST file" do
|
7
|
+
filename = 'LATEST'
|
8
|
+
latest = File.open(filename, 'w')
|
9
|
+
latest.write('3.7.1-rc0-8-g73f93cb')
|
10
|
+
latest.close
|
11
|
+
expect(PEVersionScraper.load_pe_version('.', filename)).to be === "3.7.1-rc0-8-g73f93cb"
|
12
|
+
File.delete(filename)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "can pull version from preview LATEST file" do
|
16
|
+
filename = 'LATEST'
|
17
|
+
latest = File.open(filename, 'w')
|
18
|
+
latest.write('3.8.1')
|
19
|
+
latest.close
|
20
|
+
expect(PEVersionScraper.load_pe_version('.', filename)).to be === '3.8.1'
|
21
|
+
File.delete(filename)
|
22
|
+
end
|
23
|
+
|
24
|
+
it "raises error when file doesn't exist" do
|
25
|
+
expect{PEVersionScraper.load_pe_version("not a valid path", "not a valid filename")}.to raise_error(ArgumentError)
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/spec/helpers.rb
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
module TestFileHelpers
|
2
|
+
def create_files file_array
|
3
|
+
file_array.each do |f|
|
4
|
+
FileUtils.mkdir_p File.dirname(f)
|
5
|
+
FileUtils.touch f
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
def fog_file_contents
|
10
|
+
{ :default => { :aws_access_key_id => "IMANACCESSKEY",
|
11
|
+
:aws_secret_access_key => "supersekritkey",
|
12
|
+
:aix_hypervisor_server => "aix_hypervisor.labs.net",
|
13
|
+
:aix_hypervisor_username => "aixer",
|
14
|
+
:aix_hypervisor_keyfile => "/Users/user/.ssh/id_rsa-acceptance",
|
15
|
+
:solaris_hypervisor_server => "solaris_hypervisor.labs.net",
|
16
|
+
:solaris_hypervisor_username => "harness",
|
17
|
+
:solaris_hypervisor_keyfile => "/Users/user/.ssh/id_rsa-old.private",
|
18
|
+
:solaris_hypervisor_vmpath => "rpoooool/zs",
|
19
|
+
:solaris_hypervisor_snappaths => ["rpoooool/USER/z0"],
|
20
|
+
:vsphere_server => "vsphere.labs.net",
|
21
|
+
:vsphere_username => "vsphere@labs.com",
|
22
|
+
:vsphere_password => "supersekritpassword"} }
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
module HostHelpers
|
28
|
+
HOST_DEFAULTS = { :platform => 'unix',
|
29
|
+
:snapshot => 'pe',
|
30
|
+
:box => 'box_name',
|
31
|
+
:roles => ['agent'],
|
32
|
+
:snapshot => 'snap',
|
33
|
+
:ip => 'default.ip.address',
|
34
|
+
:box => 'default_box_name',
|
35
|
+
:box_url => 'http://default.box.url',
|
36
|
+
}
|
37
|
+
|
38
|
+
HOST_NAME = "vm%d"
|
39
|
+
HOST_SNAPSHOT = "snapshot%d"
|
40
|
+
HOST_IP = "ip.address.for.%s"
|
41
|
+
HOST_BOX = "%s_of_my_box"
|
42
|
+
HOST_BOX_URL = "http://address.for.my.box.%s"
|
43
|
+
HOST_TEMPLATE = "%s_has_a_template"
|
44
|
+
|
45
|
+
def logger
|
46
|
+
double( 'logger' ).as_null_object
|
47
|
+
end
|
48
|
+
|
49
|
+
def make_opts
|
50
|
+
opts = StringifyHash.new
|
51
|
+
opts.merge( { :logger => logger,
|
52
|
+
:host_config => 'sample.config',
|
53
|
+
:type => nil,
|
54
|
+
:pooling_api => 'http://vcloud.delivery.puppetlabs.net/',
|
55
|
+
:datastore => 'instance0',
|
56
|
+
:folder => 'Delivery/Quality Assurance/Staging/Dynamic',
|
57
|
+
:resourcepool => 'delivery/Quality Assurance/Staging/Dynamic',
|
58
|
+
:gce_project => 'beaker-compute',
|
59
|
+
:gce_keyfile => '/path/to/keyfile.p12',
|
60
|
+
:gce_password => 'notasecret',
|
61
|
+
:gce_email => '12345678910@developer.gserviceaccount.com' } )
|
62
|
+
end
|
63
|
+
|
64
|
+
def generate_result (name, opts )
|
65
|
+
result = double( 'result' )
|
66
|
+
stdout = opts.has_key?(:stdout) ? opts[:stdout] : name
|
67
|
+
stderr = opts.has_key?(:stderr) ? opts[:stderr] : name
|
68
|
+
exit_code = opts.has_key?(:exit_code) ? opts[:exit_code] : 0
|
69
|
+
exit_code = [exit_code].flatten
|
70
|
+
allow( result ).to receive( :stdout ).and_return( stdout )
|
71
|
+
allow( result ).to receive( :stderr ).and_return( stderr )
|
72
|
+
allow( result ).to receive( :exit_code ).and_return( *exit_code )
|
73
|
+
result
|
74
|
+
end
|
75
|
+
|
76
|
+
def make_host_opts name, opts
|
77
|
+
make_opts.merge( { 'HOSTS' => { name => opts } } ).merge( opts )
|
78
|
+
end
|
79
|
+
|
80
|
+
def make_host name, host_hash
|
81
|
+
host_hash = StringifyHash.new.merge(HOST_DEFAULTS.merge(host_hash))
|
82
|
+
|
83
|
+
host = make_opts.merge(host_hash)
|
84
|
+
|
85
|
+
allow(host).to receive( :name ).and_return( name )
|
86
|
+
allow(host).to receive( :to_s ).and_return( name )
|
87
|
+
allow(host).to receive( :exec ).and_return( generate_result( name, host_hash ) )
|
88
|
+
host
|
89
|
+
end
|
90
|
+
|
91
|
+
def make_hosts preset_opts = {}, amt = 3
|
92
|
+
hosts = []
|
93
|
+
(1..amt).each do |num|
|
94
|
+
name = HOST_NAME % num
|
95
|
+
opts = { :snapshot => HOST_SNAPSHOT % num,
|
96
|
+
:ip => HOST_IP % name,
|
97
|
+
:template => HOST_TEMPLATE % name,
|
98
|
+
:box => HOST_BOX % name,
|
99
|
+
:box_url => HOST_BOX_URL % name }.merge( preset_opts )
|
100
|
+
hosts << make_host(name, opts)
|
101
|
+
end
|
102
|
+
hosts
|
103
|
+
end
|
104
|
+
|
105
|
+
def make_instance instance_data = {}
|
106
|
+
OpenStruct.new instance_data
|
107
|
+
end
|
108
|
+
|
109
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,207 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: beaker-pe
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Puppetlabs
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-02-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec-its
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: fakefs
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.6'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.6'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.1'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.1'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: simplecov
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ! '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ! '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.10'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ~>
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.10'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: yard
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ! '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: markdown
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ! '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: thin
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ! '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ! '>='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: stringify-hash
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ~>
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 0.0.0
|
146
|
+
type: :runtime
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ~>
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 0.0.0
|
153
|
+
description: Puppet Enterprise (PE) Install & Helper library
|
154
|
+
email:
|
155
|
+
- qe-team@puppetlabs.com
|
156
|
+
executables:
|
157
|
+
- beaker-template
|
158
|
+
extensions: []
|
159
|
+
extra_rdoc_files: []
|
160
|
+
files:
|
161
|
+
- .gitignore
|
162
|
+
- .rspec
|
163
|
+
- .simplecov
|
164
|
+
- Gemfile
|
165
|
+
- HISTORY.md
|
166
|
+
- LICENSE
|
167
|
+
- README.md
|
168
|
+
- Rakefile
|
169
|
+
- acceptance/config/nodes/vagrant-ubuntu-1404.yml
|
170
|
+
- acceptance/tests/first.rb
|
171
|
+
- beaker-pe.gemspec
|
172
|
+
- bin/beaker-template
|
173
|
+
- lib/beaker-pe.rb
|
174
|
+
- lib/beaker-pe/install/pe_utils.rb
|
175
|
+
- lib/beaker-pe/options/pe_version_scraper.rb
|
176
|
+
- lib/beaker-pe/version.rb
|
177
|
+
- spec/beaker-pe/helpers_spec.rb
|
178
|
+
- spec/beaker-pe/install/pe_utils_spec.rb
|
179
|
+
- spec/beaker-pe/options/pe_version_scaper_spec.rb
|
180
|
+
- spec/helpers.rb
|
181
|
+
- spec/spec_helper.rb
|
182
|
+
homepage: https://github.com/puppetlabs/beaker-pe
|
183
|
+
licenses:
|
184
|
+
- Apache2
|
185
|
+
metadata: {}
|
186
|
+
post_install_message:
|
187
|
+
rdoc_options: []
|
188
|
+
require_paths:
|
189
|
+
- lib
|
190
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - ! '>='
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0'
|
195
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
196
|
+
requirements:
|
197
|
+
- - ! '>='
|
198
|
+
- !ruby/object:Gem::Version
|
199
|
+
version: '0'
|
200
|
+
requirements: []
|
201
|
+
rubyforge_project:
|
202
|
+
rubygems_version: 2.4.6
|
203
|
+
signing_key:
|
204
|
+
specification_version: 4
|
205
|
+
summary: Beaker PE DSL Helpers!
|
206
|
+
test_files: []
|
207
|
+
has_rdoc:
|