testbeat 0.5.4 → 0.6.0.pr5
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 +4 -4
- data/lib/vagrant/noderunner.rb +19 -6
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c4cb916fcd70443a5c039e2ac825361ec40bda5
|
4
|
+
data.tar.gz: 063cdc94d635898c6432449ce66b1e7fa3869442
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60fd118265277b0c8cfbecc9adedd7ff55981ba4e8c2ac8abf1497e2cbe32f05eb2764eeb5a2f9ddf6ff03405e0c219ad7ac965ea3624b5b8611803157c8f703
|
7
|
+
data.tar.gz: 8748f890402061da90bcc0d6fed766d45b6e45537ec591d9e45fda10298f2e0d74535fa98db84652c49d88e97d1cdbb1459d5a52482429eab25bbc5086f77409
|
data/lib/vagrant/noderunner.rb
CHANGED
@@ -7,6 +7,15 @@ require_relative './cookbook_decompiler.rb'
|
|
7
7
|
# dependencies for the lib running node tests, preferrably discovered here instead of in node loop
|
8
8
|
require 'rspec'
|
9
9
|
require 'set'
|
10
|
+
require 'open3'
|
11
|
+
|
12
|
+
def get_hostname(node: $node, vagrant_dir: $vagrant_dir)
|
13
|
+
[node, vagrant_dir]
|
14
|
+
cmd_hostname = "cat /etc/hostname"
|
15
|
+
hostname = Open3.popen3("cd #{ vagrant_dir + node }; vagrant ssh -c \"#{cmd_hostname}\"") { |stdin, stdout, stderr, wait_thr| stdout.read }
|
16
|
+
puts "Vagrant node hostname: #{hostname}"
|
17
|
+
return hostname
|
18
|
+
end
|
10
19
|
|
11
20
|
# Get first matching subgroup
|
12
21
|
# stripped of quotes and leading/trailing whitespace
|
@@ -101,10 +110,11 @@ def run_rspec(node, path, outf, verbose)
|
|
101
110
|
return $?.success?
|
102
111
|
end
|
103
112
|
|
104
|
-
def run_tests(recipes, out: "#{$vagrant_dir}#{$node}/generated/", testglob: "test/acceptance/*.rb", verbose: true)
|
105
|
-
[recipes, out, testglob, verbose]
|
113
|
+
def run_tests(recipes, hostname, out: "#{$vagrant_dir}#{$node}/generated/", testglob: "test/acceptance/*.rb", verbose: true)
|
114
|
+
[recipes, hostname, out, testglob, verbose]
|
106
115
|
rspec_ok = true # if no tests => no failure
|
107
116
|
|
117
|
+
puts "Starting test run for hostname: #{hostname}"
|
108
118
|
if Dir.exists?(out)
|
109
119
|
puts "Using existing output directory #{out}"
|
110
120
|
Dir.glob("#{out}acceptance*").each do |previous|
|
@@ -128,14 +138,14 @@ def run_tests(recipes, out: "#{$vagrant_dir}#{$node}/generated/", testglob: "tes
|
|
128
138
|
if not run_history.include?(path_to_file)
|
129
139
|
run_history.add(path_to_file)
|
130
140
|
just_filename = path_to_file.split("/")[-1]
|
131
|
-
rspec_ok = run_rspec(
|
141
|
+
rspec_ok = run_rspec(hostname, path_to_file, "#{out}acceptance_#{cookbook_name}_#{just_filename}", verbose) && rspec_ok
|
132
142
|
end
|
133
143
|
end
|
134
144
|
end
|
135
145
|
|
136
146
|
path_to_node_acceptance_tests = "#{$vagrant_dir}#{$node}/acceptance"
|
137
147
|
if Dir.exists?(path_to_node_acceptance_tests)
|
138
|
-
rspec_ok = run_rspec(
|
148
|
+
rspec_ok = run_rspec(hostname, "#{path_to_node_acceptance_tests}/*.rb", "#{out}acceptance_node", verbose) && rspec_ok
|
139
149
|
else
|
140
150
|
puts "No node-specific acceptance tests available for #{$node} in #{path_to_node_acceptance_tests}"
|
141
151
|
end
|
@@ -196,6 +206,7 @@ def main(node: "labs01", provider: "virtualbox", retest: false, guestint: true,
|
|
196
206
|
vagrant_cmd = cwd_to_node + "vagrant up --provider=#{provider}"
|
197
207
|
elsif /running/.match(v_status)
|
198
208
|
# Add "if runlist file older than 1 h, assume force_long"
|
209
|
+
hostname = get_hostname()
|
199
210
|
if retest and File.exists?(runlist_file)
|
200
211
|
old_run = File.read(runlist_file)
|
201
212
|
#run_match = /Run List expands to \[(.*?)\]/.match(old_run)
|
@@ -209,7 +220,7 @@ def main(node: "labs01", provider: "virtualbox", retest: false, guestint: true,
|
|
209
220
|
if guestint
|
210
221
|
rspec_ok = rspec_ok && run_integration_tests(all_cookbooks)
|
211
222
|
end
|
212
|
-
rspec_ok = rspec_ok && run_tests(all_cookbooks)
|
223
|
+
rspec_ok = rspec_ok && run_tests(all_cookbooks, hostname)
|
213
224
|
if not rspec_ok
|
214
225
|
puts "There were test failures!"
|
215
226
|
exit 1
|
@@ -261,6 +272,8 @@ def main(node: "labs01", provider: "virtualbox", retest: false, guestint: true,
|
|
261
272
|
exit 1
|
262
273
|
else
|
263
274
|
puts "Vagrant provision completed."
|
275
|
+
hostname = get_hostname()
|
276
|
+
|
264
277
|
# Run List expands to [repos-channel::haproxy, cms-base::folderstructure, repos-apache2, repos-subversion, repos-rweb, repos-trac, repos-liveserver, repos-indexing, repos-snapshot, repos-vagrant-labs]
|
265
278
|
run_match = /Run List expands to \[(.*?)\]/.match(vagrant_run_output)
|
266
279
|
if run_match
|
@@ -278,7 +291,7 @@ def main(node: "labs01", provider: "virtualbox", retest: false, guestint: true,
|
|
278
291
|
if guestint
|
279
292
|
rspec_ok = rspec_ok && run_integration_tests(all_cookbooks)
|
280
293
|
end
|
281
|
-
rspec_ok = rspec_ok && run_tests(all_cookbooks)
|
294
|
+
rspec_ok = rspec_ok && run_tests(all_cookbooks, hostname)
|
282
295
|
if not rspec_ok
|
283
296
|
exit 1
|
284
297
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: testbeat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0.pr5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Staffan Olsson
|
@@ -78,12 +78,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
78
78
|
version: '2.0'
|
79
79
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
|
-
- - '
|
81
|
+
- - '>'
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version:
|
83
|
+
version: 1.3.1
|
84
84
|
requirements: []
|
85
85
|
rubyforge_project:
|
86
|
-
rubygems_version: 2.0.14
|
86
|
+
rubygems_version: 2.0.14.1
|
87
87
|
signing_key:
|
88
88
|
specification_version: 4
|
89
89
|
summary: REST acceptance testing framework
|