fog-core 2.4.0 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/FUNDING.yml +2 -0
- data/.github/dependabot.yml +2 -4
- data/.github/workflows/ci.yml +32 -0
- data/.rubocop.yml +1 -1
- data/README.md +2 -1
- data/SECURITY.md +6 -0
- data/changelog.md +17 -0
- data/fog-core.gemspec +3 -2
- data/lib/fog/compute.rb +1 -1
- data/lib/fog/core/mock.rb +1 -1
- data/lib/fog/core/provider.rb +1 -1
- data/lib/fog/core/service.rb +1 -1
- data/lib/fog/core/version.rb +3 -1
- data/lib/fog/core.rb +0 -1
- data/lib/fog/formatador.rb +3 -3
- data/lib/fog/storage.rb +0 -1
- data/lib/tasks/test_task.rb +2 -3
- metadata +9 -34
- data/.github/workflows/ruby.yml +0 -18
- data/.github/workflows/stale.yml +0 -9
- data/spec/compute/models/server_spec.rb +0 -229
- data/spec/compute_spec.rb +0 -95
- data/spec/connection_spec.rb +0 -107
- data/spec/core/cache_spec.rb +0 -227
- data/spec/core/collection_spec.rb +0 -24
- data/spec/core/model_spec.rb +0 -69
- data/spec/core/stringify_keys_spec.rb +0 -38
- data/spec/core/whitelist_keys_spec.rb +0 -36
- data/spec/credentials_spec.rb +0 -88
- data/spec/current_machine_spec.rb +0 -36
- data/spec/fake_app/fake_service.rb +0 -18
- data/spec/fake_app/models/collection.rb +0 -5
- data/spec/fake_app/models/model.rb +0 -2
- data/spec/fake_app/requests/request.rb +0 -11
- data/spec/fog_attribute_spec.rb +0 -569
- data/spec/formatador_spec.rb +0 -154
- data/spec/identity_spec.rb +0 -95
- data/spec/mocking_spec.rb +0 -84
- data/spec/service_spec.rb +0 -201
- data/spec/spec_helper.rb +0 -14
- data/spec/storage_spec.rb +0 -112
- data/spec/test_helpers/formats_helper_spec.rb +0 -121
- data/spec/test_helpers/schema_validator_spec.rb +0 -101
- data/spec/timeout_spec.rb +0 -20
- data/spec/utils_spec.rb +0 -29
- data/spec/uuid_spec.rb +0 -11
- data/spec/wait_for_spec.rb +0 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 91763c9ed8c19b7e8a3b77d948c971e0e7e054b4a7f30ef8687bec26eca410b9
|
4
|
+
data.tar.gz: 1673665983bd08fe0925b092e7b61fea73f7cac53e3b3225979aae52d87a7f4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57eb30b11748e6e9d35e774df434054eafb6412d37412328f0cef89056827f6718e98cddeb19832b219fc4e5357e17fb1f548caf53c5ec7810acb5d567f8d575
|
7
|
+
data.tar.gz: 8938f69f8139b2e05585b1835a179e9e8fe4582f9ab721e3aa75cddc8d6f537230045d3b96d18184bb685eb312fc6bc3ff8dd6b8b506570a0e072d795ae8bd4e
|
data/.github/FUNDING.yml
ADDED
data/.github/dependabot.yml
CHANGED
@@ -3,10 +3,8 @@ updates:
|
|
3
3
|
- package-ecosystem: "bundler"
|
4
4
|
directory: "/"
|
5
5
|
schedule:
|
6
|
-
interval: "
|
7
|
-
allow:
|
8
|
-
- dependency-type: "all" # update both gemspec and lock
|
6
|
+
interval: "weekly"
|
9
7
|
- package-ecosystem: "github-actions"
|
10
8
|
directory: "/"
|
11
9
|
schedule:
|
12
|
-
interval: "
|
10
|
+
interval: "weekly"
|
@@ -0,0 +1,32 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ master ]
|
8
|
+
schedule:
|
9
|
+
- cron: '0 0 * * 1' # At 00:00 on Monday.
|
10
|
+
|
11
|
+
permissions:
|
12
|
+
contents: read
|
13
|
+
|
14
|
+
jobs:
|
15
|
+
test:
|
16
|
+
|
17
|
+
runs-on: ubuntu-latest
|
18
|
+
|
19
|
+
strategy:
|
20
|
+
matrix:
|
21
|
+
ruby-version: ['3.0', '3.1', '3.2', '3.3', 'head']
|
22
|
+
continue-on-error: ${{ matrix.ruby-version == 'head' }}
|
23
|
+
|
24
|
+
steps:
|
25
|
+
- uses: actions/checkout@v4
|
26
|
+
- name: Set up Ruby
|
27
|
+
uses: ruby/setup-ruby@v1
|
28
|
+
with:
|
29
|
+
ruby-version: ${{ matrix.ruby-version }}
|
30
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
31
|
+
- name: Run tests
|
32
|
+
run: bundle exec rake RUBYOPT="--enable-frozen-string-literal"
|
data/.rubocop.yml
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,8 @@
|
|
2
2
|
|
3
3
|
Shared classes and tests for fog providers and services.
|
4
4
|
|
5
|
-
[![Build Status](https://github.com/fog/fog-core/actions/workflows/
|
5
|
+
[![Build Status](https://github.com/fog/fog-core/actions/workflows/ci.yml/badge.svg)](https://github.com/fog/fog-core/actions/workflows/ci.yml)
|
6
|
+
[![Gem Version](https://badge.fury.io/rb/fog-core.svg)](https://rubygems.org/gems/fog-core)
|
6
7
|
|
7
8
|
## Ruby version
|
8
9
|
|
data/SECURITY.md
ADDED
data/changelog.md
CHANGED
@@ -1,3 +1,20 @@
|
|
1
|
+
2.6.0 10/24/2024
|
2
|
+
==========================================================
|
3
|
+
|
4
|
+
- bump to excon ~> 1.0
|
5
|
+
|
6
|
+
2.5.0 08/02/2024
|
7
|
+
==========================================================
|
8
|
+
|
9
|
+
- drop spec files from gem package
|
10
|
+
- fix 3.4+ ruby issues (string literals and base64)
|
11
|
+
- bump rubocop target
|
12
|
+
- remove stale actions
|
13
|
+
- fixes to ci
|
14
|
+
- add security policy
|
15
|
+
- add gem version badge
|
16
|
+
- add funding info
|
17
|
+
|
1
18
|
2.4.0 01/03/2024
|
2
19
|
==========================================================
|
3
20
|
|
data/fog-core.gemspec
CHANGED
@@ -14,14 +14,14 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.homepage = "https://github.com/fog/fog-core"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
17
|
-
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
17
|
+
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR).reject {|f| f.start_with? ('spec/') }
|
18
18
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.required_ruby_version = ">= 2.0"
|
22
22
|
|
23
23
|
spec.add_dependency("builder")
|
24
|
-
spec.add_dependency("excon", "~> 0
|
24
|
+
spec.add_dependency("excon", "~> 1.0")
|
25
25
|
spec.add_dependency("formatador", ">= 0.2", "< 2.0")
|
26
26
|
spec.add_dependency("mime-types")
|
27
27
|
|
@@ -39,5 +39,6 @@ Gem::Specification.new do |spec|
|
|
39
39
|
spec.add_development_dependency("tins")
|
40
40
|
spec.add_development_dependency("yard")
|
41
41
|
|
42
|
+
spec.metadata["changelog_uri"] = spec.homepage + "/blob/master/changelog.md"
|
42
43
|
spec.metadata["rubygems_mfa_required"] = "true"
|
43
44
|
end
|
data/lib/fog/compute.rb
CHANGED
data/lib/fog/core/mock.rb
CHANGED
data/lib/fog/core/provider.rb
CHANGED
data/lib/fog/core/service.rb
CHANGED
data/lib/fog/core/version.rb
CHANGED
data/lib/fog/core.rb
CHANGED
data/lib/fog/formatador.rb
CHANGED
@@ -10,7 +10,7 @@ module Fog
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def self.format(object, opts = { include_nested: true })
|
13
|
-
string = init_string(object)
|
13
|
+
string = +init_string(object)
|
14
14
|
indent { string << object_string(object, opts) }
|
15
15
|
string << "#{indentation}>"
|
16
16
|
end
|
@@ -48,7 +48,7 @@ module Fog
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def self.object_string(object, opts)
|
51
|
-
string = attribute_string(object).to_s
|
51
|
+
string = +attribute_string(object).to_s
|
52
52
|
string << nested_objects_string(object).to_s if opts[:include_nested]
|
53
53
|
string
|
54
54
|
end
|
@@ -68,7 +68,7 @@ module Fog
|
|
68
68
|
return nested if object.respond_to?(:empty) and object.empty?
|
69
69
|
return nested unless object.is_a?(Enumerable)
|
70
70
|
|
71
|
-
nested = "#{indentation}[\n"
|
71
|
+
nested = +"#{indentation}[\n"
|
72
72
|
indent { nested << indentation + inspect_object(object) }
|
73
73
|
nested << "#{indentation}\n#{indentation}]\n"
|
74
74
|
end
|
data/lib/fog/storage.rb
CHANGED
data/lib/tasks/test_task.rb
CHANGED
@@ -22,10 +22,9 @@ module Fog
|
|
22
22
|
def tests(mocked)
|
23
23
|
Fog::Formatador.display_line
|
24
24
|
start = Time.now.to_i
|
25
|
-
threads = []
|
26
25
|
Thread.main[:results] = []
|
27
|
-
Fog.providers.
|
28
|
-
|
26
|
+
threads = Fog.providers.map do |key, value|
|
27
|
+
Thread.new do
|
29
28
|
Thread.main[:results] << {
|
30
29
|
provider: value,
|
31
30
|
success: sh("export FOG_MOCK=#{mocked} && bundle exec shindont +#{key}")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fog-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evan Light
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-
|
12
|
+
date: 2024-10-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: builder
|
@@ -31,14 +31,14 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '0
|
34
|
+
version: '1.0'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: '0
|
41
|
+
version: '1.0'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: formatador
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -221,9 +221,9 @@ executables: []
|
|
221
221
|
extensions: []
|
222
222
|
extra_rdoc_files: []
|
223
223
|
files:
|
224
|
+
- ".github/FUNDING.yml"
|
224
225
|
- ".github/dependabot.yml"
|
225
|
-
- ".github/workflows/
|
226
|
-
- ".github/workflows/stale.yml"
|
226
|
+
- ".github/workflows/ci.yml"
|
227
227
|
- ".gitignore"
|
228
228
|
- ".rubocop.yml"
|
229
229
|
- ".rubocop_todo.yml"
|
@@ -233,6 +233,7 @@ files:
|
|
233
233
|
- LICENSE.md
|
234
234
|
- README.md
|
235
235
|
- Rakefile
|
236
|
+
- SECURITY.md
|
236
237
|
- changelog.md
|
237
238
|
- fog-core.gemspec
|
238
239
|
- lib/fog/account.rb
|
@@ -312,37 +313,11 @@ files:
|
|
312
313
|
- lib/fog/volume.rb
|
313
314
|
- lib/fog/vpn.rb
|
314
315
|
- lib/tasks/test_task.rb
|
315
|
-
- spec/compute/models/server_spec.rb
|
316
|
-
- spec/compute_spec.rb
|
317
|
-
- spec/connection_spec.rb
|
318
|
-
- spec/core/cache_spec.rb
|
319
|
-
- spec/core/collection_spec.rb
|
320
|
-
- spec/core/model_spec.rb
|
321
|
-
- spec/core/stringify_keys_spec.rb
|
322
|
-
- spec/core/whitelist_keys_spec.rb
|
323
|
-
- spec/credentials_spec.rb
|
324
|
-
- spec/current_machine_spec.rb
|
325
|
-
- spec/fake_app/fake_service.rb
|
326
|
-
- spec/fake_app/models/collection.rb
|
327
|
-
- spec/fake_app/models/model.rb
|
328
|
-
- spec/fake_app/requests/request.rb
|
329
|
-
- spec/fog_attribute_spec.rb
|
330
|
-
- spec/formatador_spec.rb
|
331
|
-
- spec/identity_spec.rb
|
332
|
-
- spec/mocking_spec.rb
|
333
|
-
- spec/service_spec.rb
|
334
|
-
- spec/spec_helper.rb
|
335
|
-
- spec/storage_spec.rb
|
336
|
-
- spec/test_helpers/formats_helper_spec.rb
|
337
|
-
- spec/test_helpers/schema_validator_spec.rb
|
338
|
-
- spec/timeout_spec.rb
|
339
|
-
- spec/utils_spec.rb
|
340
|
-
- spec/uuid_spec.rb
|
341
|
-
- spec/wait_for_spec.rb
|
342
316
|
homepage: https://github.com/fog/fog-core
|
343
317
|
licenses:
|
344
318
|
- MIT
|
345
319
|
metadata:
|
320
|
+
changelog_uri: https://github.com/fog/fog-core/blob/master/changelog.md
|
346
321
|
rubygems_mfa_required: 'true'
|
347
322
|
post_install_message:
|
348
323
|
rdoc_options: []
|
@@ -359,7 +334,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
359
334
|
- !ruby/object:Gem::Version
|
360
335
|
version: '0'
|
361
336
|
requirements: []
|
362
|
-
rubygems_version: 3.
|
337
|
+
rubygems_version: 3.5.18
|
363
338
|
signing_key:
|
364
339
|
specification_version: 4
|
365
340
|
summary: Shared classes and tests for fog providers and services.
|
data/.github/workflows/ruby.yml
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# This workflow uses actions that are not certified by GitHub.
|
2
|
-
# They are provided by a third-party and are governed by
|
3
|
-
# separate terms of service, privacy policy, and support
|
4
|
-
# documentation.
|
5
|
-
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
-
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
-
|
8
|
-
name: Ruby
|
9
|
-
|
10
|
-
on:
|
11
|
-
push:
|
12
|
-
branches: [ master ]
|
13
|
-
pull_request:
|
14
|
-
branches: [ master ]
|
15
|
-
|
16
|
-
jobs:
|
17
|
-
test:
|
18
|
-
uses: fog/.github/.github/workflows/ruby.yml@v1.3.0
|
data/.github/workflows/stale.yml
DELETED
@@ -1,229 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
require "fog/compute/models/server"
|
3
|
-
|
4
|
-
describe Fog::Compute::Server do
|
5
|
-
before do
|
6
|
-
@server = Fog::Compute::Server.new
|
7
|
-
end
|
8
|
-
|
9
|
-
describe "#sshable?" do
|
10
|
-
describe "when the server is not ready" do
|
11
|
-
it "is false" do
|
12
|
-
@server.stub(:ready?, false) do
|
13
|
-
refute @server.sshable?
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
describe "when the server is ready" do
|
19
|
-
describe "when the ssh_ip_address is nil" do
|
20
|
-
it "is false" do
|
21
|
-
@server.stub(:ready?, true) do
|
22
|
-
@server.stub(:ssh_ip_address, nil) do
|
23
|
-
refute @server.sshable?
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
describe "when the ssh_ip_address exists" do
|
30
|
-
# Define these constants which would be imported by net-ssh once loaded
|
31
|
-
module Net
|
32
|
-
module SSH
|
33
|
-
class AuthenticationFailed < RuntimeError
|
34
|
-
end
|
35
|
-
|
36
|
-
class Disconnect < RuntimeError
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
describe "and ssh times out" do
|
42
|
-
it "is false" do
|
43
|
-
@server.stub(:ready?, true) do
|
44
|
-
@server.stub(:ssh_ip_address, "10.0.0.1") do
|
45
|
-
raises_timeout = lambda { |_time| raise Timeout::Error.new }
|
46
|
-
Timeout.stub(:timeout, raises_timeout) do
|
47
|
-
refute @server.sshable?
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
describe "and it raises Net::SSH::AuthenticationFailed" do
|
55
|
-
it "is false" do
|
56
|
-
@server.stub(:ready?, true) do
|
57
|
-
@server.stub(:ssh_ip_address, "10.0.0.1") do
|
58
|
-
raise_error = lambda { |_cmd, _options={}| raise Net::SSH::AuthenticationFailed.new }
|
59
|
-
@server.stub(:ssh, raise_error) do
|
60
|
-
refute @server.sshable?
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
it "resets SSH timeout" do
|
67
|
-
@server.instance_variable_set(:@sshable_timeout, 8)
|
68
|
-
@server.stub(:ready?, true) do
|
69
|
-
@server.stub(:ssh_ip_address, "10.0.0.1") do
|
70
|
-
raise_error = lambda { |_cmd, _options={}| raise Net::SSH::AuthenticationFailed.new }
|
71
|
-
@server.stub(:ssh, raise_error) do
|
72
|
-
@server.sshable?
|
73
|
-
assert_nil @server.instance_variable_get(:@sshable_timeout), nil
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
describe "and it raises Net::SSH::Disconnect" do
|
81
|
-
it "is false" do
|
82
|
-
@server.stub(:ready?, true) do
|
83
|
-
@server.stub(:ssh_ip_address, "10.0.0.1") do
|
84
|
-
raise_error = lambda { |_cmd, _options={}| raise Net::SSH::Disconnect.new }
|
85
|
-
@server.stub(:ssh, raise_error) do
|
86
|
-
refute @server.sshable?
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
it "resets SSH timeout" do
|
93
|
-
@server.instance_variable_set(:@sshable_timeout, 8)
|
94
|
-
@server.stub(:ready?, true) do
|
95
|
-
@server.stub(:ssh_ip_address, "10.0.0.1") do
|
96
|
-
raise_error = lambda { |_cmd, _options={}| raise Net::SSH::Disconnect.new }
|
97
|
-
@server.stub(:ssh, raise_error) do
|
98
|
-
@server.sshable?
|
99
|
-
assert_nil @server.instance_variable_get(:@sshable_timeout), nil
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
describe "and it raises SystemCallError" do
|
107
|
-
it "is false" do
|
108
|
-
@server.stub(:ready?, true) do
|
109
|
-
@server.stub(:ssh_ip_address, "10.0.0.1") do
|
110
|
-
raise_error = lambda { |_cmd, _options={}| raise SystemCallError.new("message, 0") }
|
111
|
-
@server.stub(:ssh, raise_error) do
|
112
|
-
refute @server.sshable?
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
it "does not increase SSH timeout" do
|
119
|
-
@server.stub(:ready?, true) do
|
120
|
-
@server.stub(:ssh_ip_address, "10.0.0.1") do
|
121
|
-
raise_error = lambda { |_cmd, _options={}| raise SystemCallError.new("message, 0") }
|
122
|
-
@server.stub(:ssh, raise_error) do
|
123
|
-
@server.sshable?
|
124
|
-
assert_equal @server.instance_variable_get(:@sshable_timeout), 8
|
125
|
-
end
|
126
|
-
end
|
127
|
-
end
|
128
|
-
end
|
129
|
-
end
|
130
|
-
|
131
|
-
describe "and ssh completes within the designated timeout" do
|
132
|
-
it "is true" do
|
133
|
-
@server.stub(:ready?, true) do
|
134
|
-
@server.stub(:ssh_ip_address, "10.0.0.1") do
|
135
|
-
@server.stub(:ssh, "datum") do
|
136
|
-
assert @server.sshable?
|
137
|
-
end
|
138
|
-
end
|
139
|
-
end
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
describe "when called successively" do
|
144
|
-
describe "and ssh times out" do
|
145
|
-
it "increases the timeout factor by 1.5" do
|
146
|
-
@server.stub(:ready?, true) do
|
147
|
-
@server.stub(:ssh_ip_address, "10.0.0.1") do
|
148
|
-
raises_timeout = lambda do |time|
|
149
|
-
assert(time == 8)
|
150
|
-
raise Timeout::Error.new
|
151
|
-
end
|
152
|
-
Timeout.stub(:timeout, raises_timeout) do
|
153
|
-
refute @server.sshable?
|
154
|
-
end
|
155
|
-
|
156
|
-
raises_timeout = lambda do |time|
|
157
|
-
assert_equal(12, time)
|
158
|
-
raise Timeout::Error.new
|
159
|
-
end
|
160
|
-
Timeout.stub(:timeout, raises_timeout) do
|
161
|
-
refute @server.sshable?
|
162
|
-
end
|
163
|
-
end
|
164
|
-
end
|
165
|
-
end
|
166
|
-
|
167
|
-
it "does not increase timeout beyond 60s" do
|
168
|
-
@server.stub(:ready?, true) do
|
169
|
-
@server.stub(:ssh_ip_address, "10.0.0.1") do
|
170
|
-
raises_timeout = lambda { |_time| raise Timeout::Error.new }
|
171
|
-
Timeout.stub(:timeout, raises_timeout) do
|
172
|
-
5.times { refute @server.sshable? }
|
173
|
-
end
|
174
|
-
|
175
|
-
raises_timeout = lambda do |time|
|
176
|
-
assert_equal(60, time)
|
177
|
-
raise Timeout::Error.new
|
178
|
-
end
|
179
|
-
Timeout.stub(:timeout, raises_timeout) do
|
180
|
-
refute @server.sshable?
|
181
|
-
end
|
182
|
-
|
183
|
-
raises_timeout = lambda do |time|
|
184
|
-
assert_equal(60, time)
|
185
|
-
raise Timeout::Error.new
|
186
|
-
end
|
187
|
-
Timeout.stub(:timeout, raises_timeout) do
|
188
|
-
refute @server.sshable?
|
189
|
-
end
|
190
|
-
end
|
191
|
-
end
|
192
|
-
end
|
193
|
-
|
194
|
-
describe "when ssh eventually succeeds" do
|
195
|
-
it "resets the timeout to the initial value" do
|
196
|
-
@server.stub(:ready?, true) do
|
197
|
-
@server.stub(:ssh_ip_address, "10.0.0.1") do
|
198
|
-
raises_timeout = lambda do |time|
|
199
|
-
assert(time == 8)
|
200
|
-
raise Timeout::Error.new
|
201
|
-
end
|
202
|
-
Timeout.stub(:timeout, raises_timeout) do
|
203
|
-
refute @server.sshable?
|
204
|
-
end
|
205
|
-
|
206
|
-
@server.stub(:ssh, "datum") do
|
207
|
-
assert @server.sshable?
|
208
|
-
end
|
209
|
-
|
210
|
-
raises_timeout = lambda do |time|
|
211
|
-
assert_equal(8, time)
|
212
|
-
raise Timeout::Error.new
|
213
|
-
end
|
214
|
-
Timeout.stub(:timeout, raises_timeout) do
|
215
|
-
refute @server.sshable?
|
216
|
-
end
|
217
|
-
end
|
218
|
-
end
|
219
|
-
end
|
220
|
-
end
|
221
|
-
|
222
|
-
end
|
223
|
-
end
|
224
|
-
|
225
|
-
end
|
226
|
-
end
|
227
|
-
|
228
|
-
end
|
229
|
-
end
|