onceover 3.10.2 → 3.11.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 +5 -5
- data/lib/onceover/cli/run.rb +1 -0
- data/lib/onceover/runner.rb +18 -3
- data/lib/onceover/testconfig.rb +8 -0
- data/onceover.gemspec +2 -1
- data/templates/spec_helper.rb.erb +25 -1
- metadata +17 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 71d240d281209575819137b3b4a0d8128d049d8df9482bc679f2915107f74a40
|
4
|
+
data.tar.gz: add61e481be9978f6dc492eb351d0f3b43d248119d3b94b98132c7323495e52a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea96a764d79607406e3c89fd0aea91b568c70902ba88b1d30cc7cf2619eb7a204a43764dd12abc74cca7cf25ad5d79dcd18e0dd02ad3a2689b6e9363b1db4d4e
|
7
|
+
data.tar.gz: d35d26e20dbc980b22775784e1a3945c0251cf2f554fc320ae3ce24ed113d39c21b25aec37353e5d177e29ea0c47a3d7ddf7af16e305e2a36f8e7295239e68bd
|
data/lib/onceover/cli/run.rb
CHANGED
@@ -41,6 +41,7 @@ This includes deploying using r10k and running all custom tests.
|
|
41
41
|
summary 'Runs spec tests'
|
42
42
|
|
43
43
|
optional :p, :parallel, 'Runs spec tests in parallel. This increases speed at the cost of poorly formatted logs and irrelevant junit output.'
|
44
|
+
optional nil, :format, 'Which RSpec formatter to use, valid options are: documentation, progress, FailureCollector. You also specify this multiple times', multiple: true, default: :defaults
|
44
45
|
|
45
46
|
run do |opts, args, cmd|
|
46
47
|
repo = Onceover::Controlrepo.new(opts)
|
data/lib/onceover/runner.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'backticks'
|
2
|
+
|
1
3
|
class Onceover
|
2
4
|
class Runner
|
3
5
|
attr_reader :repo
|
@@ -15,6 +17,9 @@ class Onceover
|
|
15
17
|
# all the latest tests
|
16
18
|
FileUtils.rm_rf("#{@repo.tempdir}/spec")
|
17
19
|
|
20
|
+
# Remove any previous failure log
|
21
|
+
FileUtils.rm_f("#{@repo.tempdir}/failures.out")
|
22
|
+
|
18
23
|
# Create the other directories we need
|
19
24
|
FileUtils.mkdir_p("#{@repo.tempdir}/spec/classes")
|
20
25
|
FileUtils.mkdir_p("#{@repo.tempdir}/spec/acceptance/nodesets")
|
@@ -74,10 +79,20 @@ class Onceover
|
|
74
79
|
#`bin/rake spec_standalone`
|
75
80
|
if @config.opts[:parallel]
|
76
81
|
logger.debug "Running #{@command_prefix}rake parallel_spec from #{@repo.tempdir}"
|
77
|
-
|
82
|
+
Backticks::Runner.new(interactive:true).run(@command_prefix.strip.split, 'rake', 'parallel_spec').join
|
78
83
|
else
|
79
84
|
logger.debug "Running #{@command_prefix}rake spec_standalone from #{@repo.tempdir}"
|
80
|
-
|
85
|
+
Backticks::Runner.new(interactive:true).run(@command_prefix.strip.split, 'rake', 'spec_standalone').join
|
86
|
+
end
|
87
|
+
# TODO: Refactor this to be much nicer
|
88
|
+
if @config.formatters.include? 'FailureCollector'
|
89
|
+
puts '----------- Summary of failures -----------'
|
90
|
+
if File.exist?("#{@repo.tempdir}/failures.out") and ! File.zero?("#{@repo.tempdir}/failures.out")
|
91
|
+
logger.debug "Reading failures from #{@repo.tempdir}/failures.out"
|
92
|
+
puts File.read("#{@repo.tempdir}/failures.out")
|
93
|
+
else
|
94
|
+
puts 'No failures detected'
|
95
|
+
end
|
81
96
|
end
|
82
97
|
end
|
83
98
|
end
|
@@ -89,7 +104,7 @@ class Onceover
|
|
89
104
|
#`bundle install --binstubs`
|
90
105
|
#`bin/rake spec_standalone`
|
91
106
|
logger.debug "Running #{@command_prefix}rake acceptance from #{@repo.tempdir}"
|
92
|
-
|
107
|
+
Backticks::Runner.new(interactive:true).run(@command_prefix.strip.split, 'rake', 'acceptance').join
|
93
108
|
end
|
94
109
|
end
|
95
110
|
end
|
data/lib/onceover/testconfig.rb
CHANGED
@@ -28,6 +28,7 @@ class Onceover
|
|
28
28
|
attr_accessor :skip_r10k
|
29
29
|
attr_accessor :force
|
30
30
|
attr_accessor :strict_variables
|
31
|
+
attr_accessor :formatters
|
31
32
|
|
32
33
|
def initialize(file, opts = {})
|
33
34
|
begin
|
@@ -49,6 +50,13 @@ class Onceover
|
|
49
50
|
@before_conditions = config['before']
|
50
51
|
@after_conditions = config['after']
|
51
52
|
@strict_variables = opts[:strict_variables] ? 'yes' : 'no'
|
53
|
+
|
54
|
+
# Set dynamic defaults for format
|
55
|
+
if opts[:format] == [:defaults]
|
56
|
+
@formatters = opts[:parallel] ? ['documentation', 'FailureCollector'] : ['documentation']
|
57
|
+
else
|
58
|
+
@formatters = opts[:format]
|
59
|
+
end
|
52
60
|
|
53
61
|
# Initialise all of the classes and nodes
|
54
62
|
config['classes'].each { |clarse| Onceover::Class.new(clarse) } unless config['classes'] == nil
|
data/onceover.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = "onceover"
|
7
|
-
s.version = "3.
|
7
|
+
s.version = "3.11.0"
|
8
8
|
s.authors = ["Dylan Ratcliffe"]
|
9
9
|
s.email = ["dylan.ratcliffe@puppet.com"]
|
10
10
|
s.homepage = "https://github.com/dylanratcliffe/onceover"
|
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
# Runtime dependencies, but also probably dependencies of requiring projects
|
21
21
|
s.add_runtime_dependency 'rake', '>= 10.0.0'
|
22
22
|
s.add_runtime_dependency 'json', '>= 1.8.2'
|
23
|
+
s.add_runtime_dependency 'backticks', '>= 1.0.2'
|
23
24
|
s.add_runtime_dependency 'rspec-puppet', ">= 2.4.0"
|
24
25
|
s.add_runtime_dependency 'parallel_tests', ">= 2.0.0"
|
25
26
|
s.add_runtime_dependency 'puppetlabs_spec_helper', ">= 0.4.0"
|
@@ -15,12 +15,36 @@ end
|
|
15
15
|
require 'puppetlabs_spec_helper/module_spec_helper'
|
16
16
|
require 'rspec_junit_formatter'
|
17
17
|
|
18
|
+
class FailureCollector
|
19
|
+
RSpec::Core::Formatters.register self, :dump_failures
|
20
|
+
|
21
|
+
def initialize(output)
|
22
|
+
@output = output
|
23
|
+
puts "Initializing FailureCollector"
|
24
|
+
FileUtils.touch(File.expand_path('<%= repo.tempdir %>/failures.out'))
|
25
|
+
end
|
26
|
+
|
27
|
+
def dump_failures(failures)
|
28
|
+
open(File.expand_path('<%= repo.tempdir %>/failures.out'), 'a') { |f|
|
29
|
+
failures.failed_examples.each do |fe|
|
30
|
+
f.puts
|
31
|
+
f.puts "#{fe.metadata[:description]}"
|
32
|
+
f.puts "#{fe.metadata[:execution_result].exception.to_s}"
|
33
|
+
f.puts "#{fe.metadata[:file_path]}:#{fe.metadata[:line_number]}"
|
34
|
+
f.puts "------------------------------------------------------"
|
35
|
+
end
|
36
|
+
}
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
18
40
|
RSpec.configure do |c|
|
19
41
|
# Also add JUnit output in case people want to use that
|
20
42
|
c.add_formatter('RSpecJUnitFormatter','<%= repo.tempdir %>/spec.xml')
|
21
43
|
|
22
44
|
c.parser = 'future'
|
23
|
-
|
45
|
+
<% @formatters.each do |fm| -%>
|
46
|
+
c.formatter = '<%= fm %>'
|
47
|
+
<% end -%>
|
24
48
|
c.trusted_server_facts = true
|
25
49
|
c.environmentpath = '<%= environmentpath %>'
|
26
50
|
c.module_path = '<%= modulepath %>'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: onceover
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dylan Ratcliffe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-02-
|
11
|
+
date: 2019-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 1.8.2
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: backticks
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.0.2
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.0.2
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rspec-puppet
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -434,8 +448,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
434
448
|
- !ruby/object:Gem::Version
|
435
449
|
version: '0'
|
436
450
|
requirements: []
|
437
|
-
|
438
|
-
rubygems_version: 2.6.14
|
451
|
+
rubygems_version: 3.0.1
|
439
452
|
signing_key:
|
440
453
|
specification_version: 4
|
441
454
|
summary: Testing tools for Puppet controlrepos
|