simp-beaker-helpers 1.5.7 → 1.6.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: 2dafff76be810af68e014763c28c3e863697a4de
4
- data.tar.gz: 536ec8143f8abeee194340f891d14aea1712f2c5
3
+ metadata.gz: f423ccffba15fb59477037b489fc83e02828d546
4
+ data.tar.gz: 58ea1934ae1e074fee9f262160f9ba64fec60dfc
5
5
  SHA512:
6
- metadata.gz: 323dc6287e75970853b2a1d835b350e61fbb2ad2a7f99b0c05c45c38646e180c9e2cdb9da8c14f7877b4a6646a57356dcfacad87b323377c922efe41a4eeff91
7
- data.tar.gz: 1ac6b81ef47e313e8dfdcf0d5ca044eb39be0f0ce07f408af574eb32bba67c6fc4f3c11c8361cf24a2886baa3290c03d4cbb3eec4a018cd4e396fc0d8ae583c6
6
+ metadata.gz: cf58694581293b502b34acd99c8e1a15808ae8e5c282d81d37feb9b32a4252e2cd10866b385d874737cc41ffc929bfba769d337408d3afdd76a7a9ce928b3d34
7
+ data.tar.gz: 87db67f03c23e8cb1ae4578c6509fab397dd5e918d0b7817729f27a66300f122f282f9baff3c0d50ba75daac30aa51abf644667060d6438ac1b15edcff426488
data/.travis.yml CHANGED
@@ -3,8 +3,7 @@ language: ruby
3
3
  cache: bundler
4
4
 
5
5
  rvm:
6
- - 1.9.3
7
- - 2.0.0
6
+ - 2.1.9
8
7
 
9
8
  env:
10
9
  - SIMP_SKIP_NON_SIMPOS_TESTS=1
data/README.md CHANGED
@@ -29,8 +29,10 @@ Methods to assist beaker acceptance tests for SIMP.
29
29
  * [`BEAKER_spec_prep`](#beaker_spec_prep)
30
30
  * [`BEAKER_stringify_facts`](#beaker_stringify_facts)
31
31
  * [`BEAKER_use_fixtures_dir_for_modules`](#beaker_use_fixtures_dir_for_modules)
32
+ * [`PUPPET_VERSION`](#puppet_version)
32
33
  7. [Examples](#examples)
33
34
  * [Prep OS, Generate and copy PKI certs to each SUT](#prep-os-generate-and-copy-pki-certs-to-each-sut)
35
+ * [Specify the version of Puppet to run in the SUTs](#specify-the-version-of-puppet-to-run-in-the-suts)
34
36
  8. [License](#license)
35
37
 
36
38
  ## Overview
@@ -284,8 +286,15 @@ this will _not_ update modules that are already present under
284
286
  #### `BEAKER_stringify_facts`
285
287
  #### `BEAKER_use_fixtures_dir_for_modules`
286
288
 
289
+ #### PUPPET_VERSION
290
+
291
+ The `PUPPET_VERSION` environment variable will install the latest
292
+ `puppet-agent` package that provides that version of Puppet. This honors
293
+ `Gemfile`-style expressions like `"~> 4.8.0"`
294
+
287
295
  ## Examples
288
296
 
297
+
289
298
  ### Prep OS, Generate and copy PKI certs to each SUT
290
299
  This pattern serves to prepare component modules that use PKI
291
300
 
@@ -331,5 +340,18 @@ RSpec.configure do |c|
331
340
  end
332
341
  ```
333
342
 
343
+ ### Specify the version of Puppet to run in the SUTs
344
+
345
+ ```bash
346
+ # puppet-agent 1.8.3 will be installed in VMs
347
+ PUPPET_VERSION="~> 4.8.0" bundle exec rake beaker:suites
348
+
349
+ # puppet-agent 1.9.2 will be installed in VMs
350
+ PUPPET_INSTALL_VERSION=1.9.2 bundle exec rake beaker:suites
351
+
352
+ # puppet-agent 1.8.3 will be installed in VMs
353
+ bundle exec rake beaker:suites
354
+ ```
355
+
334
356
  ## License
335
357
  See [LICENSE](LICENSE)
@@ -0,0 +1,28 @@
1
+ ---
2
+ # `puppet` agent to `puppet-agent` version mappings
3
+ version_mappings:
4
+ '4.9.2': '1.9.1'
5
+ '4.9.0': '1.9.0'
6
+ '4.8.2': '1.8.3'
7
+ '4.8.1': '1.8.2'
8
+ '4.8.0': '1.8.0'
9
+ '4.7.1': '1.7.2'
10
+ '4.7.0': '1.7.1'
11
+ '4.6.2': '1.6.2'
12
+ '4.6.1': '1.6.1'
13
+ '4.6.0': '1.6.0'
14
+ '4.5.2': '1.5.3'
15
+ '4.5.1': '1.5.1'
16
+ '4.5.0': '1.5.0'
17
+ '4.4.2': '1.4.2'
18
+ '4.4.1': '1.4.1'
19
+ '4.4.0': '1.4.0'
20
+ '4.3.2': '1.3.6'
21
+ '4.3.1': '1.3.2'
22
+ '4.3.0': '1.3.0'
23
+ '4.2.3': '1.2.7'
24
+ '4.2.2': '1.2.6'
25
+ '4.2.1': '1.2.2'
26
+ '4.2.0': '1.2.1'
27
+ '4.1.0': '1.1.1'
28
+ '4.0.0': '1.0.1'
@@ -1,7 +1,8 @@
1
1
  module Simp; end
2
2
 
3
3
  module Simp::BeakerHelpers
4
- VERSION = '1.5.7'
4
+ require 'simp/beaker_helpers/version'
5
+ DEFAULT_PUPPET_AGENT_VERSION = '1.8.3'
5
6
 
6
7
  # use the `puppet fact` face to look up facts on an SUT
7
8
  def pfact_on(sut, fact_name)
@@ -545,4 +546,42 @@ done
545
546
  end
546
547
  end
547
548
  end
549
+
550
+
551
+ # Looks up latest `puppet-agent` version by the version of its `puppet` gem
552
+ #
553
+ # @param puppet_version [String] target Puppet gem version. Works with
554
+ # Gemfile comparison syntax (e.g., '4.0', '= 4.2', '~> 4.3.1')
555
+ #
556
+ # @return [String,Nil] the `puppet-agent` version or nil
557
+ #
558
+ def latest_puppet_agent_version_for( puppet_version )
559
+ return nil if puppet_version.nil?
560
+ require 'rubygems/requirement'
561
+ require 'rubygems/version'
562
+ require 'yaml'
563
+ @agent_version_table ||= YAML.load_file(
564
+ File.expand_path(
565
+ '../../files/puppet-agent-versions.yaml',
566
+ File.dirname(__FILE__)
567
+ )).fetch('version_mappings')
568
+ _pair = @agent_version_table.find do |k,v|
569
+ Gem::Requirement.new(puppet_version).satisfied_by?(Gem::Version.new(k))
570
+ end
571
+ result = _pair ? _pair.last : nil
572
+ end
573
+
574
+
575
+ # Replacement for `install_puppet` in spec_helper_acceptance.rb
576
+ def install_puppet
577
+ puppet_install_type = ENV.fetch('PUPPET_INSTALL_TYPE', 'agent')
578
+ puppet_agent_version = (
579
+ ENV.fetch('PUPPET_INSTALL_VERSION', nil) ||
580
+ latest_puppet_agent_version_for(ENV.fetch('PUPPET_VERSION',nil)) ||
581
+ DEFAULT_PUPPET_AGENT_VERSION
582
+ )
583
+ require 'beaker/puppet_install_helper'
584
+ run_puppet_install_helper(puppet_install_type, puppet_agent_version)
585
+ end
586
+
548
587
  end
@@ -0,0 +1,5 @@
1
+ module Simp; end
2
+
3
+ module Simp::BeakerHelpers
4
+ VERSION = '1.6.0'
5
+ end
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  $LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
3
- require 'simp/beaker_helpers.rb'
3
+ require 'simp/beaker_helpers/version'
4
4
  require 'date'
5
5
 
6
6
  Gem::Specification.new do |s|
@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
19
19
  'issue_tracker' => 'https://simp-project.atlassian.net'
20
20
  }
21
21
  s.add_runtime_dependency 'beaker', '~> 2'
22
+ s.add_runtime_dependency 'beaker-puppet_install_helper', '~> 0.6'
22
23
 
23
24
  ### s.files = Dir['Rakefile', '{bin,lib,spec}/**/*', 'README*', 'LICENSE*'] & `git ls-files -z .`.split("\0")
24
25
  s.files = `git ls-files`.split("\n")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simp-beaker-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.7
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Tessmer
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-01-13 00:00:00.000000000 Z
12
+ date: 2017-02-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: beaker
@@ -25,6 +25,20 @@ dependencies:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
27
  version: '2'
28
+ - !ruby/object:Gem::Dependency
29
+ name: beaker-puppet_install_helper
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '0.6'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '0.6'
28
42
  description: " Beaker helper methods to help scaffold SIMP acceptance tests\n"
29
43
  email: simp@simp-project.org
30
44
  executables: []
@@ -43,7 +57,9 @@ files:
43
57
  - files/pki/make.sh
44
58
  - files/pki/template_ca.cnf
45
59
  - files/pki/template_host.cnf
60
+ - files/puppet-agent-versions.yaml
46
61
  - lib/simp/beaker_helpers.rb
62
+ - lib/simp/beaker_helpers/version.rb
47
63
  - lib/simp/rake/beaker.rb
48
64
  - simp-beaker-helpers.gemspec
49
65
  - spec/acceptance/fixture_modules_spec.rb