nodespec 0.1.10 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/Gemfile.lock +29 -21
- data/README.md +10 -8
- data/lib/nodespec/backend_proxy/ssh.rb +1 -1
- data/lib/nodespec/backend_proxy/winrm.rb +1 -1
- data/lib/nodespec/backend_proxy.rb +23 -0
- data/lib/nodespec/communication_adapters/aws_ec2.rb +3 -3
- data/lib/nodespec/communication_adapters/native_communicator.rb +11 -18
- data/lib/nodespec/communication_adapters/ssh.rb +2 -3
- data/lib/nodespec/communication_adapters/ssh_communicator.rb +15 -28
- data/lib/nodespec/communication_adapters/vagrant.rb +2 -2
- data/lib/nodespec/communication_adapters/winrm.rb +2 -2
- data/lib/nodespec/communication_adapters/winrm_communicator.rb +17 -30
- data/lib/nodespec/communication_adapters.rb +3 -3
- data/lib/nodespec/configuration_binding.rb +48 -0
- data/lib/nodespec/node.rb +1 -3
- data/lib/nodespec/provisioning/ansible.rb +1 -1
- data/lib/nodespec/version.rb +1 -1
- data/lib/nodespec.rb +9 -11
- data/nodespec.gemspec +7 -4
- data/spec/backend_proxy/exec_spec.rb +4 -4
- data/spec/backend_proxy/ssh_spec.rb +5 -5
- data/spec/backend_proxy/unixshell_utility_spec.rb +1 -1
- data/spec/backend_proxy/winrm_spec.rb +2 -2
- data/spec/command_execution_spec.rb +2 -2
- data/spec/communication_adapters/aws_ec2_spec.rb +8 -8
- data/spec/communication_adapters/native_communicator_spec.rb +16 -34
- data/spec/communication_adapters/ssh_communicator_spec.rb +34 -90
- data/spec/communication_adapters/ssh_spec.rb +1 -9
- data/spec/communication_adapters/vagrant_spec.rb +2 -2
- data/spec/communication_adapters/winrm_communicator_spec.rb +31 -83
- data/spec/communication_adapters/winrm_spec.rb +1 -9
- data/spec/communication_adapters_spec.rb +4 -4
- data/spec/configuration_binding_spec.rb +167 -0
- data/spec/local_command_runner_spec.rb +3 -3
- data/spec/node_spec.rb +10 -10
- data/spec/provisioning_spec.rb +3 -3
- data/spec/support/backend.rb +5 -5
- data/spec/support/communicator_adapters.rb +23 -0
- data/spec/support/init_with_current_node.rb +1 -1
- metadata +32 -22
- data/lib/nodespec/backends.rb +0 -13
- data/lib/nodespec/communication_adapters/local_backend.rb +0 -15
- data/lib/nodespec/communication_adapters/remote_backend.rb +0 -15
- data/spec/communication_adapters/local_backend_spec.rb +0 -38
- data/spec/communication_adapters/remote_backend_spec.rb +0 -46
- data/spec/support/ssh_communicator.rb +0 -9
- data/spec/support/winrm_communicator.rb +0 -9
@@ -0,0 +1,167 @@
|
|
1
|
+
require 'nodespec/configuration_binding'
|
2
|
+
|
3
|
+
module NodeSpec
|
4
|
+
describe ConfigurationBinding do
|
5
|
+
subject {ConfigurationBinding.new(configuration)}
|
6
|
+
|
7
|
+
let(:configuration) { double('configuration') }
|
8
|
+
let(:existing_session) {double('existing session')}
|
9
|
+
let(:new_session) {double('new session')}
|
10
|
+
|
11
|
+
describe '#bind_ssh_session_for' do
|
12
|
+
shared_examples 'bind ssh session' do
|
13
|
+
it 'binds the session' do
|
14
|
+
allow(new_session).to receive(:host).and_return('test.host.name')
|
15
|
+
allow(new_session).to receive(:options).and_return({port: 1234})
|
16
|
+
expect(configuration).to receive(:ssh=).with(new_session)
|
17
|
+
expect(configuration).to receive(:ssh_options=).with({port: 1234})
|
18
|
+
expect(configuration).to receive(:host=).with('test.host.name')
|
19
|
+
|
20
|
+
session = subject.bind_ssh_session_for('test.host.name', 1234) {new_session}
|
21
|
+
expect(session).to be(new_session)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context 'different or no session' do
|
26
|
+
before do
|
27
|
+
expect(configuration).to receive(:ssh=).with(nil)
|
28
|
+
expect(configuration).to receive(:ssh_options=).with(nil)
|
29
|
+
expect(configuration).to receive(:host=).with(nil)
|
30
|
+
end
|
31
|
+
|
32
|
+
context 'not existing session' do
|
33
|
+
before do
|
34
|
+
allow(configuration).to receive(:ssh).and_return(nil)
|
35
|
+
end
|
36
|
+
|
37
|
+
include_examples 'bind ssh session'
|
38
|
+
end
|
39
|
+
|
40
|
+
context 'different existing session' do
|
41
|
+
before do
|
42
|
+
allow(configuration).to receive(:ssh).and_return(existing_session)
|
43
|
+
expect(existing_session).to receive(:close)
|
44
|
+
end
|
45
|
+
|
46
|
+
context 'different host' do
|
47
|
+
before do
|
48
|
+
allow(existing_session).to receive(:host).and_return('test.anotherhost.name')
|
49
|
+
allow(existing_session).to receive(:options).and_return({port: 1234})
|
50
|
+
end
|
51
|
+
|
52
|
+
include_examples 'bind ssh session'
|
53
|
+
end
|
54
|
+
|
55
|
+
context 'different port' do
|
56
|
+
before do
|
57
|
+
allow(existing_session).to receive(:host).and_return('test.host.name')
|
58
|
+
allow(existing_session).to receive(:options).and_return({port: 5678})
|
59
|
+
end
|
60
|
+
|
61
|
+
include_examples 'bind ssh session'
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
context 'same session' do
|
67
|
+
before do
|
68
|
+
allow(configuration).to receive(:ssh).and_return(existing_session)
|
69
|
+
allow(existing_session).to receive(:host).and_return('test.host.name')
|
70
|
+
allow(existing_session).to receive(:options).and_return({port: 1234})
|
71
|
+
expect(existing_session).not_to receive(:close)
|
72
|
+
expect(configuration).not_to receive(:ssh=)
|
73
|
+
expect(configuration).not_to receive(:ssh_options=)
|
74
|
+
expect(configuration).not_to receive(:host=)
|
75
|
+
end
|
76
|
+
|
77
|
+
it 'does not change the exisintg session' do
|
78
|
+
session = subject.bind_ssh_session_for('test.host.name', 1234) {new_session}
|
79
|
+
expect(session).to be(existing_session)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
describe '#unbind_ssh_session' do
|
85
|
+
before do
|
86
|
+
allow(configuration).to receive(:ssh).and_return(existing_session)
|
87
|
+
expect(existing_session).to receive(:host)
|
88
|
+
expect(existing_session).to receive(:options).and_return({})
|
89
|
+
expect(existing_session).to receive(:close)
|
90
|
+
expect(configuration).to receive(:ssh=).with(nil)
|
91
|
+
expect(configuration).to receive(:ssh_options=).with(nil)
|
92
|
+
expect(configuration).to receive(:host=).with(nil)
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'removes ssh session from the configuration' do
|
96
|
+
subject.unbind_ssh_session
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
describe '#bind_winrm_session_for' do
|
101
|
+
shared_examples 'bind winrm session' do
|
102
|
+
it 'binds the session' do
|
103
|
+
allow(new_session).to receive(:endpoint).and_return('test.endpoint')
|
104
|
+
expect(configuration).to receive(:winrm=).with(new_session)
|
105
|
+
expect(configuration).to receive(:host=).with('test.host.name')
|
106
|
+
|
107
|
+
session = subject.bind_winrm_session_for('test.host.name', 'test.endpoint') {new_session}
|
108
|
+
expect(session).to be(new_session)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
context 'different or no session' do
|
113
|
+
before do
|
114
|
+
expect(configuration).to receive(:winrm=).with(nil)
|
115
|
+
expect(configuration).to receive(:host=).with(nil)
|
116
|
+
end
|
117
|
+
|
118
|
+
context 'not existing session' do
|
119
|
+
before do
|
120
|
+
allow(configuration).to receive(:winrm).and_return(nil)
|
121
|
+
end
|
122
|
+
|
123
|
+
include_examples 'bind winrm session'
|
124
|
+
end
|
125
|
+
|
126
|
+
context 'different existing session' do
|
127
|
+
before do
|
128
|
+
allow(configuration).to receive(:winrm).and_return(existing_session)
|
129
|
+
end
|
130
|
+
|
131
|
+
context 'different host' do
|
132
|
+
before do
|
133
|
+
allow(existing_session).to receive(:endpoint).and_return('test.anotherendpoint')
|
134
|
+
end
|
135
|
+
|
136
|
+
include_examples 'bind winrm session'
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
context 'same session' do
|
142
|
+
before do
|
143
|
+
allow(configuration).to receive(:winrm).and_return(existing_session)
|
144
|
+
allow(existing_session).to receive(:endpoint).and_return('test.endpoint')
|
145
|
+
expect(configuration).not_to receive(:winrm=)
|
146
|
+
expect(configuration).not_to receive(:host=)
|
147
|
+
end
|
148
|
+
|
149
|
+
it 'does not change the exisintg session' do
|
150
|
+
session = subject.bind_winrm_session_for('test.host.name', 'test.endpoint') {new_session}
|
151
|
+
expect(session).to be(existing_session)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
describe '#unbind_winrm_session' do
|
157
|
+
before do
|
158
|
+
expect(configuration).to receive(:winrm=).with(nil)
|
159
|
+
expect(configuration).to receive(:host=).with(nil)
|
160
|
+
end
|
161
|
+
|
162
|
+
it 'removes winrm session from the configuration' do
|
163
|
+
subject.unbind_winrm_session
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
@@ -3,7 +3,7 @@ require 'nodespec/local_command_runner'
|
|
3
3
|
|
4
4
|
module NodeSpec
|
5
5
|
describe LocalCommandRunner do
|
6
|
-
|
6
|
+
subject {Object.new.extend LocalCommandRunner}
|
7
7
|
let(:cmd_status) { double('status') }
|
8
8
|
|
9
9
|
before do
|
@@ -13,13 +13,13 @@ module NodeSpec
|
|
13
13
|
|
14
14
|
it 'returns true if the command succeeds' do
|
15
15
|
allow(cmd_status).to receive(:success?).and_return(true)
|
16
|
-
|
16
|
+
|
17
17
|
expect(subject.run_command('test command')).to be_truthy
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'returns false if the command fails' do
|
21
21
|
allow(cmd_status).to receive(:success?).and_return(false)
|
22
|
-
|
22
|
+
|
23
23
|
expect(subject.run_command('test command')).to be_falsy
|
24
24
|
end
|
25
25
|
end
|
data/spec/node_spec.rb
CHANGED
@@ -11,40 +11,40 @@ module NodeSpec
|
|
11
11
|
shared_examples 'run commands' do
|
12
12
|
it "runs a command through the backend proxy" do
|
13
13
|
expect(backend_proxy).to receive(:execute).with('test command')
|
14
|
-
|
14
|
+
|
15
15
|
subject.execute('test command')
|
16
16
|
end
|
17
17
|
|
18
18
|
it "creates a directory with a path relative to the temporary directory" do
|
19
19
|
expect(backend_proxy).to receive(:temp_directory).ordered.and_return('/temp/dir')
|
20
20
|
expect(backend_proxy).to receive(:create_directory).ordered.with('/temp/dir/test_dir')
|
21
|
-
|
21
|
+
|
22
22
|
expect(subject.create_temp_directory('test_dir')).to eq('/temp/dir/test_dir')
|
23
23
|
end
|
24
24
|
|
25
25
|
it "creates a directory with a path relative to the node working directory" do
|
26
26
|
expect(backend_proxy).to receive(:create_directory).ordered.with('.nodespec')
|
27
27
|
expect(backend_proxy).to receive(:create_directory).ordered.with('.nodespec/test_dir')
|
28
|
-
|
28
|
+
|
29
29
|
expect(subject.create_directory('test_dir')).to eq('.nodespec/test_dir')
|
30
30
|
end
|
31
31
|
|
32
32
|
it "writes to a file with a path relative to the node working directory" do
|
33
33
|
expect(backend_proxy).to receive(:create_directory).ordered.with('.nodespec')
|
34
34
|
expect(backend_proxy).to receive(:create_file).ordered.with('.nodespec/test/file', 'test content')
|
35
|
-
|
35
|
+
|
36
36
|
expect(subject.create_file('test/file', 'test content')).to eq('.nodespec/test/file')
|
37
37
|
end
|
38
38
|
|
39
39
|
it "creates a directory with an absolute path" do
|
40
40
|
expect(backend_proxy).to receive(:create_directory).with('/test/dir')
|
41
|
-
|
41
|
+
|
42
42
|
expect(subject.create_directory('/test/dir')).to eq('/test/dir')
|
43
43
|
end
|
44
44
|
|
45
45
|
it "writes to a file with an absolute path" do
|
46
46
|
expect(backend_proxy).to receive(:create_file).with('/test/file', 'test content')
|
47
|
-
|
47
|
+
|
48
48
|
expect(subject.create_file('/test/file', 'test content')).to eq('/test/file')
|
49
49
|
end
|
50
50
|
end
|
@@ -85,10 +85,10 @@ module NodeSpec
|
|
85
85
|
end
|
86
86
|
|
87
87
|
context 'no os given' do
|
88
|
-
|
88
|
+
subject {Node.new('test_node', 'adapter' => 'test_adapter', 'foo' => 'bar')}
|
89
89
|
|
90
90
|
before do
|
91
|
-
allow(CommunicationAdapters).to receive(:get_communicator).with('test_node',
|
91
|
+
allow(CommunicationAdapters).to receive(:get_communicator).with('test_node', 'test_adapter', 'foo' => 'bar').and_return(communicator)
|
92
92
|
end
|
93
93
|
|
94
94
|
include_examples 'node os', nil
|
@@ -96,10 +96,10 @@ module NodeSpec
|
|
96
96
|
end
|
97
97
|
|
98
98
|
context 'os given' do
|
99
|
-
|
99
|
+
subject {Node.new('test_node', 'os' => 'test_os', 'adapter' => 'test_adapter', 'foo' => 'bar')}
|
100
100
|
|
101
101
|
before do
|
102
|
-
allow(CommunicationAdapters).to receive(:get_communicator).with('test_node', '
|
102
|
+
allow(CommunicationAdapters).to receive(:get_communicator).with('test_node', 'test_adapter', 'foo' => 'bar').and_return(communicator)
|
103
103
|
end
|
104
104
|
|
105
105
|
include_examples 'node os', 'test_os'
|
data/spec/provisioning_spec.rb
CHANGED
@@ -9,13 +9,13 @@ module NodeSpec
|
|
9
9
|
'shellscript' => Provisioning::Shellscript
|
10
10
|
}
|
11
11
|
|
12
|
-
|
12
|
+
subject {Object.new.extend Provisioning}
|
13
13
|
let(:provisioning_block) {Proc.new {}}
|
14
|
-
|
14
|
+
|
15
15
|
before do
|
16
16
|
allow(NodeSpec).to receive(:current_node).and_return('current node')
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
context 'multiple invocations to same provisioner' do
|
20
20
|
let(:provisioner_instance){double('provisioner instance')}
|
21
21
|
available_provisioners.each do |name, clazz|
|
data/spec/support/backend.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
shared_examples 'providing a backend' do |
|
2
|
-
it "returns #{
|
3
|
-
expect(subject.backend).to eq(
|
1
|
+
shared_examples 'providing a backend' do |backend_identifier, backend_class|
|
2
|
+
it "returns a #{backend_identifier} backend" do
|
3
|
+
expect(subject.backend).to eq(backend_identifier)
|
4
4
|
end
|
5
5
|
|
6
|
-
it "returns
|
7
|
-
expect(subject.backend_proxy).to be_a(
|
6
|
+
it "returns #{backend_class.name} as backend proxy" do
|
7
|
+
expect(subject.backend_proxy).to be_a(backend_class)
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
@@ -0,0 +1,23 @@
|
|
1
|
+
shared_context 'new_ssh_communicator' do |hostname, options|
|
2
|
+
before do
|
3
|
+
allow(NodeSpec::CommunicationAdapters::SshCommunicator).to receive(:new).with(hostname, options).and_return('ssh communicator')
|
4
|
+
end
|
5
|
+
end
|
6
|
+
|
7
|
+
shared_context 'new_winrm_communicator' do |hostname, options|
|
8
|
+
before do
|
9
|
+
allow(NodeSpec::CommunicationAdapters::WinrmCommunicator).to receive(:new).with(hostname, options).and_return('winrm communicator')
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
shared_examples 'new_communicator' do |adapter_clazz, connection|
|
14
|
+
include_context "new_#{connection}_communicator", 'test.host.name', 'foo' => 'bar'
|
15
|
+
|
16
|
+
it 'returns communicator with the host name from the node name' do
|
17
|
+
expect(adapter_clazz.communicator_for('test.host.name', 'foo' => 'bar')).to eq("#{connection} communicator")
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'returns communicator with the host name from the options' do
|
21
|
+
expect(adapter_clazz.communicator_for('test_node', 'host' => 'test.host.name', 'foo' => 'bar')).to eq("#{connection} communicator")
|
22
|
+
end
|
23
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nodespec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Silvio Montanari
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-ssh
|
@@ -28,44 +28,58 @@ dependencies:
|
|
28
28
|
name: serverspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '2.3'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '2.3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: specinfra
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.4'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.4'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: os
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
59
|
- - ">="
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
61
|
+
version: '0'
|
48
62
|
type: :runtime
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
66
|
- - ">="
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rspec
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
73
|
- - "~>"
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version: '3.
|
75
|
+
version: '3.1'
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
80
|
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version: '3.
|
82
|
+
version: '3.1'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: aws-sdk
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,24 +150,23 @@ files:
|
|
136
150
|
- README.md
|
137
151
|
- Rakefile
|
138
152
|
- lib/nodespec.rb
|
153
|
+
- lib/nodespec/backend_proxy.rb
|
139
154
|
- lib/nodespec/backend_proxy/base.rb
|
140
155
|
- lib/nodespec/backend_proxy/cmd.rb
|
141
156
|
- lib/nodespec/backend_proxy/exec.rb
|
142
157
|
- lib/nodespec/backend_proxy/ssh.rb
|
143
158
|
- lib/nodespec/backend_proxy/unixshell_utility.rb
|
144
159
|
- lib/nodespec/backend_proxy/winrm.rb
|
145
|
-
- lib/nodespec/backends.rb
|
146
160
|
- lib/nodespec/command_execution.rb
|
147
161
|
- lib/nodespec/communication_adapters.rb
|
148
162
|
- lib/nodespec/communication_adapters/aws_ec2.rb
|
149
|
-
- lib/nodespec/communication_adapters/local_backend.rb
|
150
163
|
- lib/nodespec/communication_adapters/native_communicator.rb
|
151
|
-
- lib/nodespec/communication_adapters/remote_backend.rb
|
152
164
|
- lib/nodespec/communication_adapters/ssh.rb
|
153
165
|
- lib/nodespec/communication_adapters/ssh_communicator.rb
|
154
166
|
- lib/nodespec/communication_adapters/vagrant.rb
|
155
167
|
- lib/nodespec/communication_adapters/winrm.rb
|
156
168
|
- lib/nodespec/communication_adapters/winrm_communicator.rb
|
169
|
+
- lib/nodespec/configuration_binding.rb
|
157
170
|
- lib/nodespec/local_command_runner.rb
|
158
171
|
- lib/nodespec/node.rb
|
159
172
|
- lib/nodespec/node_configurations.rb
|
@@ -175,15 +188,14 @@ files:
|
|
175
188
|
- spec/backend_proxy/winrm_spec.rb
|
176
189
|
- spec/command_execution_spec.rb
|
177
190
|
- spec/communication_adapters/aws_ec2_spec.rb
|
178
|
-
- spec/communication_adapters/local_backend_spec.rb
|
179
191
|
- spec/communication_adapters/native_communicator_spec.rb
|
180
|
-
- spec/communication_adapters/remote_backend_spec.rb
|
181
192
|
- spec/communication_adapters/ssh_communicator_spec.rb
|
182
193
|
- spec/communication_adapters/ssh_spec.rb
|
183
194
|
- spec/communication_adapters/vagrant_spec.rb
|
184
195
|
- spec/communication_adapters/winrm_communicator_spec.rb
|
185
196
|
- spec/communication_adapters/winrm_spec.rb
|
186
197
|
- spec/communication_adapters_spec.rb
|
198
|
+
- spec/configuration_binding_spec.rb
|
187
199
|
- spec/local_command_runner_spec.rb
|
188
200
|
- spec/node_configurations_spec.rb
|
189
201
|
- spec/node_spec.rb
|
@@ -195,13 +207,13 @@ files:
|
|
195
207
|
- spec/runtime_gem_loader_spec.rb
|
196
208
|
- spec/spec_helper.rb
|
197
209
|
- spec/support/backend.rb
|
210
|
+
- spec/support/communicator_adapters.rb
|
198
211
|
- spec/support/init_with_current_node.rb
|
199
212
|
- spec/support/local_command.rb
|
200
213
|
- spec/support/node_command.rb
|
201
|
-
- spec/support/ssh_communicator.rb
|
202
|
-
- spec/support/winrm_communicator.rb
|
203
214
|
homepage: https://github.com/smontanari/nodespec
|
204
|
-
licenses:
|
215
|
+
licenses:
|
216
|
+
- MIT
|
205
217
|
metadata: {}
|
206
218
|
post_install_message:
|
207
219
|
rdoc_options: []
|
@@ -232,15 +244,14 @@ test_files:
|
|
232
244
|
- spec/backend_proxy/winrm_spec.rb
|
233
245
|
- spec/command_execution_spec.rb
|
234
246
|
- spec/communication_adapters/aws_ec2_spec.rb
|
235
|
-
- spec/communication_adapters/local_backend_spec.rb
|
236
247
|
- spec/communication_adapters/native_communicator_spec.rb
|
237
|
-
- spec/communication_adapters/remote_backend_spec.rb
|
238
248
|
- spec/communication_adapters/ssh_communicator_spec.rb
|
239
249
|
- spec/communication_adapters/ssh_spec.rb
|
240
250
|
- spec/communication_adapters/vagrant_spec.rb
|
241
251
|
- spec/communication_adapters/winrm_communicator_spec.rb
|
242
252
|
- spec/communication_adapters/winrm_spec.rb
|
243
253
|
- spec/communication_adapters_spec.rb
|
254
|
+
- spec/configuration_binding_spec.rb
|
244
255
|
- spec/local_command_runner_spec.rb
|
245
256
|
- spec/node_configurations_spec.rb
|
246
257
|
- spec/node_spec.rb
|
@@ -252,8 +263,7 @@ test_files:
|
|
252
263
|
- spec/runtime_gem_loader_spec.rb
|
253
264
|
- spec/spec_helper.rb
|
254
265
|
- spec/support/backend.rb
|
266
|
+
- spec/support/communicator_adapters.rb
|
255
267
|
- spec/support/init_with_current_node.rb
|
256
268
|
- spec/support/local_command.rb
|
257
269
|
- spec/support/node_command.rb
|
258
|
-
- spec/support/ssh_communicator.rb
|
259
|
-
- spec/support/winrm_communicator.rb
|
data/lib/nodespec/backends.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'specinfra/helper'
|
2
|
-
%w[exec cmd ssh winrm].each {|f| require_relative "backend_proxy/#{f}"}
|
3
|
-
|
4
|
-
module NodeSpec
|
5
|
-
module Backends
|
6
|
-
class SpecInfraCompatibilityError < StandardError; end
|
7
|
-
|
8
|
-
%w[Exec Ssh Cmd WinRM].each do |name|
|
9
|
-
raise SpecInfraCompatibilityError.new("module SpecInfra::Helper::#{name} is not defined!") unless SpecInfra::Helper.const_defined?(name)
|
10
|
-
const_set(name, name)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'nodespec/backends'
|
2
|
-
|
3
|
-
module NodeSpec
|
4
|
-
module CommunicationAdapters
|
5
|
-
module LocalBackend
|
6
|
-
def backend_proxy
|
7
|
-
BackendProxy.const_get(backend).new
|
8
|
-
end
|
9
|
-
|
10
|
-
def backend
|
11
|
-
os == 'Windows' ? Backends::Cmd : Backends::Exec
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'nodespec/backends'
|
2
|
-
|
3
|
-
module NodeSpec
|
4
|
-
module CommunicationAdapters
|
5
|
-
module RemoteBackend
|
6
|
-
def backend_proxy
|
7
|
-
BackendProxy.const_get(backend).new(session)
|
8
|
-
end
|
9
|
-
|
10
|
-
def backend
|
11
|
-
os == 'Windows' ? Backends::WinRM : Backends::Ssh
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'nodespec/communication_adapters/local_backend'
|
3
|
-
|
4
|
-
module NodeSpec
|
5
|
-
module CommunicationAdapters
|
6
|
-
describe LocalBackend do
|
7
|
-
let(:subject) {Object.new.extend LocalBackend}
|
8
|
-
|
9
|
-
context 'no os' do
|
10
|
-
before do
|
11
|
-
def subject.os
|
12
|
-
end
|
13
|
-
end
|
14
|
-
it_behaves_like 'providing a backend', 'Exec'
|
15
|
-
end
|
16
|
-
|
17
|
-
context 'UN*X os' do
|
18
|
-
before do
|
19
|
-
def subject.os
|
20
|
-
'CentOS'
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
it_behaves_like 'providing a backend', 'Exec'
|
25
|
-
end
|
26
|
-
|
27
|
-
context 'Windows os' do
|
28
|
-
before do
|
29
|
-
def subject.os
|
30
|
-
'Windows'
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
it_behaves_like 'providing a backend', 'Cmd'
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'nodespec/communication_adapters/remote_backend'
|
3
|
-
|
4
|
-
module NodeSpec
|
5
|
-
module CommunicationAdapters
|
6
|
-
describe RemoteBackend do
|
7
|
-
let(:subject) {
|
8
|
-
Object.new.tap do |obj|
|
9
|
-
obj.extend RemoteBackend
|
10
|
-
def obj.session
|
11
|
-
'session'
|
12
|
-
end
|
13
|
-
end
|
14
|
-
}
|
15
|
-
|
16
|
-
context 'no os' do
|
17
|
-
before do
|
18
|
-
def subject.os
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
it_behaves_like 'providing a backend', 'Ssh'
|
23
|
-
end
|
24
|
-
|
25
|
-
context 'UN*X os' do
|
26
|
-
before do
|
27
|
-
def subject.os
|
28
|
-
'CentOS'
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
it_behaves_like 'providing a backend', 'Ssh'
|
33
|
-
end
|
34
|
-
|
35
|
-
context 'Windows os' do
|
36
|
-
before do
|
37
|
-
def subject.os
|
38
|
-
'Windows'
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
it_behaves_like 'providing a backend', 'WinRM'
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
@@ -1,9 +0,0 @@
|
|
1
|
-
require 'nodespec/communication_adapters/ssh_communicator'
|
2
|
-
|
3
|
-
shared_examples 'new_ssh_communicator' do |hostname, os, options|
|
4
|
-
before do
|
5
|
-
allow(NodeSpec::CommunicationAdapters::SshCommunicator).to receive(:new).with(
|
6
|
-
hostname, os, options
|
7
|
-
).and_return('ssh communicator')
|
8
|
-
end
|
9
|
-
end
|
@@ -1,9 +0,0 @@
|
|
1
|
-
require 'nodespec/communication_adapters/winrm_communicator'
|
2
|
-
|
3
|
-
shared_context 'new_winrm_communicator' do |hostname, os, options|
|
4
|
-
before do
|
5
|
-
allow(NodeSpec::CommunicationAdapters::WinrmCommunicator).to receive(:new).with(
|
6
|
-
hostname, os, options
|
7
|
-
).and_return('winrm communicator')
|
8
|
-
end
|
9
|
-
end
|