onceover 3.18.0 → 3.20.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 +4 -4
- data/.gitattributes +2 -0
- data/.github/workflows/tests.yaml +40 -0
- data/.rubocop.yml +20 -2
- data/Gemfile +0 -13
- data/README.md +275 -113
- data/Rakefile +23 -6
- data/factsets/CentOS-8.3.2011-64.json +485 -0
- data/factsets/Debian-10.4-64.json +476 -0
- data/factsets/Debian-8.11-64.json +480 -0
- data/factsets/Debian-9.12-64.json +476 -0
- data/factsets/Ubuntu-20.04-64.json +504 -0
- data/factsets/Windows_Server-2008r2-64.json +184 -184
- data/factsets/Windows_Server-2012r2-64.json +165 -165
- data/factsets/windows-10-64.json +104 -104
- data/features/cache.feature +1 -1
- data/features/factsets.feature +33 -4
- data/features/step_definitions/cache.rb +4 -4
- data/features/step_definitions/common.rb +44 -10
- data/features/step_definitions/init.rb +2 -2
- data/features/windows.feature +5 -0
- data/features/zzz_run.feature +22 -3
- data/lib/onceover/controlrepo.rb +25 -16
- data/lib/onceover/deploy.rb +3 -1
- data/lib/onceover/group.rb +3 -1
- data/lib/onceover/node.rb +19 -2
- data/lib/onceover/rspec/formatters.rb +6 -1
- data/lib/onceover/runner.rb +5 -4
- data/lib/onceover/test.rb +3 -2
- data/lib/onceover/testconfig.rb +14 -5
- data/onceover.gemspec +5 -2
- data/spec/fixtures/controlrepos/basic/manifests_alternate/site.pp +2 -0
- data/spec/fixtures/controlrepos/caching/Puppetfile +17 -17
- data/spec/fixtures/controlrepos/caching/manifests/site.pp +1 -0
- data/spec/fixtures/controlrepos/caching/spec/factsets/Debian-10-facter-4.json +1091 -0
- data/spec/fixtures/controlrepos/caching/spec/onceover.yaml +13 -12
- data/spec/fixtures/controlrepos/custom_puppetfile/Puppetfile.custom +3 -0
- data/spec/fixtures/controlrepos/custom_puppetfile/environment.conf +7 -0
- data/spec/fixtures/controlrepos/factsets/site/role/manifests/trusted_extensions.pp +6 -0
- data/spec/fixtures/controlrepos/factsets/site/role/manifests/trusted_external.pp +6 -0
- data/spec/fixtures/controlrepos/factsets/spec/factsets/README.md +7 -0
- data/spec/fixtures/controlrepos/factsets/spec/factsets/centos7_notrusted.json +530 -0
- data/spec/fixtures/controlrepos/factsets/spec/factsets/centos7_trusted_extensions_nested.json +535 -0
- data/spec/fixtures/controlrepos/factsets/spec/factsets/centos7_trusted_extensions_top.json +533 -0
- data/spec/fixtures/controlrepos/factsets/spec/factsets/centos7_trusted_external_nested.json +537 -0
- data/spec/fixtures/controlrepos/factsets/spec/factsets/centos7_trusted_external_top.json +535 -0
- data/spec/fixtures/controlrepos/factsets/spec/factsets/centos_7_facter_4.json +706 -0
- data/spec/fixtures/controlrepos/windows/Puppetfile +6 -1
- data/spec/fixtures/controlrepos/windows/site-modules/role/manifests/choco.pp +9 -0
- data/templates/test_spec.rb.erb +5 -1
- metadata +85 -18
- data/.travis.yml +0 -19
- data/appveyor.yml +0 -38
data/factsets/windows-10-64.json
CHANGED
@@ -1,104 +1,104 @@
|
|
1
|
-
{
|
2
|
-
"name": "vagrant-hb9g3rd.lan.asio",
|
3
|
-
"values": {
|
4
|
-
"puppetversion": "6.0.2",
|
5
|
-
"puppet_inventory_metadata": {
|
6
|
-
"packages": {
|
7
|
-
"collection_enabled": false,
|
8
|
-
"last_collection_time": "0.0s"
|
9
|
-
}
|
10
|
-
},
|
11
|
-
"package_provider": "windows",
|
12
|
-
"pe_concat_basedir": "C:/ProgramData/PuppetLabs/puppet/cache/pe_concat",
|
13
|
-
"is_pe": false,
|
14
|
-
"platform_symlink_writable": false,
|
15
|
-
"puppet_files_dir_present": false,
|
16
|
-
"puppet_vardir": "C:/ProgramData/PuppetLabs/puppet/cache",
|
17
|
-
"puppet_environmentpath": "C:/ProgramData/PuppetLabs/code/environments",
|
18
|
-
"puppet_server": "pe-puppet.localdomain",
|
19
|
-
"service_provider": "windows",
|
20
|
-
"staging_http_get": "curl",
|
21
|
-
"common_appdata": "C:\\ProgramData",
|
22
|
-
"architecture": "x64",
|
23
|
-
"kernel": "windows",
|
24
|
-
"virtual": "vmware",
|
25
|
-
"is_virtual": true,
|
26
|
-
"hardwaremodel": "x64",
|
27
|
-
"operatingsystem": "windows",
|
28
|
-
"os": {
|
29
|
-
"name": "windows",
|
30
|
-
"family": "windows",
|
31
|
-
"release": {
|
32
|
-
"major": "10",
|
33
|
-
"full": "10"
|
34
|
-
}
|
35
|
-
},
|
36
|
-
"facterversion": "2.5.1",
|
37
|
-
"fqdn": "VAGRANT-HB9G3RD",
|
38
|
-
"hostname": "VAGRANT-HB9G3RD",
|
39
|
-
"id": "vagrant-hb9g3rd\\vagrant",
|
40
|
-
"interfaces": "Ethernet0_2",
|
41
|
-
"ipaddress_ethernet0_2": "192.168.43.174",
|
42
|
-
"ipaddress6_ethernet0_2": "fd72:b3ab:b8dd:0:f563:fac2:928c:6aa",
|
43
|
-
"macaddress_ethernet0_2": "00:0C:29:A3:53:54",
|
44
|
-
"netmask_ethernet0_2": "255.255.255.0",
|
45
|
-
"mtu_ethernet0_2": 0,
|
46
|
-
"ipaddress": "192.168.43.174",
|
47
|
-
"ipaddress6": "fd72:b3ab:b8dd:0:f563:fac2:928c:6aa",
|
48
|
-
"kernelmajversion": "10.0",
|
49
|
-
"kernelrelease": "10.0.17134",
|
50
|
-
"kernelversion": "10.0.17134",
|
51
|
-
"macaddress": "00:0C:29:A3:53:54",
|
52
|
-
"manufacturer": "Phoenix Technologies LTD",
|
53
|
-
"serialnumber": "VMware-56 4d 36 2e 2e a4 81 f9-0d 05 ae d0 e5 a3 53 54",
|
54
|
-
"productname": "VMware Virtual Platform",
|
55
|
-
"memorysize": "4.00 GB",
|
56
|
-
"memoryfree": "2.30 GB",
|
57
|
-
"memorysize_mb": "4095.49",
|
58
|
-
"memoryfree_mb": "2360.00",
|
59
|
-
"netmask": "255.255.255.0",
|
60
|
-
"network_ethernet0_2": "192.168.43.0",
|
61
|
-
"operatingsystemmajrelease": "10",
|
62
|
-
"operatingsystemrelease": "10",
|
63
|
-
"osfamily": "windows",
|
64
|
-
"path": "C:\\tools\\ruby24\\bin;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\OpenSSH\\;C:\\ProgramData\\chocolatey\\bin;C:\\Program Files (x86)\\vim\\vim80;C:\\Program Files\\Git\\cmd;C:\\Program Files\\Puppet Labs\\Puppet\\bin;C:\\Users\\vagrant\\AppData\\Local\\Microsoft\\WindowsApps;",
|
65
|
-
"physicalprocessorcount": 4,
|
66
|
-
"processors": {
|
67
|
-
"models": [
|
68
|
-
"Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz",
|
69
|
-
"Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz",
|
70
|
-
"Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz",
|
71
|
-
"Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz"
|
72
|
-
],
|
73
|
-
"count": 4,
|
74
|
-
"physicalcount": 4
|
75
|
-
},
|
76
|
-
"processor0": "Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz",
|
77
|
-
"processor1": "Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz",
|
78
|
-
"processor2": "Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz",
|
79
|
-
"processor3": "Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz",
|
80
|
-
"processorcount": 4,
|
81
|
-
"ps": "tasklist.exe",
|
82
|
-
"rubyplatform": "x64-mingw32",
|
83
|
-
"rubysitedir": "C:/tools/ruby24/lib/ruby/site_ruby/2.4.0",
|
84
|
-
"rubyversion": "2.4.3",
|
85
|
-
"system32": "C:\\Windows\\system32",
|
86
|
-
"choco_install_path": "C:\\ProgramData\\chocolatey",
|
87
|
-
"system_uptime": {
|
88
|
-
"seconds": 1113359,
|
89
|
-
"hours": 309,
|
90
|
-
"days": 12,
|
91
|
-
"uptime": "12 days"
|
92
|
-
},
|
93
|
-
"timezone": "GMT Standard Time",
|
94
|
-
"uptime": "12 days",
|
95
|
-
"uptime_days": 12,
|
96
|
-
"uptime_hours": 309,
|
97
|
-
"uptime_seconds": 1113359,
|
98
|
-
"clientcert": "vagrant-hb9g3rd.lan.asio",
|
99
|
-
"clientversion": "6.0.2",
|
100
|
-
"clientnoop": false
|
101
|
-
},
|
102
|
-
"timestamp": "2018-12-10T21:43:07.468533000+00:00",
|
103
|
-
"expiration": "2018-12-10T22:13:07.468533000+00:00"
|
104
|
-
}
|
1
|
+
{
|
2
|
+
"name": "vagrant-hb9g3rd.lan.asio",
|
3
|
+
"values": {
|
4
|
+
"puppetversion": "6.0.2",
|
5
|
+
"puppet_inventory_metadata": {
|
6
|
+
"packages": {
|
7
|
+
"collection_enabled": false,
|
8
|
+
"last_collection_time": "0.0s"
|
9
|
+
}
|
10
|
+
},
|
11
|
+
"package_provider": "windows",
|
12
|
+
"pe_concat_basedir": "C:/ProgramData/PuppetLabs/puppet/cache/pe_concat",
|
13
|
+
"is_pe": false,
|
14
|
+
"platform_symlink_writable": false,
|
15
|
+
"puppet_files_dir_present": false,
|
16
|
+
"puppet_vardir": "C:/ProgramData/PuppetLabs/puppet/cache",
|
17
|
+
"puppet_environmentpath": "C:/ProgramData/PuppetLabs/code/environments",
|
18
|
+
"puppet_server": "pe-puppet.localdomain",
|
19
|
+
"service_provider": "windows",
|
20
|
+
"staging_http_get": "curl",
|
21
|
+
"common_appdata": "C:\\ProgramData",
|
22
|
+
"architecture": "x64",
|
23
|
+
"kernel": "windows",
|
24
|
+
"virtual": "vmware",
|
25
|
+
"is_virtual": true,
|
26
|
+
"hardwaremodel": "x64",
|
27
|
+
"operatingsystem": "windows",
|
28
|
+
"os": {
|
29
|
+
"name": "windows",
|
30
|
+
"family": "windows",
|
31
|
+
"release": {
|
32
|
+
"major": "10",
|
33
|
+
"full": "10"
|
34
|
+
}
|
35
|
+
},
|
36
|
+
"facterversion": "2.5.1",
|
37
|
+
"fqdn": "VAGRANT-HB9G3RD",
|
38
|
+
"hostname": "VAGRANT-HB9G3RD",
|
39
|
+
"id": "vagrant-hb9g3rd\\vagrant",
|
40
|
+
"interfaces": "Ethernet0_2",
|
41
|
+
"ipaddress_ethernet0_2": "192.168.43.174",
|
42
|
+
"ipaddress6_ethernet0_2": "fd72:b3ab:b8dd:0:f563:fac2:928c:6aa",
|
43
|
+
"macaddress_ethernet0_2": "00:0C:29:A3:53:54",
|
44
|
+
"netmask_ethernet0_2": "255.255.255.0",
|
45
|
+
"mtu_ethernet0_2": 0,
|
46
|
+
"ipaddress": "192.168.43.174",
|
47
|
+
"ipaddress6": "fd72:b3ab:b8dd:0:f563:fac2:928c:6aa",
|
48
|
+
"kernelmajversion": "10.0",
|
49
|
+
"kernelrelease": "10.0.17134",
|
50
|
+
"kernelversion": "10.0.17134",
|
51
|
+
"macaddress": "00:0C:29:A3:53:54",
|
52
|
+
"manufacturer": "Phoenix Technologies LTD",
|
53
|
+
"serialnumber": "VMware-56 4d 36 2e 2e a4 81 f9-0d 05 ae d0 e5 a3 53 54",
|
54
|
+
"productname": "VMware Virtual Platform",
|
55
|
+
"memorysize": "4.00 GB",
|
56
|
+
"memoryfree": "2.30 GB",
|
57
|
+
"memorysize_mb": "4095.49",
|
58
|
+
"memoryfree_mb": "2360.00",
|
59
|
+
"netmask": "255.255.255.0",
|
60
|
+
"network_ethernet0_2": "192.168.43.0",
|
61
|
+
"operatingsystemmajrelease": "10",
|
62
|
+
"operatingsystemrelease": "10",
|
63
|
+
"osfamily": "windows",
|
64
|
+
"path": "C:\\tools\\ruby24\\bin;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\OpenSSH\\;C:\\ProgramData\\chocolatey\\bin;C:\\Program Files (x86)\\vim\\vim80;C:\\Program Files\\Git\\cmd;C:\\Program Files\\Puppet Labs\\Puppet\\bin;C:\\Users\\vagrant\\AppData\\Local\\Microsoft\\WindowsApps;",
|
65
|
+
"physicalprocessorcount": 4,
|
66
|
+
"processors": {
|
67
|
+
"models": [
|
68
|
+
"Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz",
|
69
|
+
"Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz",
|
70
|
+
"Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz",
|
71
|
+
"Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz"
|
72
|
+
],
|
73
|
+
"count": 4,
|
74
|
+
"physicalcount": 4
|
75
|
+
},
|
76
|
+
"processor0": "Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz",
|
77
|
+
"processor1": "Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz",
|
78
|
+
"processor2": "Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz",
|
79
|
+
"processor3": "Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz",
|
80
|
+
"processorcount": 4,
|
81
|
+
"ps": "tasklist.exe",
|
82
|
+
"rubyplatform": "x64-mingw32",
|
83
|
+
"rubysitedir": "C:/tools/ruby24/lib/ruby/site_ruby/2.4.0",
|
84
|
+
"rubyversion": "2.4.3",
|
85
|
+
"system32": "C:\\Windows\\system32",
|
86
|
+
"choco_install_path": "C:\\ProgramData\\chocolatey",
|
87
|
+
"system_uptime": {
|
88
|
+
"seconds": 1113359,
|
89
|
+
"hours": 309,
|
90
|
+
"days": 12,
|
91
|
+
"uptime": "12 days"
|
92
|
+
},
|
93
|
+
"timezone": "GMT Standard Time",
|
94
|
+
"uptime": "12 days",
|
95
|
+
"uptime_days": 12,
|
96
|
+
"uptime_hours": 309,
|
97
|
+
"uptime_seconds": 1113359,
|
98
|
+
"clientcert": "vagrant-hb9g3rd.lan.asio",
|
99
|
+
"clientversion": "6.0.2",
|
100
|
+
"clientnoop": false
|
101
|
+
},
|
102
|
+
"timestamp": "2018-12-10T21:43:07.468533000+00:00",
|
103
|
+
"expiration": "2018-12-10T22:13:07.468533000+00:00"
|
104
|
+
}
|
data/features/cache.feature
CHANGED
@@ -14,7 +14,7 @@ Feature: Create and maintain a .onceover cache
|
|
14
14
|
Then the cache should exist
|
15
15
|
And the cache should contain all controlrepo files
|
16
16
|
|
17
|
-
Scenario:
|
17
|
+
Scenario: Run onceover in the caching repo
|
18
18
|
Given control repo "caching"
|
19
19
|
When I run onceover command "run spec --classes role::webserver"
|
20
20
|
Then I should not see any errors
|
data/features/factsets.feature
CHANGED
@@ -5,15 +5,44 @@ Feature: Handle factsets properly
|
|
5
5
|
Background:
|
6
6
|
Given onceover executable
|
7
7
|
|
8
|
-
Scenario:
|
8
|
+
Scenario: Selecting existing factsets
|
9
9
|
Given control repo "factsets"
|
10
10
|
When I run onceover command "init"
|
11
11
|
Then the config should contain "centos_with_env"
|
12
12
|
|
13
13
|
# This needs to be tested because an environment fact, if not handled, makes
|
14
|
-
# compilation fail
|
14
|
+
# compilation fail because it breaks all of the workarounds that have been
|
15
15
|
# put in place within rspec-puppet for the environment
|
16
|
-
|
16
|
+
@puppet6
|
17
|
+
Scenario: Run with a factset containing an environment facts
|
17
18
|
Given existing control repo "factsets"
|
18
|
-
When I run onceover command "run spec"
|
19
|
+
When I run onceover command "run spec" with class "role::example"
|
19
20
|
Then I should not see any errors
|
21
|
+
|
22
|
+
@puppet6
|
23
|
+
Scenario: Run trusted_extensions tests on nodes where pp_datacenter is PDK
|
24
|
+
Given existing control repo "factsets"
|
25
|
+
When I run onceover command "run spec" with class "role::trusted_extensions" on nodes "centos7_trusted_extensions_top,centos7_trusted_extensions_nested"
|
26
|
+
Then I should not see any errors
|
27
|
+
|
28
|
+
# Spec tests should only pass on the centos7_trusted_extensions_top and
|
29
|
+
# centos7_trusted_extensions_nested factsets. The rest should fail
|
30
|
+
@puppet6
|
31
|
+
Scenario: Run trusted_extensions tests on nodes where pp_datacenter is not set
|
32
|
+
Given existing control repo "factsets"
|
33
|
+
When I run onceover command "run spec" with class "role::trusted_extensions"
|
34
|
+
Then I should see error with message pattern "Evaluation Error: Error while evaluating a Function Call, pp_datacenter is not set to PDX"
|
35
|
+
|
36
|
+
@puppet6
|
37
|
+
Scenario: Run trusted_external tests on nodes where $trusted['external']['example']['foo'] is set to 'bar'
|
38
|
+
Given existing control repo "factsets"
|
39
|
+
When I run onceover command "run spec" with class "role::trusted_external" on nodes "centos7_trusted_external_top,centos7_trusted_external_nested"
|
40
|
+
Then I should not see any errors
|
41
|
+
|
42
|
+
# Spec tests should only pass on the centos7_trusted_externalq_top and
|
43
|
+
# centos7_trusted_external_nested factsets. The rest should fail
|
44
|
+
@puppet6
|
45
|
+
Scenario: Run trusted_external tests on nodes where $trusted['external'] is not specified
|
46
|
+
Given existing control repo "factsets"
|
47
|
+
When I run onceover command "run spec" with class "role::trusted_external"
|
48
|
+
Then I should see error with message pattern "Evaluation Error: Operator \'\[\]\' is not applicable to an Undef Value."
|
@@ -5,12 +5,12 @@ end
|
|
5
5
|
|
6
6
|
Then(/^the cache should contain all controlrepo files/) do
|
7
7
|
# Get all root files
|
8
|
-
|
8
|
+
log("Calculating MD5 hashes in repo")
|
9
9
|
repo_digest = Cache_Helper.digest(@repo.root_folder)
|
10
|
-
|
11
|
-
|
10
|
+
log("#{repo_digest.count} MD5 hashes calculated")
|
11
|
+
log("Calculating MD5 hashes in cache")
|
12
12
|
cache_digest = Cache_Helper.digest(File.join(@repo.root_folder,'.onceover/etc/puppetlabs/code/environments/production/'))
|
13
|
-
|
13
|
+
log("#{cache_digest.count} MD5 hashes calculated")
|
14
14
|
expect(cache_digest).to include(repo_digest)
|
15
15
|
end
|
16
16
|
|
@@ -7,6 +7,8 @@ Given(/^control repo "([^"]*)"$/) do |controlrepo_name|
|
|
7
7
|
@cmd.controlrepo = @repo
|
8
8
|
FileUtils.rm_rf @repo.root_folder
|
9
9
|
FileUtils.mkdir_p @repo.tmp_folder
|
10
|
+
|
11
|
+
FileUtils.rm_rf "#{@repo.tmp_folder}#{controlrepo_name}"
|
10
12
|
FileUtils.cp_r "spec/fixtures/controlrepos/#{controlrepo_name}", @repo.tmp_folder
|
11
13
|
end
|
12
14
|
|
@@ -27,13 +29,19 @@ end
|
|
27
29
|
|
28
30
|
When(/^I run onceover command "([^"]*)"$/) do |command|
|
29
31
|
@cmd.command = "#{command} --debug"
|
30
|
-
|
32
|
+
log(@cmd)
|
31
33
|
@cmd.run
|
32
34
|
end
|
33
35
|
|
34
36
|
When(/^I run onceover command "([^"]*)" with class "([^"]*)"$/) do |command, cls|
|
35
37
|
@cmd.command = "#{command} --classes #{cls}"
|
36
|
-
|
38
|
+
log(@cmd)
|
39
|
+
@cmd.run
|
40
|
+
end
|
41
|
+
|
42
|
+
When(/^I run onceover command "([^"]*)" with class "([^"]*)" on nodes "([^"]*)"$/) do |command, cls, nodes|
|
43
|
+
@cmd.command = "#{command} --classes #{cls} --nodes #{nodes}"
|
44
|
+
log(@cmd)
|
37
45
|
@cmd.run
|
38
46
|
end
|
39
47
|
|
@@ -53,12 +61,12 @@ Then(/^I see help for commands: "([^"]*)"$/) do |commands|
|
|
53
61
|
commands_help = @cmd.output[/COMMANDS(.*)OPTIONS/m, 1]
|
54
62
|
commands.split(',').each do |command|
|
55
63
|
result = commands_help.match(/^\s+#{command.strip}.+\n/)
|
56
|
-
|
64
|
+
log(result.to_s) if expect(result).not_to be nil
|
57
65
|
end
|
58
66
|
end
|
59
67
|
|
60
68
|
Then(/^I should not see any errors$/) do
|
61
|
-
|
69
|
+
log(@cmd.output) unless @cmd.success?
|
62
70
|
expect(@cmd.success?).to be true
|
63
71
|
end
|
64
72
|
|
@@ -73,17 +81,43 @@ end
|
|
73
81
|
|
74
82
|
Then(/^I should see error with message pattern "([^"]*)"$/) do |err_msg_regexp|
|
75
83
|
expect(@cmd.success?).to be false
|
76
|
-
|
84
|
+
log(@cmd.output)
|
77
85
|
expect(@cmd.output.match err_msg_regexp).to_not be nil
|
78
86
|
end
|
79
87
|
|
80
|
-
Then(/^I should see message pattern "([^"]*)"$/) do |msg_regexp|
|
88
|
+
Then(/^I should (not )?see message pattern "([^"]*)"$/) do |notword, msg_regexp|
|
81
89
|
output_surround = 30
|
82
90
|
match = Regexp.new(msg_regexp).match(@cmd.output)
|
83
|
-
|
84
|
-
|
85
|
-
|
91
|
+
|
92
|
+
# Expect it to match unless we said it shouldn't match
|
93
|
+
expected_match = notword.nil?
|
94
|
+
does_match = !match.nil?
|
95
|
+
|
96
|
+
if expected_match
|
97
|
+
expect(@cmd.output).to match(msg_regexp)
|
86
98
|
else
|
87
|
-
|
99
|
+
expect(@cmd.output).not_to match(msg_regexp)
|
88
100
|
end
|
101
|
+
|
102
|
+
# If the regex matches and that's what we expected then just print a summary
|
103
|
+
if does_match == expected_match
|
104
|
+
if match
|
105
|
+
log(match.pre_match[-output_surround..-1] + match.to_s + match.post_match[0..output_surround])
|
106
|
+
end
|
107
|
+
else
|
108
|
+
log(@cmd.output)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
When(/^I run onceover command "([^"]*)" with \-\-puppetfile ([^"]*)$/) do |command, puppetfile|
|
113
|
+
puppetfile_path = @repo.root_folder + puppetfile
|
114
|
+
@cmd.command = "#{command} --puppetfile #{puppetfile_path} --debug"
|
115
|
+
log(@cmd)
|
116
|
+
@cmd.run
|
117
|
+
end
|
118
|
+
|
119
|
+
Then(/^([^"]*) should be copied to Puppetfile$/) do |puppetfile|
|
120
|
+
source = @repo.root_folder + puppetfile
|
121
|
+
destination = @repo.onceover_temp_puppetfile
|
122
|
+
expect(IO.read(source)).to eq(IO.read(destination))
|
89
123
|
end
|
@@ -7,11 +7,11 @@ Then(/^I should see generated all necessary files and folders$/) do
|
|
7
7
|
folders = [ 'spec/factsets', 'spec/pre_conditions'].map! { |x| @repo.root_folder + x}
|
8
8
|
|
9
9
|
files.each do |file|
|
10
|
-
|
10
|
+
log(file)
|
11
11
|
expect( File.exist? file ).to be true
|
12
12
|
end
|
13
13
|
folders.each do |folder|
|
14
|
-
|
14
|
+
log(folder)
|
15
15
|
expect( Dir.exist? folder ).to be true
|
16
16
|
end
|
17
17
|
end
|
data/features/windows.feature
CHANGED
@@ -28,3 +28,8 @@ Feature: Run onceover with windows
|
|
28
28
|
When I run onceover command "run spec" with class "role::users"
|
29
29
|
Then I should not see any errors
|
30
30
|
|
31
|
+
Scenario: Compiling a windows role with chocolatey that is valid should compile
|
32
|
+
Given control repo "windows"
|
33
|
+
When I run onceover command "run spec" with class "role::choco"
|
34
|
+
Then I should not see any errors
|
35
|
+
|
data/features/zzz_run.feature
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
@run
|
2
2
|
Feature: Run rspec and acceptance test suites
|
3
|
-
Onceover should allow to run rspec and acceptance test for all
|
3
|
+
Onceover should allow to run rspec and acceptance test for all profile and role classes
|
4
4
|
or for any part of them. Use should set if he wants to see only summary of tests or full
|
5
5
|
log info.
|
6
6
|
|
@@ -52,6 +52,11 @@ Feature: Run rspec and acceptance test suites
|
|
52
52
|
And I run onceover command "run spec --force"
|
53
53
|
Then I should see message pattern "Overwriting local modifications"
|
54
54
|
|
55
|
+
Scenario: When using an alternate manifests directory
|
56
|
+
Given initialized control repo "basic"
|
57
|
+
When I run onceover command "run spec --manifest manifests_alternate"
|
58
|
+
Then I should see error with message pattern "Using alternate site.pp"
|
59
|
+
|
55
60
|
Scenario: Check that control_branch functionality works
|
56
61
|
Given initialized control repo "control_branch"
|
57
62
|
When I run onceover command "run spec"
|
@@ -73,8 +78,22 @@ Feature: Run rspec and acceptance test suites
|
|
73
78
|
Then I should see message pattern "failed"
|
74
79
|
And Onceover should exit 1
|
75
80
|
|
81
|
+
Scenario: Run with a custom Puppetfile
|
82
|
+
Given initialized control repo "custom_puppetfile"
|
83
|
+
When I run onceover command "run spec" with --puppetfile Puppetfile.custom
|
84
|
+
Then Puppetfile.custom should be copied to Puppetfile
|
85
|
+
And I should see message pattern "Using Puppetfile .*Puppetfile"
|
86
|
+
And I should see message pattern "Updating module .*extlib"
|
87
|
+
|
88
|
+
Scenario: Testing that --tags works with native rspec tags
|
89
|
+
Given control repo "puppet_controlrepo"
|
90
|
+
When I run onceover command "run spec --tags syntax"
|
91
|
+
Then I should not see any errors
|
92
|
+
And I should see message pattern "When checking Puppet syntax"
|
93
|
+
And I should not see message pattern "role::"
|
94
|
+
|
76
95
|
# This test is a full test using my controlrepo. It should remain at the end because it takes ages
|
77
96
|
Scenario: Run advanced spec tests
|
78
97
|
Given control repo "puppet_controlrepo"
|
79
|
-
When I run onceover command "run spec -p"
|
80
|
-
Then I should not see any errors
|
98
|
+
When I run onceover command "run spec -p --force"
|
99
|
+
Then I should not see any errors
|