onceover 3.4.0 → 3.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fbd681c6ca1d609e55aee2198acff4fa441202f0
4
- data.tar.gz: 29cdca53f97cfa82509f52352b0290b36f00b513
3
+ metadata.gz: 6b48ef84c14842fdf39cc9decc7322e6f966a3aa
4
+ data.tar.gz: 6717a0dec46178c50c88c13e3aed1ec89a9123b0
5
5
  SHA512:
6
- metadata.gz: 57c18aa22e76170b33ebb9d69d18b719cbd19632947dc0d7a76b299db15e11673ce8349c548c385588ba3a5a335b3ad95532fd833aebb51319dc0481cd58d506
7
- data.tar.gz: f804fd467e69d54b70f1109bb6492b17d583cd8aca62fd6f16fb4ad3a6edb7d9ea8985771822bc58cf612cad42573d4e9a6f5900a588b867045547cd681d5fed
6
+ metadata.gz: a5fce0ccde2a96a228025549a434729d0cb6bc05032ed71d120b9873f626e7c9507f5291b141934da922e4dbefe58160f5cb3cbd844ce79293b22aca6922a178
7
+ data.tar.gz: 6b2f3fd0a312a4159605e509e4805e066322eaa4c5a58ec6dd13ae9527b00cf0dcd4a2c30ff15ed71dfd38b7bb56c4663341b9481fe4dd7b18aa9827e6131d0c
data/README.md CHANGED
@@ -20,6 +20,7 @@ Onceover is a tool to automatically run basic tests on an entire Puppet controlr
20
20
  - [Using Workarounds](#using-workarounds)
21
21
  - [Extra tooling](#extra-tooling)
22
22
  - [Plugins](#plugins)
23
+ - [Overriding Onceover's Templates](#overriding-onceovers-templates)
23
24
  - [Accessing Onceover in a traditional RSpec test](#accessing-onceover-in-a-traditional-rspec-test)
24
25
  - [Accessing fact sets in a traditional RSpec test](#accessing-fact-sets-in-a-traditional-rspec-test)
25
26
  - [Accessing Roles in a traditional RSpec test](#accessing-roles-in-a-traditional-rspec-test)
@@ -122,7 +123,7 @@ before:
122
123
 
123
124
  after:
124
125
  - "puts 'Test finished running'"
125
- ```
126
+ ```
126
127
 
127
128
  **opts** The `opts` section overrides defaults for the `Onceover::Controlrepo` class' `opts` hash.
128
129
 
@@ -488,6 +489,10 @@ This takes your Puppetfile and actually modifies all of the module versions in t
488
489
  4. Run Onceover agan
489
490
  5. Create a pull request if all tests pass
490
491
 
492
+ ### Overriding Onceover's Templates
493
+
494
+ Onceover uses templates to create a bunch of files in the `.onceover` directory, these templates can be modified if required. To do this create your own custom template with the same name os the original in the `spec/templates/` directory and it will be used in preference to the default template. e.g. `spec/templates/spec_helper.rb.erb`
495
+
491
496
  ### Accessing Onceover in a traditional RSpec test
492
497
 
493
498
  If you would like to use `onceover.yaml` to manage which tests you want to run, but want more than just `it { should_compile }` tests to be run you can write you own as follows:
@@ -680,3 +685,4 @@ Cheers to all of those who helped out:
680
685
  - aardvark
681
686
  - Mandos
682
687
  - Nekototori
688
+ - LMacchi
data/features/run.feature CHANGED
@@ -1,3 +1,4 @@
1
+ @run
1
2
  Feature: Run rspec and acceptance test suits
2
3
  Onceover should allow to run rspec and acceptance test for all profvile and role classes
3
4
  or for any part of them. Use should set if he wants to see only summary of tests or full
@@ -26,3 +27,17 @@ Feature: Run rspec and acceptance test suits
26
27
  Given initialized control repo "control_branch"
27
28
  When I run onceover command "run spec"
28
29
  Then the temporary Puppetfile should contain the git branch
30
+
31
+ Scenario: Run with local modifications
32
+ Given initialized control repo "basic"
33
+ When I run onceover command "run spec"
34
+ And I make local modifications
35
+ And I run onceover command "run spec"
36
+ Then I should see message pattern "local modifications"
37
+
38
+ Scenario: Force overwrite local modifications
39
+ Given initialized control repo "basic"
40
+ When I run onceover command "run spec"
41
+ And I make local modifications
42
+ And I run onceover command "run spec --force"
43
+ Then I should see message pattern "Overwriting local modifications"
@@ -53,7 +53,7 @@ end
53
53
 
54
54
  Then(/^I should see message pattern "([^"]*)"$/) do |err_msg_regexp|
55
55
  expect(@cmd.success?).to be true
56
- puts @cmd.output unless @cmd.success?
56
+ puts @cmd.output unless @cmd.output =~ Regexp.new(err_msg_regexp)
57
57
  expect(@cmd.output).to match(err_msg_regexp)
58
58
  puts @cmd.output.match(err_msg_regexp).to_s
59
59
  end
@@ -7,3 +7,7 @@ Then(/^the temporary Puppetfile should contain the git branch/) do
7
7
  git_branch = `git rev-parse --abbrev-ref HEAD`.chomp
8
8
  step %Q(the temporary Puppetfile should contain /#{git_branch}/)
9
9
  end
10
+
11
+ When(/^I make local modifications$/) do
12
+ FileUtils.rm_rf("#{@repo.onceover_temp_root_folder}/modules/apache/manifests")
13
+ end
@@ -22,6 +22,7 @@ This includes deploying using r10k and running all custom tests.
22
22
  optional :c, :classes, 'A list of classes. Only tests with these classes will be run'
23
23
  optional :n, :nodes, 'A list of nodes. Only tests with these nodes will be run'
24
24
  optional :s, :skip_r10k, 'Skip the r10k step'
25
+ optional :f, :force, 'Passes --force to r10k, overwriting modules'
25
26
  optional :sv, :strict_variables, 'Run with strict_variables set to yes'
26
27
 
27
28
  run do |opts, args, cmd|
@@ -537,7 +537,12 @@ class Onceover
537
537
  def self.evaluate_template(template_name, bind)
538
538
  logger.debug "Evaluating template #{template_name}"
539
539
  template_dir = File.expand_path('../../templates', File.dirname(__FILE__))
540
- template = File.read(File.expand_path("./#{template_name}", template_dir))
540
+ if File.file?(File.expand_path("./spec/templates/#{template_name}", @root))
541
+ puts "Using Custom #{template_name}"
542
+ template = File.read(File.expand_path("./spec/templates/#{template_name}", @root))
543
+ else
544
+ template = File.read(File.expand_path("./#{template_name}", template_dir))
545
+ end
541
546
  ERB.new(template, nil, '-').result(bind)
542
547
  end
543
548
 
@@ -26,6 +26,7 @@ class Onceover
26
26
  attr_accessor :before_conditions
27
27
  attr_accessor :after_conditions
28
28
  attr_accessor :skip_r10k
29
+ attr_accessor :force
29
30
  attr_accessor :strict_variables
30
31
 
31
32
  def initialize(file, opts = {})
@@ -68,6 +69,7 @@ class Onceover
68
69
  @filter_classes = opts[:classes] ? [opts[:classes].split(',')].flatten.map {|x| Onceover::Class.find(x)} : nil
69
70
  @filter_nodes = opts[:nodes] ? [opts[:nodes].split(',')].flatten.map {|x| Onceover::Node.find(x)} : nil
70
71
  @skip_r10k = opts[:skip_r10k] ? true : false
72
+ @force = opts[:force] || false
71
73
 
72
74
  # Loop over all of the items in the test matrix and add those as test
73
75
  # objects to the list of tests
@@ -265,7 +267,10 @@ class Onceover
265
267
  # R10K::Action::Deploy::Environment
266
268
  prod_dir = "#{repo.tempdir}/#{repo.environmentpath}/production"
267
269
  Dir.chdir(prod_dir) do
268
- install_cmd = "r10k puppetfile install --verbose --color --puppetfile #{repo.puppetfile}"
270
+ install_cmd = []
271
+ install_cmd << "r10k puppetfile install --verbose --color --puppetfile #{repo.puppetfile}"
272
+ install_cmd << "--force" if @force
273
+ install_cmd = install_cmd.join(' ')
269
274
  logger.debug "Running #{install_cmd} from #{prod_dir}"
270
275
  system(install_cmd)
271
276
  raise 'r10k could not install all required modules' unless $?.success?
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.4.0"
7
+ s.version = "3.5.0"
8
8
  s.authors = ["Dylan Ratcliffe"]
9
9
  s.email = ["dylan.ratcliffe@puppet.com"]
10
10
  s.homepage = "https://github.com/dylanratcliffe/onceover"
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.0
4
+ version: 3.5.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: 2018-02-27 00:00:00.000000000 Z
11
+ date: 2018-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake