Skip to content

Commit 9becdea

Browse files
committed
(FM-8230) Convert testing to litmus
1 parent 2e1bb32 commit 9becdea

25 files changed

+316
-558
lines changed

.fixtures.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
fixtures:
2+
repositories:
3+
facts: 'git://github.com/puppetlabs/puppetlabs-facts.git'
4+
puppet_agent: 'git://github.com/puppetlabs/puppetlabs-puppet_agent.git'
5+
provision: 'git://github.com/puppetlabs/provision.git'
26
symlinks:
37
stdlib: "#{source_dir}"
4-
test: "#{source_dir}/spec/fixtures/test"
8+
test: "#{source_dir}/spec/fixtures/test"

.rubocop.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ GetText:
2626
GetText/DecorateString:
2727
Description: We don't want to decorate test output.
2828
Exclude:
29-
- spec/*
29+
- spec/**/*
3030
RSpec/BeforeAfterAll:
3131
Description: Beware of using after(:all) as it may cause state to leak between tests.
3232
A necessary evil in acceptance testing.

.sync.yml

+12-8
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,10 @@
1111
inherit_from: .rubocop_todo.yml
1212

1313
.travis.yml:
14-
docker_sets:
15-
- set: docker/centos-7
16-
- set: docker/ubuntu-14.04
17-
docker_defaults:
18-
bundler_args: ""
19-
secure: ""
20-
branches:
21-
- release
14+
unmanaged: true
15+
16+
appveyor.yml:
17+
unmanaged: true
2218

2319
Gemfile:
2420
required:
@@ -30,6 +26,13 @@ Gemfile:
3026
- mswin
3127
- mingw
3228
- x64_mingw
29+
- gem: 'puppet_litmus'
30+
platforms:
31+
- ruby
32+
- mswin
33+
- mingw
34+
- x64_mingw
35+
condition: "ENV['PUPPET_GEM_VERSION'].nil? or ENV['PUPPET_GEM_VERSION'] !~ %r{ 5}"
3336
optional:
3437
':development':
3538
- gem: 'github_changelog_generator'
@@ -40,6 +43,7 @@ Gemfile:
4043
Rakefile:
4144
requires:
4245
- puppet-lint/tasks/puppet-lint
46+
use_litmus_tasks: true
4347

4448
spec/spec_helper.rb:
4549
mock_with: ':rspec'

.travis.yml

+83-24
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
dist: trusty
23
language: ruby
34
cache: bundler
45
before_install:
@@ -12,52 +13,110 @@ script:
1213
bundler_args: --without system_tests
1314
rvm:
1415
- 2.5.3
15-
stages:
16-
- static
17-
- spec
18-
- acceptance
19-
-
20-
if: tag =~ ^v\d
21-
name: deploy
16+
env:
17+
global:
18+
- PUPPET_GEM_VERSION="~> 6.0"
2219
matrix:
2320
fast_finish: true
2421
include:
2522
-
26-
bundler_args:
23+
bundler_args:
2724
dist: trusty
28-
env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_set=docker/centos-7 BEAKER_TESTMODE=apply
25+
env: PLATFORMS=debian_puppet5
2926
rvm: 2.5.3
30-
script: bundle exec rake beaker
27+
before_script:
28+
- bundle exec rake 'litmus:provision_list[waffle_debian]'
29+
- bundle exec rake 'litmus:install_agent[puppet5]'
30+
- bundle exec rake litmus:install_module
31+
script:
32+
- bundle exec rake litmus:acceptance:parallel
3133
services: docker
32-
stage: acceptance
3334
sudo: required
3435
-
35-
bundler_args:
36+
bundler_args:
3637
dist: trusty
37-
env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_set=docker/ubuntu-14.04 BEAKER_TESTMODE=apply
38+
env: PLATFORMS=debian_puppet6
3839
rvm: 2.5.3
39-
script: bundle exec rake beaker
40+
before_script:
41+
- bundle exec rake 'litmus:provision_list[waffle_debian]'
42+
- bundle exec rake 'litmus:install_agent[puppet6]'
43+
- bundle exec rake litmus:install_module
44+
script:
45+
- bundle exec rake litmus:acceptance:parallel
4046
services: docker
41-
stage: acceptance
4247
sudo: required
4348
-
44-
env: CHECK="check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop syntax lint metadata_lint"
45-
stage: static
49+
bundler_args:
50+
dist: trusty
51+
env: PLATFORMS=el6_puppet5
52+
rvm: 2.5.3
53+
before_script:
54+
- bundle exec rake 'litmus:provision_list[waffle_el6]'
55+
- bundle exec rake 'litmus:install_agent[puppet5]'
56+
- bundle exec rake litmus:install_module
57+
script:
58+
- bundle exec rake litmus:acceptance:parallel
59+
services: docker
60+
sudo: required
4661
-
47-
env: PUPPET_GEM_VERSION="~> 5.0" CHECK=parallel_spec
48-
rvm: 2.4.5
49-
stage: spec
62+
bundler_args:
63+
dist: trusty
64+
env: PLATFORMS=el6_puppet6
65+
rvm: 2.5.3
66+
before_script:
67+
- bundle exec rake 'litmus:provision_list[waffle_el6]'
68+
- bundle exec rake 'litmus:install_agent[puppet6]'
69+
- bundle exec rake litmus:install_module
70+
script:
71+
- bundle exec rake litmus:acceptance:parallel
72+
services: docker
73+
sudo: required
74+
-
75+
bundler_args:
76+
dist: trusty
77+
env: PLATFORMS=el7_puppet5
78+
rvm: 2.5.3
79+
before_script:
80+
- bundle exec rake 'litmus:provision_list[waffle_el7]'
81+
- bundle exec rake 'litmus:install_agent[puppet5]'
82+
- bundle exec rake litmus:install_module
83+
script:
84+
- bundle exec rake litmus:acceptance:parallel
85+
services: docker
86+
sudo: required
5087
-
51-
env: PUPPET_GEM_VERSION="~> 6.0" CHECK=parallel_spec
88+
bundler_args:
89+
dist: trusty
90+
env: PLATFORMS=el7_puppet6
5291
rvm: 2.5.3
53-
stage: spec
92+
before_script:
93+
- bundle exec rake 'litmus:provision_list[waffle_el7]'
94+
- bundle exec rake 'litmus:install_agent[puppet6]'
95+
- bundle exec rake litmus:install_module
96+
script:
97+
- bundle exec rake litmus:acceptance:parallel
98+
services: docker
99+
sudo: required
100+
-
101+
env: CHECK="syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop"
102+
-
103+
env: CHECK=parallel_spec
54104
-
55-
env: DEPLOY_TO_FORGE=yes
56-
stage: deploy
105+
env: PUPPET_GEM_VERSION="~> 5.0" CHECK=parallel_spec
106+
rvm: 2.4.5
57107
branches:
58108
only:
59109
- master
60110
- /^v\d/
61111
- release
62112
notifications:
63113
email: false
114+
deploy:
115+
provider: puppetforge
116+
user: puppet
117+
password:
118+
secure: ""
119+
on:
120+
tags: true
121+
all_branches: true
122+
condition: "$DEPLOY_TO_FORGE = yes"

Gemfile

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ end
3232
group :system_tests do
3333
gem "puppet-module-posix-system-r#{minor_version}", require: false, platforms: [:ruby]
3434
gem "puppet-module-win-system-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw]
35+
gem "puppet_litmus", require: false, platforms: [:ruby, :mswin, :mingw, :x64_mingw] if ENV['PUPPET_GEM_VERSION'].nil? or ENV['PUPPET_GEM_VERSION'] !~ %r{ 5}
3536
end
3637

3738
puppet_version = ENV['PUPPET_GEM_VERSION']

Rakefile

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
require 'puppet_litmus/rake_tasks' if Bundler.rubygems.find_name('puppet_litmus').any?
12
require 'puppetlabs_spec_helper/rake_tasks'
23
require 'puppet-syntax/tasks/puppet-syntax'
34
require 'puppet_blacksmith/rake_tasks' if Bundler.rubygems.find_name('puppet-blacksmith').any?

appveyor.yml

+21
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,27 @@ environment:
3434
PUPPET_GEM_VERSION: ~> 6.0
3535
RUBY_VERSION: 25-x64
3636
CHECK: parallel_spec
37+
-
38+
RUBY_VERSION: 25-x64
39+
ACCEPTANCE: yes
40+
TARGET_HOST: localhost
41+
-
42+
RUBY_VERSION: 25-x64
43+
ACCEPTANCE: yes
44+
TARGET_HOST: localhost
45+
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
46+
for:
47+
-
48+
matrix:
49+
only:
50+
- ACCEPTANCE: yes
51+
install:
52+
- set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
53+
- bundle install --jobs 4 --retry 2
54+
- type Gemfile.lock
55+
test_script:
56+
- bundle exec rake spec_prep
57+
- bundle exec rake litmus:acceptance:localhost
3758
matrix:
3859
fast_finish: true
3960
install:

distelli-manifest.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
team-modules/puppetlabs-stdlib:
2+
PreBuild:
3+
- source /opt/rh/rh-ruby25/enable
4+
- echo "--- LETS update BUNDLER ---"
5+
- bundle install --path vendor/bundle --jobs 3
6+
Build:
7+
- echo "--- PROVISIONING ---"
8+
- source /opt/rh/rh-ruby25/enable
9+
- bundle exec rake litmus:provision_list[release_checks]
10+
- cat inventory.yaml
11+
- echo "--- AGENT INSTALLATION ---"
12+
- bundle exec rake litmus:install_agent
13+
- echo "--- MODULE INSTALLATION ---"
14+
- bundle exec rake litmus:install_module
15+
- echo "--- TESTS RUNNING ---"
16+
- bundle exec rake litmus:acceptance:parallel
17+
AfterBuildSuccess:
18+
- source /opt/rh/rh-ruby25/enable
19+
- bundle exec rake litmus:tear_down
20+
AfterBuildFailure:
21+
- source /opt/rh/rh-ruby25/enable
22+
- bundle exec rake litmus:tear_down
23+
CommitData:
24+
- RepoType: Git
25+
- RepoPath: .

metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,5 +105,5 @@
105105
"description": "Standard Library for Puppet Modules",
106106
"pdk-version": "1.10.0",
107107
"template-url": "https://github.com/puppetlabs/pdk-templates#master",
108-
"template-ref": "heads/master-0-g7827fc2"
108+
"template-ref": "heads/master-0-g2b33205"
109109
}

provision.yaml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
default:
3+
provisioner: docker
4+
images: ['waffleimage/centos7']
5+
waffle_debian:
6+
provisioner: docker
7+
images: ['waffleimage/debian8', 'waffleimage/debian9', 'waffleimage/ubuntu14.04', 'waffleimage/ubuntu16.04', 'waffleimage/ubuntu18.04']
8+
waffle_el6:
9+
provisioner: docker
10+
images: ['waffleimage/centos6', 'waffleimage/scientificlinux6']
11+
waffle_el7:
12+
provisioner: docker
13+
images: ['waffleimage/centos7', 'waffleimage/oraclelinux7', 'waffleimage/scientificlinux7']
14+
release_checks:
15+
provisioner: vmpooler
16+
images: ['redhat-5-x86_64', 'redhat-6-x86_64', 'redhat-7-x86_64', 'redhat-8-x86_64', 'centos-5-x86_64', 'centos-6-x86_64', 'centos-7-x86_64', 'oracle-5-x86_64', 'oracle-6-x86_64', 'oracle-7-x86_64', 'scientific-6-x86_64', 'scientific-7-x86_64', 'debian-8-x86_64', 'debian-9-x86_64', 'sles-11-x86_64', 'sles-12-x86_64', 'ubuntu-1404-x86_64', 'ubuntu-1604-x86_64', 'ubuntu-1804-x86_64']

spec/acceptance/anchor_spec.rb

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
require 'spec_helper_acceptance'
22

33
describe 'anchor type' do
4-
describe 'success' do
5-
pp = <<-DOC
4+
let(:pp) do
5+
<<-MANIFEST
66
class anchored {
77
anchor { 'anchored::begin': }
88
~> anchor { 'anchored::end': }
@@ -15,11 +15,12 @@ class anchorrefresh {
1515
}
1616
1717
include anchorrefresh
18-
DOC
19-
it 'effects proper chaining of resources' do
20-
apply_manifest(pp, :catch_failures => true) do |r|
21-
expect(r.stdout).to match(%r{Anchor\[final\]: Triggered 'refresh'})
22-
end
18+
MANIFEST
19+
end
20+
21+
it 'applies manifest' do
22+
apply_manifest(pp) do |r|
23+
expect(r.stdout).to match(%r{Anchor\[final\]: Triggered 'refresh'})
2324
end
2425
end
2526
end

0 commit comments

Comments
 (0)