kitchen-nodes-scalp42 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,69 @@
1
+ require 'serverspec'
2
+ require 'json'
3
+
4
+ if RUBY_PLATFORM =~ /mingw/
5
+ set :backend, :cmd
6
+ set :os, family: 'windows'
7
+ else
8
+ set :backend, :exec
9
+ end
10
+
11
+ describe 'other node' do
12
+ let(:node) do
13
+ JSON.parse(
14
+ IO.read(File.join(ENV['TEMP'] || '/tmp', 'kitchen/other_node.json'))
15
+ )
16
+ end
17
+ let(:ip) { node['automatic']['ipaddress'] }
18
+ let(:fqdn) { node['automatic']['fqdn'] }
19
+ let(:connection) do
20
+ if RUBY_PLATFORM =~ /mingw/
21
+ require 'winrm'
22
+ ::WinRM::Connection.new(
23
+ endpoint: "http://#{ip}:5985/wsman",
24
+ user: 'vagrant',
25
+ password: 'vagrant'
26
+ ).shell(:cmd)
27
+ else
28
+ Net::SSH.start(
29
+ ip,
30
+ 'vagrant',
31
+ password: 'vagrant',
32
+ paranoid: false
33
+ )
34
+ end
35
+ end
36
+
37
+ it 'has an non localhost ip' do
38
+ expect(ip).not_to eq('127.0.0.1')
39
+ end
40
+
41
+ it 'has a valid ip' do
42
+ expect(ip).to match(/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/)
43
+ end
44
+
45
+ # Skip this test on the 2008 box bc its not sysprepped....
46
+ unless ENV['computername'] =~ /VAGRANT\-2008R2/i
47
+ describe command('hostname') do
48
+ its(:stdout) { should_not match(/#{Regexp.quote(fqdn)}/) }
49
+ end
50
+ end
51
+
52
+ if RUBY_PLATFORM =~ /mingw/
53
+ it 'has a computername matching node fqdn' do
54
+ expect(connection.run('hostname').stdout.chomp).to eq(fqdn)
55
+ end
56
+ else
57
+ it 'has a computername matching node fqdn' do
58
+ connection.open_channel do |channel|
59
+ channel.request_pty
60
+ channel.exec('hostname') do |_ch, _success|
61
+ channel.on_data do |_ch, data|
62
+ expect(data.chomp).to eq(fqdn)
63
+ end
64
+ end
65
+ end
66
+ connection.loop
67
+ end
68
+ end
69
+ end
metadata ADDED
@@ -0,0 +1,220 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: kitchen-nodes-scalp42
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.9.1
5
+ platform: ruby
6
+ authors:
7
+ - Matt Wrock
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-04-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: net-ping
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: win32-security
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: test-kitchen
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.13'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.13'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.3'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.3'
69
+ - !ruby/object:Gem::Dependency
70
+ name: fakefs
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.4'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.4'
83
+ - !ruby/object:Gem::Dependency
84
+ name: github_changelog_generator
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '='
88
+ - !ruby/object:Gem::Version
89
+ version: 1.11.3
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '='
95
+ - !ruby/object:Gem::Version
96
+ version: 1.11.3
97
+ - !ruby/object:Gem::Dependency
98
+ name: rake
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rspec
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '3.2'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '3.2'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rubocop
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '0.37'
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: 0.37.1
135
+ type: :development
136
+ prerelease: false
137
+ version_requirements: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - "~>"
140
+ - !ruby/object:Gem::Version
141
+ version: '0.37'
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: 0.37.1
145
+ description: A Test Kitchen Provisioner for Chef Nodes
146
+ email:
147
+ - matt@mattwrock.com
148
+ executables: []
149
+ extensions: []
150
+ extra_rdoc_files: []
151
+ files:
152
+ - ".gitattributes"
153
+ - ".gitignore"
154
+ - ".kitchen.travis.yml"
155
+ - ".kitchen.yml"
156
+ - ".rspec"
157
+ - ".rubocop.yml"
158
+ - ".travis.yml"
159
+ - Berksfile
160
+ - CHANGELOG.md
161
+ - Gemfile
162
+ - LICENSE
163
+ - README.md
164
+ - Rakefile
165
+ - kitchen-nodes.gemspec
166
+ - lib/kitchen/provisioner/finder.rb
167
+ - lib/kitchen/provisioner/finder/ssh.rb
168
+ - lib/kitchen/provisioner/finder/winrm.rb
169
+ - lib/kitchen/provisioner/nodes.rb
170
+ - lib/kitchen/provisioner/nodes_version.rb
171
+ - lib/kitchen/provisioner/run_list_expansion_from_kitchen.rb
172
+ - spec/unit/nodes_spec.rb
173
+ - spec/unit/stubs/ifconfig.txt
174
+ - spec/unit/stubs/ip.txt
175
+ - test/fixtures/roles/test_json_role.json
176
+ - test/fixtures/roles/test_ruby_role.rb
177
+ - test/integration/cookbooks/node-tests/libraries/helper.rb
178
+ - test/integration/cookbooks/node-tests/metadata.rb
179
+ - test/integration/cookbooks/node-tests/recipes/node1.rb
180
+ - test/integration/cookbooks/node-tests/recipes/node2.rb
181
+ - test/integration/node1/serverspec/default_spec.rb
182
+ - test/integration/node2/serverspec/Gemfile
183
+ - test/integration/node2/serverspec/default_spec.rb
184
+ homepage: ''
185
+ licenses:
186
+ - Apache 2.0
187
+ metadata: {}
188
+ post_install_message:
189
+ rdoc_options: []
190
+ require_paths:
191
+ - lib
192
+ required_ruby_version: !ruby/object:Gem::Requirement
193
+ requirements:
194
+ - - ">="
195
+ - !ruby/object:Gem::Version
196
+ version: '0'
197
+ required_rubygems_version: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
202
+ requirements: []
203
+ rubyforge_project:
204
+ rubygems_version: 2.6.14
205
+ signing_key:
206
+ specification_version: 4
207
+ summary: A Test Kitchen Provisioner for Chef Nodes
208
+ test_files:
209
+ - spec/unit/nodes_spec.rb
210
+ - spec/unit/stubs/ifconfig.txt
211
+ - spec/unit/stubs/ip.txt
212
+ - test/fixtures/roles/test_json_role.json
213
+ - test/fixtures/roles/test_ruby_role.rb
214
+ - test/integration/cookbooks/node-tests/libraries/helper.rb
215
+ - test/integration/cookbooks/node-tests/metadata.rb
216
+ - test/integration/cookbooks/node-tests/recipes/node1.rb
217
+ - test/integration/cookbooks/node-tests/recipes/node2.rb
218
+ - test/integration/node1/serverspec/default_spec.rb
219
+ - test/integration/node2/serverspec/Gemfile
220
+ - test/integration/node2/serverspec/default_spec.rb