onceover 3.6.0 → 3.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b526c91a6430b4a442c6c7d905325c0c8e66b980
4
- data.tar.gz: 69bb0524345dcd1b155cc845e9fa5d2d206f3de3
3
+ metadata.gz: 72849f6db8421ffb02b6f6cab2c2b504d6ce8d76
4
+ data.tar.gz: 1b346dbcc0e3d8100fb202520524918b5dd90d9e
5
5
  SHA512:
6
- metadata.gz: 06ba5f38361ec3eafed75cf81b9d902b8bc9e646c3c4f3da9a9bd66024738af70c1692fb1e7493a2c1321b10bdf9178457c156cadf38503aa529f2ce9da1eed8
7
- data.tar.gz: 0cea3f35c36f7b99a345bfc8b17b15108adb3bd3e3ddc5e6a9ca9af08a458273191be6b8a22ffe217ad51e3f9c7873d3e41ffb718613e7d233c343dfe2714d88
6
+ metadata.gz: 1d72703e6f6012edce69f3a5521764a0a6536496a0ca2dbb4de29e204715b600df34c3a70e98bba5264563a5fac2b9507a6652393ca516b4eb699318501d86ac
7
+ data.tar.gz: 50ed94b9ff2619c7434570ffdc1d1d0652d498936e03e849c3457ca98aa111eec5b1c55d55578bdec5cb26c94557b6180fa39ba967cbb19b1bd1414cc43c9e32
data/README.md CHANGED
@@ -353,6 +353,27 @@ If your `hiera.yaml` is version 4 or 5 and lives in the root of the controlrepo
353
353
  | 5 | Root of repo | relative to the root of the repo e.g. `data` |
354
354
  | 5 | `spec` folder | relative to the spec folder e.g. `../data` |
355
355
 
356
+ #### `hiera-eyaml`
357
+
358
+ If you are using the `hiera-eyaml` backend there are some modifications that you will need to make in order to ensure that things actually work. Remember that when onceover compiles catalogs it is actually using hiera with your config file to do the lookups on the host that is running the tests, meaning that the `hiera-eyaml` gem will need to be present (put it in your Gemfile), as will the keys in the correct location, otherwise hiera will fail to load them. *This is really not a great situation as you don't want to be distributing your private keys*
359
+
360
+ **Recommended Solution:** I recommend that if you are using `hiera-eyaml` (which you probably should be) that you do the following:
361
+
362
+ 1. Duplicate your `hiera.yaml` file so that there is a copy in the `spec/` directory
363
+ 1. Change the `datadir` setting as described above
364
+ 1. Remove the eyaml backend entirely and just use the base yaml backend. For hiera 5 this will look like:
365
+
366
+ ```yaml
367
+ ---
368
+ version: 5
369
+ defaults:
370
+ datadir: "../data"
371
+ data_hash: yaml_data
372
+ ```
373
+
374
+ This means that for testing, hiera will just return the encrypted string for anything that is encrypted using eyaml. This usually isn't a problem for catalog compilation and will allow tests to pass.
375
+
376
+
356
377
  ## Spec testing
357
378
 
358
379
  Once you have your `onceover.yaml` and factsets set up you are ready to go with spec testing.
@@ -696,13 +717,15 @@ Execute tests
696
717
 
697
718
  Cheers to all of those who helped out:
698
719
 
699
- - jessereynolds
700
- - op-ct
701
- - GeoffWilliams
702
- - beergeek
703
- - jairojunior
704
- - natemccurdy
705
- - aardvark
706
- - Mandos
707
- - Nekototori
708
- - LMacchi
720
+ - @jessereynolds
721
+ - @op-ct
722
+ - @GeoffWilliams
723
+ - @beergeek
724
+ - @jairojunior
725
+ - @natemccurdy
726
+ - @aardvark
727
+ - @Mandos
728
+ - @Nekototori
729
+ - @LMacchi
730
+ - @tabakhase
731
+ - @binford2k
data/features/run.feature CHANGED
@@ -18,16 +18,6 @@ Feature: Run rspec and acceptance test suites
18
18
  When I run onceover command "run spec"
19
19
  Then I should see error with message pattern "The module acme-not_exists does not exist"
20
20
 
21
- Scenario: Run advanced spec tests
22
- Given control repo "puppet_controlrepo"
23
- When I run onceover command "run spec"
24
- Then I should not see any errors
25
-
26
- Scenario: Check that control_branch functionality works
27
- Given initialized control repo "control_branch"
28
- When I run onceover command "run spec"
29
- Then the temporary Puppetfile should contain the git branch
30
-
31
21
  Scenario: Run with local modifications
32
22
  Given initialized control repo "basic"
33
23
  When I run onceover command "run spec"
@@ -42,6 +32,16 @@ Feature: Run rspec and acceptance test suites
42
32
  And I run onceover command "run spec --force"
43
33
  Then I should see message pattern "Overwriting local modifications"
44
34
 
35
+ Scenario: Run advanced spec tests
36
+ Given control repo "puppet_controlrepo"
37
+ When I run onceover command "run spec"
38
+ Then I should not see any errors
39
+
40
+ Scenario: Check that control_branch functionality works
41
+ Given initialized control repo "control_branch"
42
+ When I run onceover command "run spec"
43
+ Then the temporary Puppetfile should contain the git branch
44
+
45
45
  Scenario: Mocking functions should work and return the correct data types
46
46
  Given control repo "function_mocking"
47
47
  When I run onceover command "run spec"
@@ -31,7 +31,7 @@ class Onceover
31
31
 
32
32
  def initialize(file, opts = {})
33
33
  begin
34
- config = YAML.safe_load(File.read(file))
34
+ config = YAML.safe_load(File.read(file), [Symbol])
35
35
  rescue Errno::ENOENT
36
36
  raise "Could not find #{file}"
37
37
  rescue Psych::SyntaxError
@@ -347,8 +347,22 @@ class Onceover
347
347
  repo.temp_modulepath.split(':').each do |path|
348
348
  Dir["#{path}/*"].each do |mod|
349
349
  modulename = File.basename(mod)
350
- logger.debug "Symlinking #{mod} to #{repo.tempdir}/spec/fixtures/modules/#{modulename}"
351
- FileUtils.ln_s(mod, "#{repo.tempdir}/spec/fixtures/modules/#{modulename}")
350
+ link = "#{repo.tempdir}/spec/fixtures/modules/#{modulename}"
351
+ logger.debug "Symlinking #{mod} to #{link}"
352
+ unless File.symlink?(link)
353
+ # Ruby only sets File::ALT_SEPARATOR on Windows and Rubys standard library
354
+ # uses this to check for Windows
355
+ if !!File::ALT_SEPARATOR
356
+ mod = File.join(File.dirname(link), mod) unless Pathname.new(mod).absolute?
357
+ if Dir.respond_to?(:create_junction)
358
+ Dir.create_junction(link, mod)
359
+ else
360
+ system("call mklink /J \"#{link.gsub('/', '\\')}\" \"#{mod.gsub('/', '\\')}\"")
361
+ end
362
+ else
363
+ FileUtils.ln_s(mod, link)
364
+ end
365
+ end
352
366
  end
353
367
  end
354
368
  end
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.6.0"
7
+ s.version = "3.6.1"
8
8
  s.authors = ["Dylan Ratcliffe"]
9
9
  s.email = ["dylan.ratcliffe@puppet.com"]
10
10
  s.homepage = "https://github.com/dylanratcliffe/onceover"
@@ -41,3 +41,6 @@ functions:
41
41
  type: rvalue
42
42
  returns:
43
43
  foo: bar
44
+
45
+ opts:
46
+ :debug: true
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.6.0
4
+ version: 3.6.1
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-03-27 00:00:00.000000000 Z
11
+ date: 2018-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake