test-kitchen 1.9.1 → 1.9.2
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/CHANGELOG.md +11 -0
- data/lib/kitchen/driver/ssh_base.rb +12 -2
- data/lib/kitchen/transport/ssh.rb +12 -2
- data/lib/kitchen/version.rb +1 -1
- data/spec/kitchen/transport/ssh_spec.rb +11 -41
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 81027eb8109e1f18afe8ab86a7868a6904a85143
|
|
4
|
+
data.tar.gz: 0d3f2807d8ed919ab730c5ca015751b465cdf97c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d3814e745b4d08b7cb20b28fa1dad5d1503ee7a49c17cea73c6f96300bb559c37eceba74b415fd7855a13b4514b198587f45bfab9ae9bc5a4e362b4202db91f2
|
|
7
|
+
data.tar.gz: d904f5626be65776e138aaa4ed7d38365a6d30339e608dd003f2582a9ae2e35c0178103e3bb43b33ed2b971d4ac7ad70d57f54d00ac7141044e21efa9f102c00
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## [v1.9.2](https://github.com/test-kitchen/test-kitchen/tree/v1.9.2) (2016-06-09)
|
|
4
|
+
[Full Changelog](https://github.com/test-kitchen/test-kitchen/compare/v1.9.1...v1.9.2)
|
|
5
|
+
|
|
6
|
+
**Implemented enhancements:**
|
|
7
|
+
|
|
8
|
+
- add max scp session handling [\#1047](https://github.com/test-kitchen/test-kitchen/pull/1047) ([lamont-granquist](https://github.com/lamont-granquist))
|
|
9
|
+
|
|
10
|
+
**Fixed bugs:**
|
|
11
|
+
|
|
12
|
+
- Message: SCP upload failed \(open failed \(1\)\) [\#1035](https://github.com/test-kitchen/test-kitchen/issues/1035)
|
|
13
|
+
|
|
3
14
|
## [v1.9.1](https://github.com/test-kitchen/test-kitchen/tree/v1.9.1) (2016-06-02)
|
|
4
15
|
[Full Changelog](https://github.com/test-kitchen/test-kitchen/compare/v1.9.0...v1.9.1)
|
|
5
16
|
|
|
@@ -53,6 +53,8 @@ module Kitchen
|
|
|
53
53
|
|
|
54
54
|
default_config :sudo, true
|
|
55
55
|
default_config :port, 22
|
|
56
|
+
# needs to be one less than the configured sshd_config MaxSessions
|
|
57
|
+
default_config :max_ssh_sessions, 9
|
|
56
58
|
|
|
57
59
|
# Creates a new Driver object using the provided configuration data
|
|
58
60
|
# which will be merged with any default configuration.
|
|
@@ -294,8 +296,7 @@ module Kitchen
|
|
|
294
296
|
info("Transferring files to #{instance.to_str}")
|
|
295
297
|
debug("TIMING: scp asynch upload (Kitchen::Driver::SSHBase)")
|
|
296
298
|
elapsed = Benchmark.measure do
|
|
297
|
-
|
|
298
|
-
waits.each(&:wait)
|
|
299
|
+
transfer_path_async(locals, remote, connection)
|
|
299
300
|
end
|
|
300
301
|
delta = Util.duration(elapsed.real)
|
|
301
302
|
debug("TIMING: scp async upload (Kitchen::Driver::SSHBase) took #{delta}")
|
|
@@ -304,6 +305,15 @@ module Kitchen
|
|
|
304
305
|
raise ActionFailed, ex.message
|
|
305
306
|
end
|
|
306
307
|
|
|
308
|
+
def transfer_path_async(locals, remote, connection)
|
|
309
|
+
waits = []
|
|
310
|
+
locals.map do |local|
|
|
311
|
+
waits.push connection.upload_path(local, remote)
|
|
312
|
+
waits.shift.wait while waits.length >= config[:max_ssh_sessions]
|
|
313
|
+
end
|
|
314
|
+
waits.each(&:wait)
|
|
315
|
+
end
|
|
316
|
+
|
|
307
317
|
# Blocks until a TCP socket is available where a remote SSH server
|
|
308
318
|
# should be listening.
|
|
309
319
|
#
|
|
@@ -46,6 +46,8 @@ module Kitchen
|
|
|
46
46
|
default_config :username, "root"
|
|
47
47
|
default_config :keepalive, true
|
|
48
48
|
default_config :keepalive_interval, 60
|
|
49
|
+
# needs to be one less than the configured sshd_config MaxSessions
|
|
50
|
+
default_config :max_ssh_sessions, 9
|
|
49
51
|
default_config :connection_timeout, 15
|
|
50
52
|
default_config :connection_retries, 5
|
|
51
53
|
default_config :connection_retry_sleep, 1
|
|
@@ -149,12 +151,14 @@ module Kitchen
|
|
|
149
151
|
def upload(locals, remote)
|
|
150
152
|
logger.debug("TIMING: scp async upload (Kitchen::Transport::Ssh)")
|
|
151
153
|
elapsed = Benchmark.measure do
|
|
152
|
-
waits =
|
|
154
|
+
waits = []
|
|
155
|
+
Array(locals).map do |local|
|
|
153
156
|
opts = File.directory?(local) ? { :recursive => true } : {}
|
|
154
157
|
|
|
155
|
-
session.scp.upload(local, remote, opts) do |_ch, name, sent, total|
|
|
158
|
+
waits.push session.scp.upload(local, remote, opts) do |_ch, name, sent, total|
|
|
156
159
|
logger.debug("Async Uploaded #{name} (#{total} bytes)") if sent == total
|
|
157
160
|
end
|
|
161
|
+
waits.shift.wait while waits.length >= max_ssh_sessions
|
|
158
162
|
end
|
|
159
163
|
waits.each(&:wait)
|
|
160
164
|
end
|
|
@@ -187,6 +191,10 @@ module Kitchen
|
|
|
187
191
|
Timeout::Error
|
|
188
192
|
].freeze
|
|
189
193
|
|
|
194
|
+
# @return [Integer] cap on number of parallel ssh sessions we can use
|
|
195
|
+
# @api private
|
|
196
|
+
attr_reader :max_ssh_sessions
|
|
197
|
+
|
|
190
198
|
# @return [Integer] how many times to retry when failing to execute
|
|
191
199
|
# a command or transfer files
|
|
192
200
|
# @api private
|
|
@@ -286,6 +294,7 @@ module Kitchen
|
|
|
286
294
|
@port = @options[:port] # don't delete from options
|
|
287
295
|
@connection_retries = @options.delete(:connection_retries)
|
|
288
296
|
@connection_retry_sleep = @options.delete(:connection_retry_sleep)
|
|
297
|
+
@max_ssh_sessions = @options.delete(:max_ssh_sessions)
|
|
289
298
|
@max_wait_until_ready = @options.delete(:max_wait_until_ready)
|
|
290
299
|
end
|
|
291
300
|
|
|
@@ -335,6 +344,7 @@ module Kitchen
|
|
|
335
344
|
:timeout => data[:connection_timeout],
|
|
336
345
|
:connection_retries => data[:connection_retries],
|
|
337
346
|
:connection_retry_sleep => data[:connection_retry_sleep],
|
|
347
|
+
:max_ssh_sessions => data[:max_ssh_sessions],
|
|
338
348
|
:max_wait_until_ready => data[:max_wait_until_ready]
|
|
339
349
|
}
|
|
340
350
|
|
data/lib/kitchen/version.rb
CHANGED
|
@@ -207,6 +207,10 @@ describe Kitchen::Transport::Ssh do
|
|
|
207
207
|
|
|
208
208
|
transport[:ssh_key].must_equal os_safe_root_path("/rooty/my_key")
|
|
209
209
|
end
|
|
210
|
+
|
|
211
|
+
it "sets :max_ssh_sessions to 9 by default" do
|
|
212
|
+
transport[:max_ssh_sessions].must_equal 9
|
|
213
|
+
end
|
|
210
214
|
end
|
|
211
215
|
|
|
212
216
|
describe "#connection" do
|
|
@@ -648,7 +652,13 @@ describe Kitchen::Transport::Ssh::Connection do
|
|
|
648
652
|
let(:conn) { net_ssh_connection }
|
|
649
653
|
|
|
650
654
|
let(:options) do
|
|
651
|
-
{
|
|
655
|
+
{
|
|
656
|
+
:logger => logger,
|
|
657
|
+
:username => "me",
|
|
658
|
+
:hostname => "foo",
|
|
659
|
+
:port => 22,
|
|
660
|
+
:max_ssh_sessions => 9
|
|
661
|
+
}
|
|
652
662
|
end
|
|
653
663
|
|
|
654
664
|
let(:connection) do
|
|
@@ -1039,21 +1049,6 @@ describe Kitchen::Transport::Ssh::Connection do
|
|
|
1039
1049
|
connection.upload(src.path, "/tmp/remote")
|
|
1040
1050
|
end
|
|
1041
1051
|
end
|
|
1042
|
-
|
|
1043
|
-
it "logs upload progress to debug" do
|
|
1044
|
-
assert_scripted do
|
|
1045
|
-
connection.upload(src.path, "/tmp/remote")
|
|
1046
|
-
end
|
|
1047
|
-
|
|
1048
|
-
logged_output.string.must_match debug_line(
|
|
1049
|
-
"[SSH] opening connection to me@foo<{:port=>22}>"
|
|
1050
|
-
)
|
|
1051
|
-
logged_output.string.lines.count { |l|
|
|
1052
|
-
l =~ debug_line(
|
|
1053
|
-
"Async Uploaded #{src.path} (1234 bytes)"
|
|
1054
|
-
)
|
|
1055
|
-
}.must_equal 1
|
|
1056
|
-
end
|
|
1057
1052
|
end
|
|
1058
1053
|
|
|
1059
1054
|
describe "for a path" do
|
|
@@ -1112,31 +1107,6 @@ describe Kitchen::Transport::Ssh::Connection do
|
|
|
1112
1107
|
assert_scripted { connection.upload(@dir, "/tmp/remote") }
|
|
1113
1108
|
end
|
|
1114
1109
|
end
|
|
1115
|
-
|
|
1116
|
-
it "logs upload progress to debug" do
|
|
1117
|
-
with_sorted_dir_entries do
|
|
1118
|
-
assert_scripted { connection.upload(@dir, "/tmp/remote") }
|
|
1119
|
-
end
|
|
1120
|
-
|
|
1121
|
-
logged_output.string.must_match debug_line(
|
|
1122
|
-
"[SSH] opening connection to me@foo<{:port=>22}>"
|
|
1123
|
-
)
|
|
1124
|
-
logged_output.string.lines.count { |l|
|
|
1125
|
-
l =~ debug_line(
|
|
1126
|
-
"Async Uploaded #{@dir}/alpha (15 bytes)"
|
|
1127
|
-
)
|
|
1128
|
-
}.must_equal 1
|
|
1129
|
-
logged_output.string.lines.count { |l|
|
|
1130
|
-
l =~ debug_line(
|
|
1131
|
-
"Async Uploaded #{@dir}/subdir/beta (14 bytes)"
|
|
1132
|
-
)
|
|
1133
|
-
}.must_equal 1
|
|
1134
|
-
logged_output.string.lines.count { |l|
|
|
1135
|
-
l =~ debug_line(
|
|
1136
|
-
"Async Uploaded #{@dir}/zulu (14 bytes)"
|
|
1137
|
-
)
|
|
1138
|
-
}.must_equal 1
|
|
1139
|
-
end
|
|
1140
1110
|
end
|
|
1141
1111
|
|
|
1142
1112
|
describe "for a failed upload" do
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: test-kitchen
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.9.
|
|
4
|
+
version: 1.9.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Fletcher Nichol
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-06-
|
|
11
|
+
date: 2016-06-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: mixlib-shellout
|