beaker-answers 0.0.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 +3 -0
- data/LICENSE +202 -0
- data/README.md +2 -0
- data/Rakefile +7 -0
- data/beaker-answers.gemspec +38 -0
- data/bin/beaker-answers +32 -0
- data/lib/beaker-answers.rb +6 -0
- data/lib/beaker-answers/answers.rb +152 -0
- data/lib/beaker-answers/version.rb +5 -0
- data/lib/beaker-answers/versions/version20.rb +126 -0
- data/lib/beaker-answers/versions/version28.rb +126 -0
- data/lib/beaker-answers/versions/version30.rb +233 -0
- data/lib/beaker-answers/versions/version32.rb +49 -0
- data/lib/beaker-answers/versions/version34.rb +56 -0
- data/lib/beaker-answers/versions/version38.rb +34 -0
- data/lib/beaker-answers/versions/version40.rb +49 -0
- data/spec/beaker-answers/beaker-answers_spec.rb +532 -0
- data/spec/helpers.rb +109 -0
- data/spec/spec_helper.rb +10 -0
- metadata +226 -0
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,226 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: beaker-answers
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Puppetlabs
|
8
|
+
- anode
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2015-08-04 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rspec
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ~>
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '3.0'
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ~>
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '3.0'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rspec-its
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ! '>='
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ! '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: fakefs
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ~>
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0.6'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ~>
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0.6'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: rake
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ~>
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '10.1'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '10.1'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: simplecov
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ! '>='
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: pry
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ~>
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0.10'
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ~>
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0.10'
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: yard
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ! '>='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ! '>='
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: markdown
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ! '>='
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: thin
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - ! '>='
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
type: :development
|
134
|
+
prerelease: false
|
135
|
+
version_requirements: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ! '>='
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
- !ruby/object:Gem::Dependency
|
141
|
+
name: stringify-hash
|
142
|
+
requirement: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - ~>
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: 0.0.0
|
147
|
+
type: :runtime
|
148
|
+
prerelease: false
|
149
|
+
version_requirements: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - ~>
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: 0.0.0
|
154
|
+
- !ruby/object:Gem::Dependency
|
155
|
+
name: require_all
|
156
|
+
requirement: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - ~>
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: 1.3.2
|
161
|
+
type: :runtime
|
162
|
+
prerelease: false
|
163
|
+
version_requirements: !ruby/object:Gem::Requirement
|
164
|
+
requirements:
|
165
|
+
- - ~>
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: 1.3.2
|
168
|
+
description: For use for the Beaker acceptance testing tool
|
169
|
+
email:
|
170
|
+
- qe-team@puppetlabs.com
|
171
|
+
executables:
|
172
|
+
- beaker-answers
|
173
|
+
extensions: []
|
174
|
+
extra_rdoc_files: []
|
175
|
+
files:
|
176
|
+
- .gitignore
|
177
|
+
- .rspec
|
178
|
+
- .simplecov
|
179
|
+
- Gemfile
|
180
|
+
- LICENSE
|
181
|
+
- README.md
|
182
|
+
- Rakefile
|
183
|
+
- beaker-answers.gemspec
|
184
|
+
- bin/beaker-answers
|
185
|
+
- lib/beaker-answers.rb
|
186
|
+
- lib/beaker-answers/answers.rb
|
187
|
+
- lib/beaker-answers/version.rb
|
188
|
+
- lib/beaker-answers/versions/version20.rb
|
189
|
+
- lib/beaker-answers/versions/version28.rb
|
190
|
+
- lib/beaker-answers/versions/version30.rb
|
191
|
+
- lib/beaker-answers/versions/version32.rb
|
192
|
+
- lib/beaker-answers/versions/version34.rb
|
193
|
+
- lib/beaker-answers/versions/version38.rb
|
194
|
+
- lib/beaker-answers/versions/version40.rb
|
195
|
+
- spec/beaker-answers/beaker-answers_spec.rb
|
196
|
+
- spec/helpers.rb
|
197
|
+
- spec/spec_helper.rb
|
198
|
+
homepage: https://github.com/puppetlabs/beaker-answers
|
199
|
+
licenses:
|
200
|
+
- Apache2
|
201
|
+
metadata: {}
|
202
|
+
post_install_message:
|
203
|
+
rdoc_options: []
|
204
|
+
require_paths:
|
205
|
+
- lib
|
206
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
207
|
+
requirements:
|
208
|
+
- - ! '>='
|
209
|
+
- !ruby/object:Gem::Version
|
210
|
+
version: '0'
|
211
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
212
|
+
requirements:
|
213
|
+
- - ! '>='
|
214
|
+
- !ruby/object:Gem::Version
|
215
|
+
version: '0'
|
216
|
+
requirements: []
|
217
|
+
rubyforge_project:
|
218
|
+
rubygems_version: 2.4.5
|
219
|
+
signing_key:
|
220
|
+
specification_version: 4
|
221
|
+
summary: Answer generation for PE Installation!
|
222
|
+
test_files:
|
223
|
+
- spec/beaker-answers/beaker-answers_spec.rb
|
224
|
+
- spec/helpers.rb
|
225
|
+
- spec/spec_helper.rb
|
226
|
+
has_rdoc:
|