chef-sugar 4.2.1 → 5.0.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/lib/chef/sugar/version.rb +1 -1
- metadata +3 -63
- data/.github/lock.yml +0 -3
- data/.github/reaction.yml +0 -1
- data/.gitignore +0 -26
- data/.kitchen.yml +0 -16
- data/.travis.yml +0 -17
- data/CHANGELOG.md +0 -261
- data/CONTRIBUTING.md +0 -20
- data/Gemfile +0 -2
- data/README.md +0 -540
- data/Rakefile +0 -11
- data/chef-sugar.gemspec +0 -33
- data/libraries/chef-sugar.rb +0 -1
- data/metadata.rb +0 -24
- data/recipes/default.rb +0 -20
- data/spec/spec_helper.rb +0 -25
- data/spec/support/shared_examples.rb +0 -20
- data/spec/unit/chef/sugar/architecture_spec.rb +0 -129
- data/spec/unit/chef/sugar/cloud_spec.rb +0 -149
- data/spec/unit/chef/sugar/constraints_spec.rb +0 -45
- data/spec/unit/chef/sugar/core_extensions/array_spec.rb +0 -10
- data/spec/unit/chef/sugar/core_extensions/object_spec.rb +0 -62
- data/spec/unit/chef/sugar/core_extensions/string_spec.rb +0 -48
- data/spec/unit/chef/sugar/data_bag_spec.rb +0 -118
- data/spec/unit/chef/sugar/docker_spec.rb +0 -39
- data/spec/unit/chef/sugar/init_spec.rb +0 -74
- data/spec/unit/chef/sugar/ip_spec.rb +0 -53
- data/spec/unit/chef/sugar/kernel_spec.rb +0 -16
- data/spec/unit/chef/sugar/kitchen_spec.rb +0 -18
- data/spec/unit/chef/sugar/node_spec.rb +0 -172
- data/spec/unit/chef/sugar/platform_family_spec.rb +0 -166
- data/spec/unit/chef/sugar/platform_spec.rb +0 -342
- data/spec/unit/chef/sugar/ruby_spec.rb +0 -39
- data/spec/unit/chef/sugar/run_context_spec.rb +0 -19
- data/spec/unit/chef/sugar/shell_spec.rb +0 -104
- data/spec/unit/chef/sugar/vagrant_spec.rb +0 -37
- data/spec/unit/chef/sugar/virtualization_spec.rb +0 -135
- data/spec/unit/recipes/default_spec.rb +0 -9
@@ -1,172 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Chef::Node do
|
4
|
-
describe '#in?' do
|
5
|
-
it 'returns true when the node is in the environment' do
|
6
|
-
allow(subject).to receive(:chef_environment).and_return('production')
|
7
|
-
expect(subject.in?('production')).to be true
|
8
|
-
expect(subject.in?(/production$/)).to be true
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'returns false when the node is not in the environment' do
|
12
|
-
allow(subject).to receive(:chef_environment).and_return('staging')
|
13
|
-
expect(subject.in?('production')).to be false
|
14
|
-
expect(subject.in?(/production$/)).to be false
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
describe '#deep_fetch' do
|
19
|
-
let(:node) { described_class.new }
|
20
|
-
before { node.default['apache2']['config']['root'] = '/var/www' }
|
21
|
-
|
22
|
-
it 'fetches a deeply nested attribute' do
|
23
|
-
expect(node.deep_fetch('apache2', 'config', 'root')).to eq('/var/www')
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'ignores symbols, strings, etc' do
|
27
|
-
expect(node.deep_fetch(:apache2, :config, :root)).to eq('/var/www')
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'safely returns nil if a key does not exist' do
|
31
|
-
expect(node.deep_fetch(:apache2, :not_real, :nested, :yup)).to be_nil
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
describe '#deep_fetch!' do
|
36
|
-
let(:node) { described_class.new }
|
37
|
-
before { node.default['apache2']['config']['root'] = '/var/www' }
|
38
|
-
|
39
|
-
it 'fetches a deeply nested attribute' do
|
40
|
-
expect(node.deep_fetch!('apache2', 'config', 'root')).to eq('/var/www')
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'ignores symbols, strings, etc' do
|
44
|
-
expect(node.deep_fetch!(:apache2, :config, :root)).to eq('/var/www')
|
45
|
-
end
|
46
|
-
|
47
|
-
it 'raises an error if a key does not exist' do
|
48
|
-
expect {
|
49
|
-
node.deep_fetch!(:apache2, :not_real)
|
50
|
-
}.to raise_error(Chef::Node::AttributeDoesNotExistError) { |e|
|
51
|
-
expect(e.message).to eq(<<-EOH.gsub(/^ {10}/, ''))
|
52
|
-
No attribute `node['apache2']['not_real']' exists on
|
53
|
-
the current node. Specifically the `not_real' attribute is not
|
54
|
-
defined. Please make sure you have spelled everything correctly.
|
55
|
-
EOH
|
56
|
-
}
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
describe '#namespace' do
|
61
|
-
let(:node) { described_class.new }
|
62
|
-
|
63
|
-
it 'defines the attributes' do
|
64
|
-
node.instance_eval do
|
65
|
-
namespace 'apache2' do
|
66
|
-
namespace 'config' do
|
67
|
-
root '/var/www'
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
expect(node.default).to eq({
|
73
|
-
'apache2' => {
|
74
|
-
'config' => { 'root' => '/var/www' }
|
75
|
-
}
|
76
|
-
})
|
77
|
-
end
|
78
|
-
|
79
|
-
it 'accepts multiple attributes' do
|
80
|
-
node.instance_eval do
|
81
|
-
namespace 'apache2', 'config' do
|
82
|
-
root '/var/www'
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
expect(node.default).to eq({
|
87
|
-
'apache2' => {
|
88
|
-
'config' => { 'root' => '/var/www' }
|
89
|
-
}
|
90
|
-
})
|
91
|
-
end
|
92
|
-
|
93
|
-
it 'accepts attribute precedence levels' do
|
94
|
-
node.instance_eval do
|
95
|
-
namespace 'apache2', precedence: normal do
|
96
|
-
namespace 'config', precedence: override do
|
97
|
-
root '/var/www'
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
expect(node.override).to eq({
|
103
|
-
'apache2' => {
|
104
|
-
'config' => { 'root' => '/var/www' }
|
105
|
-
}
|
106
|
-
})
|
107
|
-
end
|
108
|
-
|
109
|
-
it 'maintains precedence level into nested calls' do
|
110
|
-
node.instance_eval do
|
111
|
-
namespace 'apache2', precedence: override do
|
112
|
-
namespace 'config' do
|
113
|
-
root '/var/www'
|
114
|
-
end
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
expect(node.override).to eq({
|
119
|
-
'apache2' => {
|
120
|
-
'config' => { 'root' => '/var/www' }
|
121
|
-
}
|
122
|
-
})
|
123
|
-
end
|
124
|
-
|
125
|
-
it 'resets precedence to default in subsequent non-nested calls' do
|
126
|
-
node.instance_eval do
|
127
|
-
namespace 'apache2', precedence: override do
|
128
|
-
namespace 'config' do
|
129
|
-
root '/var/www'
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
namespace 'php' do
|
134
|
-
version '5.3'
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
expect(node.override).to eq({
|
139
|
-
'apache2' => {
|
140
|
-
'config' => { 'root' => '/var/www' }
|
141
|
-
}
|
142
|
-
})
|
143
|
-
|
144
|
-
expect(node.default).to eq({
|
145
|
-
'php' => {
|
146
|
-
'version' => '5.3'
|
147
|
-
}
|
148
|
-
})
|
149
|
-
end
|
150
|
-
|
151
|
-
it 'can access attributes within itself' do
|
152
|
-
node.instance_eval do
|
153
|
-
namespace 'apache2' do
|
154
|
-
namespace 'config' do
|
155
|
-
root '/var/www'
|
156
|
-
ssl File.join(root, 'ssl')
|
157
|
-
end
|
158
|
-
end
|
159
|
-
end
|
160
|
-
|
161
|
-
expect(node.default).to eq({
|
162
|
-
'apache2' => {
|
163
|
-
'config' => {
|
164
|
-
'root' => '/var/www',
|
165
|
-
'ssl' => '/var/www/ssl',
|
166
|
-
}
|
167
|
-
}
|
168
|
-
})
|
169
|
-
end
|
170
|
-
end
|
171
|
-
|
172
|
-
end
|
@@ -1,166 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Chef::Sugar::PlatformFamily do
|
4
|
-
it_behaves_like 'a chef sugar'
|
5
|
-
|
6
|
-
describe '#arch_linux?' do
|
7
|
-
it 'returns true when the platform_family is arch linux' do
|
8
|
-
node = { 'platform_family' => 'arch' }
|
9
|
-
expect(described_class.arch_linux?(node)).to be true
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'returns false when the platform_family is not arch linux' do
|
13
|
-
node = { 'platform_family' => 'windows' }
|
14
|
-
expect(described_class.arch_linux?(node)).to be false
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
describe '#debian?' do
|
19
|
-
it 'returns true when the platform_family is debian' do
|
20
|
-
node = { 'platform_family' => 'debian' }
|
21
|
-
expect(described_class.debian?(node)).to be true
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'returns false when the platform_family is not debian' do
|
25
|
-
node = { 'platform_family' => 'windows' }
|
26
|
-
expect(described_class.debian?(node)).to be false
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
describe '#fedora?' do
|
31
|
-
it 'returns true when the platform_family is fedora' do
|
32
|
-
node = { 'platform_family' => 'fedora' }
|
33
|
-
expect(described_class.fedora?(node)).to be true
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'returns false when the platform_family is not fedora' do
|
37
|
-
node = { 'platform_family' => 'windows' }
|
38
|
-
expect(described_class.fedora?(node)).to be false
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
describe '#freebsd?' do
|
43
|
-
it 'returns true when the platform_family is freebsd' do
|
44
|
-
node = { 'platform_family' => 'freebsd' }
|
45
|
-
expect(described_class.freebsd?(node)).to be true
|
46
|
-
end
|
47
|
-
|
48
|
-
it 'returns false when the platform_family is not freebsd' do
|
49
|
-
node = { 'platform_family' => 'windows' }
|
50
|
-
expect(described_class.freebsd?(node)).to be false
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
describe '#gentoo?' do
|
55
|
-
it 'returns true when the platform_family is gentoo' do
|
56
|
-
node = { 'platform_family' => 'gentoo' }
|
57
|
-
expect(described_class.gentoo?(node)).to be true
|
58
|
-
end
|
59
|
-
|
60
|
-
it 'returns false when the platform_family is not gentoo' do
|
61
|
-
node = { 'platform_family' => 'windows' }
|
62
|
-
expect(described_class.gentoo?(node)).to be false
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
describe '#mac_os_x?' do
|
67
|
-
it 'returns true when the platform_family is mac_os_x' do
|
68
|
-
node = { 'platform_family' => 'mac_os_x' }
|
69
|
-
expect(described_class.mac_os_x?(node)).to be true
|
70
|
-
end
|
71
|
-
|
72
|
-
it 'returns false when the platform_family is not mac_os_x' do
|
73
|
-
node = { 'platform_family' => 'windows' }
|
74
|
-
expect(described_class.mac_os_x?(node)).to be false
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
describe '#openbsd?' do
|
79
|
-
it 'returns true when the platform_family is openbsd' do
|
80
|
-
node = { 'platform_family' => 'openbsd' }
|
81
|
-
expect(described_class.openbsd?(node)).to be true
|
82
|
-
end
|
83
|
-
|
84
|
-
it 'returns false when the platform_family is not openbsd' do
|
85
|
-
node = { 'platform_family' => 'windows' }
|
86
|
-
expect(described_class.openbsd?(node)).to be false
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
describe '#rhel?' do
|
91
|
-
it 'returns true when the platform_family is rhel' do
|
92
|
-
node = { 'platform_family' => 'rhel' }
|
93
|
-
expect(described_class.rhel?(node)).to be true
|
94
|
-
end
|
95
|
-
|
96
|
-
it 'returns false when the platform_family is not rhel' do
|
97
|
-
node = { 'platform_family' => 'windows' }
|
98
|
-
expect(described_class.rhel?(node)).to be false
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
describe '#slackware?' do
|
103
|
-
it 'returns true when the platform_family is slackware' do
|
104
|
-
node = { 'platform_family' => 'slackware' }
|
105
|
-
expect(described_class.slackware?(node)).to be true
|
106
|
-
end
|
107
|
-
|
108
|
-
it 'returns false when the platform_family is not slackware' do
|
109
|
-
node = { 'platform_family' => 'windows' }
|
110
|
-
expect(described_class.slackware?(node)).to be false
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
describe '#suse?' do
|
115
|
-
it 'returns true when the platform_family is suse' do
|
116
|
-
node = { 'platform_family' => 'suse' }
|
117
|
-
expect(described_class.suse?(node)).to be true
|
118
|
-
end
|
119
|
-
|
120
|
-
it 'returns false when the platform_family is not suse' do
|
121
|
-
node = { 'platform_family' => 'windows' }
|
122
|
-
expect(described_class.suse?(node)).to be false
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
describe '#windows?' do
|
127
|
-
it 'returns true when the platform_family is windows' do
|
128
|
-
node = { 'platform_family' => 'windows' }
|
129
|
-
expect(described_class.windows?(node)).to be true
|
130
|
-
end
|
131
|
-
|
132
|
-
it 'returns false when the platform_family is not windows' do
|
133
|
-
node = { 'platform_family' => 'debian' }
|
134
|
-
expect(described_class.windows?(node)).to be false
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
describe '#wrlinux?' do
|
139
|
-
it 'returns true when the platform_family is wrlinux' do
|
140
|
-
node = { 'platform_family' => 'wrlinux' }
|
141
|
-
expect(described_class.wrlinux?(node)).to be true
|
142
|
-
end
|
143
|
-
|
144
|
-
it 'returns false when the platform_family is not wrlinux' do
|
145
|
-
node = { 'platform_family' => 'debian' }
|
146
|
-
expect(described_class.wrlinux?(node)).to be false
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
describe '#linux?' do
|
151
|
-
it 'returns true when the os is Linux' do
|
152
|
-
node = { 'os' => 'linux' }
|
153
|
-
expect(described_class.linux?(node)).to be true
|
154
|
-
end
|
155
|
-
|
156
|
-
it 'returns false when the os is Windows' do
|
157
|
-
node = { 'os' => 'windows' }
|
158
|
-
expect(described_class.linux?(node)).to be false
|
159
|
-
end
|
160
|
-
|
161
|
-
it 'returns false when the os is Windows' do
|
162
|
-
node = { 'os' => 'darwin' }
|
163
|
-
expect(described_class.linux?(node)).to be false
|
164
|
-
end
|
165
|
-
end
|
166
|
-
end
|
@@ -1,342 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Chef::Sugar::Platform do
|
4
|
-
it_behaves_like 'a chef sugar'
|
5
|
-
|
6
|
-
describe '#linux_mint?' do
|
7
|
-
it 'returns true when the platform is linux mint' do
|
8
|
-
node = { 'platform' => 'linuxmint' }
|
9
|
-
expect(described_class.linux_mint?(node)).to be true
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'returns false when the platform is not linux mint' do
|
13
|
-
node = { 'platform' => 'windows' }
|
14
|
-
expect(described_class.linux_mint?(node)).to be false
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
describe '#ubuntu?' do
|
19
|
-
it 'returns true when the platform is ubuntu' do
|
20
|
-
node = { 'platform' => 'ubuntu' }
|
21
|
-
expect(described_class.ubuntu?(node)).to be true
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'returns false when the platform is not ubuntu' do
|
25
|
-
node = { 'platform' => 'windows' }
|
26
|
-
expect(described_class.ubuntu?(node)).to be false
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
describe '#amazon_linux?' do
|
31
|
-
it 'returns true when the platform is amazon linux' do
|
32
|
-
node = { 'platform' => 'amazon' }
|
33
|
-
expect(described_class.amazon_linux?(node)).to be true
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'returns false when the platform is not amazon linux' do
|
37
|
-
node = { 'platform' => 'windows' }
|
38
|
-
expect(described_class.amazon_linux?(node)).to be false
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
describe '#centos?' do
|
43
|
-
it 'returns true when the platform is centos' do
|
44
|
-
node = { 'platform' => 'centos' }
|
45
|
-
expect(described_class.centos?(node)).to be true
|
46
|
-
end
|
47
|
-
|
48
|
-
it 'returns false when the platform is not centos' do
|
49
|
-
node = { 'platform' => 'windows' }
|
50
|
-
expect(described_class.centos?(node)).to be false
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
describe '#oracle_linux?' do
|
55
|
-
it 'returns true when the platform is oracle linux' do
|
56
|
-
node = { 'platform' => 'oracle' }
|
57
|
-
expect(described_class.oracle_linux?(node)).to be true
|
58
|
-
end
|
59
|
-
|
60
|
-
it 'returns false when the platform is not oracle linux' do
|
61
|
-
node = { 'platform' => 'windows' }
|
62
|
-
expect(described_class.oracle_linux?(node)).to be false
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
describe '#scientific_linux?' do
|
67
|
-
it 'returns true when the platform is scientific linux' do
|
68
|
-
node = { 'platform' => 'scientific' }
|
69
|
-
expect(described_class.scientific_linux?(node)).to be true
|
70
|
-
end
|
71
|
-
|
72
|
-
it 'returns false when the platform is not scientific linux' do
|
73
|
-
node = { 'platform' => 'windows' }
|
74
|
-
expect(described_class.scientific_linux?(node)).to be false
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
describe '#redhat_enterprise_linux?' do
|
79
|
-
it 'returns true when the platform is redhat enterprise linux' do
|
80
|
-
node = { 'platform' => 'redhat' }
|
81
|
-
expect(described_class.redhat_enterprise_linux?(node)).to be true
|
82
|
-
end
|
83
|
-
|
84
|
-
it 'returns false when the platform is not redhat enterprise linux' do
|
85
|
-
node = { 'platform' => 'enterprise' }
|
86
|
-
expect(described_class.redhat_enterprise_linux?(node)).to be false
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
describe '#solaris2?' do
|
91
|
-
it 'returns true when the platform is solaris2' do
|
92
|
-
node = { 'platform' => 'solaris2' }
|
93
|
-
expect(described_class.solaris2?(node)).to be true
|
94
|
-
end
|
95
|
-
|
96
|
-
it 'returns false when the platform is not solaris2' do
|
97
|
-
node = { 'platform' => 'windows' }
|
98
|
-
expect(described_class.solaris2?(node)).to be false
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
describe '#aix?' do
|
103
|
-
it 'returns true when the platform is aix' do
|
104
|
-
node = { 'platform' => 'aix' }
|
105
|
-
expect(described_class.aix?(node)).to be true
|
106
|
-
end
|
107
|
-
|
108
|
-
it 'returns false when the platform is not aix' do
|
109
|
-
node = { 'platform' => 'windows' }
|
110
|
-
expect(described_class.aix?(node)).to be false
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
describe '#smartos?' do
|
115
|
-
it 'returns true when the platform is smartos' do
|
116
|
-
node = { 'platform' => 'smartos' }
|
117
|
-
expect(described_class.smartos?(node)).to be true
|
118
|
-
end
|
119
|
-
|
120
|
-
it 'returns false when the platform is not smartos' do
|
121
|
-
node = { 'platform' => 'windows' }
|
122
|
-
expect(described_class.smartos?(node)).to be false
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
describe '#omnios?' do
|
127
|
-
it 'returns true when the platform is omnios' do
|
128
|
-
node = { 'platform' => 'omnios' }
|
129
|
-
expect(described_class.omnios?(node)).to be true
|
130
|
-
end
|
131
|
-
|
132
|
-
it 'returns false when the platform is not omnios' do
|
133
|
-
node = { 'platform' => 'windows' }
|
134
|
-
expect(described_class.omnios?(node)).to be false
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
describe '#raspbian?' do
|
139
|
-
it 'returns true when platform is raspbian' do
|
140
|
-
node = { 'platform' => 'raspbian' }
|
141
|
-
expect(described_class.raspbian?(node)).to be true
|
142
|
-
end
|
143
|
-
|
144
|
-
it 'returns false when the platform is not raspbian' do
|
145
|
-
node = { 'platform' => 'windows' }
|
146
|
-
expect(described_class.raspbian?(node)).to be false
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
describe '#nexus' do
|
151
|
-
it 'returns true when the platform is nexus' do
|
152
|
-
node = { 'platform' => 'nexus' }
|
153
|
-
expect(described_class.nexus?(node)).to be true
|
154
|
-
end
|
155
|
-
|
156
|
-
it 'returns false when the platform is not nexus' do
|
157
|
-
node = { 'platform' => 'windows' }
|
158
|
-
expect(described_class.nexus?(node)).to be false
|
159
|
-
end
|
160
|
-
end
|
161
|
-
|
162
|
-
describe '#ios_xr' do
|
163
|
-
it 'returns true when the platform is ios_xr' do
|
164
|
-
node = { 'platform' => 'ios_xr' }
|
165
|
-
expect(described_class.ios_xr?(node)).to be true
|
166
|
-
end
|
167
|
-
|
168
|
-
it 'returns false when the platform is not ios_xr' do
|
169
|
-
node = { 'platform' => 'windows' }
|
170
|
-
expect(described_class.ios_xr?(node)).to be false
|
171
|
-
end
|
172
|
-
end
|
173
|
-
|
174
|
-
describe '#platform_version' do
|
175
|
-
it 'returns the platform version' do
|
176
|
-
node = { 'platform_version' => '1.2.3' }
|
177
|
-
expect(described_class.platform_version(node)).to eq('1.2.3')
|
178
|
-
end
|
179
|
-
end
|
180
|
-
|
181
|
-
context 'dynamic matchers' do
|
182
|
-
describe '#ubuntu_after_lucid?' do
|
183
|
-
it 'returns true when the version is later than 10.04' do
|
184
|
-
node = { 'platform' => 'ubuntu', 'platform_version' => '10.10' }
|
185
|
-
expect(described_class.ubuntu_after_lucid?(node)).to be true
|
186
|
-
end
|
187
|
-
|
188
|
-
it 'returns false when the version is 10.04' do
|
189
|
-
node = { 'platform' => 'ubuntu', 'platform_version' => '10.04' }
|
190
|
-
expect(described_class.ubuntu_after_lucid?(node)).to be false
|
191
|
-
end
|
192
|
-
|
193
|
-
it 'returns false when the version is a patch release higher than 10.04' do
|
194
|
-
node = { 'platform' => 'ubuntu', 'platform_version' => '10.04.4' }
|
195
|
-
expect(described_class.ubuntu_after_lucid?(node)).to be false
|
196
|
-
end
|
197
|
-
|
198
|
-
it 'returns false when the version is less than 10.04' do
|
199
|
-
node = { 'platform' => 'ubuntu', 'platform_version' => '9.10' }
|
200
|
-
expect(described_class.ubuntu_after_lucid?(node)).to be false
|
201
|
-
end
|
202
|
-
end
|
203
|
-
|
204
|
-
describe '#ubuntu_after_or_at_lucid?' do
|
205
|
-
it 'returns true when the version is later than 10.04' do
|
206
|
-
node = { 'platform' => 'ubuntu', 'platform_version' => '10.10' }
|
207
|
-
expect(described_class.ubuntu_after_or_at_lucid?(node)).to be true
|
208
|
-
end
|
209
|
-
|
210
|
-
it 'returns true when the version is 10.04' do
|
211
|
-
node = { 'platform' => 'ubuntu', 'platform_version' => '10.04' }
|
212
|
-
expect(described_class.ubuntu_after_or_at_lucid?(node)).to be true
|
213
|
-
end
|
214
|
-
|
215
|
-
it 'returns true when the version is a patch release higher than 10.04' do
|
216
|
-
node = { 'platform' => 'ubuntu', 'platform_version' => '10.04.4' }
|
217
|
-
expect(described_class.ubuntu_after_or_at_lucid?(node)).to be true
|
218
|
-
end
|
219
|
-
|
220
|
-
it 'returns false when the version is less than 10.04' do
|
221
|
-
node = { 'platform' => 'ubuntu', 'platform_version' => '9.10' }
|
222
|
-
expect(described_class.ubuntu_after_or_at_lucid?(node)).to be false
|
223
|
-
end
|
224
|
-
end
|
225
|
-
|
226
|
-
describe '#ubuntu_lucid?' do
|
227
|
-
it 'returns false when the version is later than 10.04' do
|
228
|
-
node = { 'platform' => 'ubuntu', 'platform_version' => '10.10' }
|
229
|
-
expect(described_class.ubuntu_lucid?(node)).to be false
|
230
|
-
end
|
231
|
-
|
232
|
-
it 'returns true when the version is 10.04' do
|
233
|
-
node = { 'platform' => 'ubuntu', 'platform_version' => '10.04' }
|
234
|
-
expect(described_class.ubuntu_lucid?(node)).to be true
|
235
|
-
end
|
236
|
-
|
237
|
-
it 'returns true when the version is a patch release higher than 10.04' do
|
238
|
-
node = { 'platform' => 'ubuntu', 'platform_version' => '10.04.4' }
|
239
|
-
expect(described_class.ubuntu_lucid?(node)).to be true
|
240
|
-
end
|
241
|
-
|
242
|
-
it 'returns false when the version is less than 10.04' do
|
243
|
-
node = { 'platform' => 'ubuntu', 'platform_version' => '9.10' }
|
244
|
-
expect(described_class.ubuntu_lucid?(node)).to be false
|
245
|
-
end
|
246
|
-
end
|
247
|
-
|
248
|
-
describe '#ubuntu_before_lucid?' do
|
249
|
-
it 'returns false when the version is later than 10.04' do
|
250
|
-
node = { 'platform' => 'ubuntu', 'platform_version' => '10.10' }
|
251
|
-
expect(described_class.ubuntu_before_lucid?(node)).to be false
|
252
|
-
end
|
253
|
-
|
254
|
-
it 'returns false when the version is 10.04' do
|
255
|
-
node = { 'platform' => 'ubuntu', 'platform_version' => '10.04' }
|
256
|
-
expect(described_class.ubuntu_before_lucid?(node)).to be false
|
257
|
-
end
|
258
|
-
|
259
|
-
it 'returns false when the version is a patch release higher than 10.04' do
|
260
|
-
node = { 'platform' => 'ubuntu', 'platform_version' => '10.04.4' }
|
261
|
-
expect(described_class.ubuntu_before_lucid?(node)).to be false
|
262
|
-
end
|
263
|
-
|
264
|
-
it 'returns true when the version is less than 10.04' do
|
265
|
-
node = { 'platform' => 'ubuntu', 'platform_version' => '9.10' }
|
266
|
-
expect(described_class.ubuntu_before_lucid?(node)).to be true
|
267
|
-
end
|
268
|
-
end
|
269
|
-
|
270
|
-
describe '#ubuntu_before_or_at_lucid?' do
|
271
|
-
it 'returns false when the version is later than 10.04' do
|
272
|
-
node = { 'platform' => 'ubuntu', 'platform_version' => '10.10' }
|
273
|
-
expect(described_class.ubuntu_before_or_at_lucid?(node)).to be false
|
274
|
-
end
|
275
|
-
|
276
|
-
it 'returns true when the version is 10.04' do
|
277
|
-
node = { 'platform' => 'ubuntu', 'platform_version' => '10.04' }
|
278
|
-
expect(described_class.ubuntu_before_or_at_lucid?(node)).to be true
|
279
|
-
end
|
280
|
-
|
281
|
-
it 'returns true when the version is a patch release higher than 10.04' do
|
282
|
-
node = { 'platform' => 'ubuntu', 'platform_version' => '10.04.4' }
|
283
|
-
expect(described_class.ubuntu_before_or_at_lucid?(node)).to be true
|
284
|
-
end
|
285
|
-
|
286
|
-
it 'returns true when the version is less than 10.04' do
|
287
|
-
node = { 'platform' => 'ubuntu', 'platform_version' => '9.10' }
|
288
|
-
expect(described_class.ubuntu_before_or_at_lucid?(node)).to be true
|
289
|
-
end
|
290
|
-
end
|
291
|
-
|
292
|
-
describe '#centos_final?' do
|
293
|
-
it 'returns true when the version is a subset of the major' do
|
294
|
-
node = { 'platform' => 'centos', 'platform_version' => '6.8' }
|
295
|
-
expect(described_class.centos_final?(node)).to be true
|
296
|
-
end
|
297
|
-
|
298
|
-
it 'returns false when the version is not the major' do
|
299
|
-
node = { 'platform' => 'centos', 'platform_version' => '7.4' }
|
300
|
-
expect(described_class.centos_final?(node)).to be false
|
301
|
-
end
|
302
|
-
end
|
303
|
-
|
304
|
-
describe '#debian_wheezy?' do
|
305
|
-
it 'returns true when the version is a subset of the major' do
|
306
|
-
node = { 'platform' => 'debian', 'platform_version' => '7.1' }
|
307
|
-
expect(described_class.debian_wheezy?(node)).to be true
|
308
|
-
end
|
309
|
-
|
310
|
-
it 'returns false when the version is not the major' do
|
311
|
-
node = { 'platform' => 'debian', 'platform_version' => '6.1' }
|
312
|
-
expect(described_class.debian_wheezy?(node)).to be false
|
313
|
-
end
|
314
|
-
end
|
315
|
-
|
316
|
-
describe '#debian_before_wheezy?' do
|
317
|
-
it 'returns true when the version is a less than the major' do
|
318
|
-
node = { 'platform' => 'debian', 'platform_version' => '6.5' }
|
319
|
-
expect(described_class.debian_before_wheezy?(node)).to be true
|
320
|
-
end
|
321
|
-
|
322
|
-
it 'returns false when the version is not less than the major' do
|
323
|
-
node = { 'platform' => 'debian', 'platform_version' => '8.0' }
|
324
|
-
expect(described_class.debian_before_wheezy?(node)).to be false
|
325
|
-
end
|
326
|
-
end
|
327
|
-
|
328
|
-
describe '#solaris_10?' do
|
329
|
-
it 'returns true when the version is 5.10' do
|
330
|
-
node = { 'platform' => 'solaris2', 'platform_version' => '5.10' }
|
331
|
-
expect(described_class.solaris_10?(node)).to be true
|
332
|
-
end
|
333
|
-
end
|
334
|
-
|
335
|
-
describe '#solaris_11?' do
|
336
|
-
it 'returns true when the version is 5.11' do
|
337
|
-
node = { 'platform' => 'solaris2', 'platform_version' => '5.11' }
|
338
|
-
expect(described_class.solaris_11?(node)).to be true
|
339
|
-
end
|
340
|
-
end
|
341
|
-
end
|
342
|
-
end
|