lbspec 0.2.7 → 0.2.8
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/lbspec/respond.rb +8 -7
- data/lib/lbspec/transfer.rb +11 -10
- data/lib/lbspec/util.rb +2 -0
- data/lib/lbspec/version.rb +1 -1
- 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: bc6f025cf48f9f28b899219aee4782724b75affe
|
4
|
+
data.tar.gz: bfaaad1d0182f19d0210f329d0a981a19151dad9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be891f0b85609b354e73c05fdc87bad1b03fa5e099744a25815d9eb2399e7eef34e083227fd00aa09dcc1178a91e0625475ff4fdfd1c3c5d1b5b61ba59b827bb
|
7
|
+
data.tar.gz: bef0f7f51636c4978f297957ce1853462c81e8dc33fa80db2be973ba89c4ca8515b12ab5b8c21a8869571f55bb724db5f2bfd3508521625d4a33f48de8077f87
|
data/lib/lbspec/respond.rb
CHANGED
@@ -8,6 +8,7 @@ RSpec::Matchers.define :respond do |expect|
|
|
8
8
|
match do |vhost|
|
9
9
|
fail ArgumentError, '#respond must have non-nil argument' unless expect
|
10
10
|
log.debug("#respond(#{expect.inspect}) is called")
|
11
|
+
@vhost = vhost
|
11
12
|
@expect = expect
|
12
13
|
request =
|
13
14
|
Lbspec::Request.new(vhost, @from,
|
@@ -67,20 +68,20 @@ RSpec::Matchers.define :respond do |expect|
|
|
67
68
|
"respond #{@expect}#{@chain_str}."
|
68
69
|
end
|
69
70
|
|
70
|
-
failure_message_for_should do
|
71
|
-
result_string
|
71
|
+
failure_message_for_should do
|
72
|
+
result_string
|
72
73
|
end
|
73
74
|
|
74
|
-
failure_message_for_should_not do
|
75
|
+
failure_message_for_should_not do
|
75
76
|
negative = true
|
76
|
-
result_string(
|
77
|
+
result_string(negative)
|
77
78
|
end
|
78
79
|
|
79
|
-
def result_string(
|
80
|
+
def result_string(negative = false)
|
80
81
|
negation = negative ? ' not' : ''
|
81
|
-
result = "expected #{vhost}#{negation} to respond #{expect}"
|
82
|
+
result = "expected #{@vhost}#{negation} to respond #{@expect}"
|
82
83
|
result << ", but did#{negation}.\n" + "requested:\n"
|
83
|
-
result <<
|
84
|
+
result << @output_request.gsub(/^/, ' ')
|
84
85
|
end
|
85
86
|
|
86
87
|
def log
|
data/lib/lbspec/transfer.rb
CHANGED
@@ -8,6 +8,7 @@ RSpec::Matchers.define :transfer do |nodes|
|
|
8
8
|
match do |vhost|
|
9
9
|
fail ArgumentError, '#transfer must have non-nil argument' unless nodes
|
10
10
|
log.debug("#transfer(#{nodes.inspect}) is called")
|
11
|
+
@vhost = vhost
|
11
12
|
prove = Lbspec::Util.create_prove
|
12
13
|
capture =
|
13
14
|
Lbspec::Capture.new(nodes, @port, prove, @include_str)
|
@@ -76,33 +77,33 @@ RSpec::Matchers.define :transfer do |nodes|
|
|
76
77
|
"transfer requests to #{nodes}#{@chain_str}."
|
77
78
|
end
|
78
79
|
|
79
|
-
failure_message_for_should do
|
80
|
-
result_string
|
80
|
+
failure_message_for_should do
|
81
|
+
result_string
|
81
82
|
end
|
82
83
|
|
83
|
-
failure_message_for_should_not do
|
84
|
+
failure_message_for_should_not do
|
84
85
|
negative = true
|
85
|
-
result_string(
|
86
|
-
negative)
|
86
|
+
result_string(negative)
|
87
87
|
end
|
88
88
|
|
89
|
-
def result_string(
|
90
|
-
request_str, capture_str, negative = false)
|
89
|
+
def result_string(negative = false)
|
91
90
|
negation = negative ? ' not' : ''
|
92
|
-
result = "expected #{vhost}#{negation} to transfer requests to"
|
93
|
-
result << nodes.to_s + chain_str
|
91
|
+
result = "expected #{@vhost}#{negation} to transfer requests to"
|
92
|
+
result << @nodes.to_s + @chain_str
|
94
93
|
result << ", but did#{negation}.\n" + "requested:\n"
|
95
|
-
result <<
|
94
|
+
result << @output_request.gsub(/^/, ' ')
|
96
95
|
result << "\ncaptured:\n"
|
97
96
|
result << result_capture
|
98
97
|
result
|
99
98
|
end
|
100
99
|
|
101
100
|
def result_capture
|
101
|
+
result = ''
|
102
102
|
@output_capture.each do |o|
|
103
103
|
result << o[:node].gsub(/^/, ' ') + "\n"
|
104
104
|
result << o[:output].gsub(/^/, ' ') + "\n"
|
105
105
|
end
|
106
|
+
result
|
106
107
|
end
|
107
108
|
|
108
109
|
def log
|
data/lib/lbspec/util.rb
CHANGED
@@ -53,12 +53,14 @@ module Lbspec
|
|
53
53
|
Net::SSH.start(node, ssh_user(node), options) do |ssh|
|
54
54
|
output << ssh.exec!(command).to_s
|
55
55
|
end
|
56
|
+
output
|
56
57
|
end
|
57
58
|
|
58
59
|
def self.exec_command_local(command)
|
59
60
|
output = command + "\n"
|
60
61
|
log.debug("execute locally: #{command}")
|
61
62
|
output << `#{command}`.to_s
|
63
|
+
output
|
62
64
|
end
|
63
65
|
|
64
66
|
def self.ssh_user(node)
|
data/lib/lbspec/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lbspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OTA Hiroshi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|