pivotal-selenium-grid 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +3 -0
- data/config/hoe.rb +1 -1
- data/config/requirements.rb +1 -0
- data/lib/selenium-grid/hub.rb +2 -1
- data/lib/selenium-grid/remote.rb +3 -2
- data/lib/selenium-grid/version.rb +1 -1
- data/spec/selenium-grid/hub_spec.rb +4 -4
- data/spec/selenium-grid/remote_spec.rb +15 -9
- metadata +2 -1
data/Manifest.txt
CHANGED
@@ -24,6 +24,8 @@ lib/tasks/hoe.rake
|
|
24
24
|
lib/tasks/hub.rake
|
25
25
|
lib/tasks/rc.rake
|
26
26
|
lib/tasks/rspec.rake
|
27
|
+
lib/utils.rb
|
28
|
+
lib/utils/netstat.rb
|
27
29
|
spec/extensions/string_spec.rb
|
28
30
|
spec/extensions_spec_suite.rb
|
29
31
|
spec/java/vm_spec.rb
|
@@ -34,3 +36,4 @@ spec/selenium-grid_spec_suite.rb
|
|
34
36
|
spec/spec.opts
|
35
37
|
spec/spec_helper.rb
|
36
38
|
spec/spec_suite.rb
|
39
|
+
spec/utils/netstat_spec.rb
|
data/config/hoe.rb
CHANGED
data/config/requirements.rb
CHANGED
data/lib/selenium-grid/hub.rb
CHANGED
@@ -3,6 +3,7 @@ require 'singleton'
|
|
3
3
|
module SeleniumGrid
|
4
4
|
class Hub
|
5
5
|
include Singleton
|
6
|
+
include Utils
|
6
7
|
|
7
8
|
HUB_PORT=4444
|
8
9
|
|
@@ -30,7 +31,7 @@ module SeleniumGrid
|
|
30
31
|
end
|
31
32
|
|
32
33
|
def running?
|
33
|
-
|
34
|
+
Netstat.instance.running?(HUB_PORT)
|
34
35
|
end
|
35
36
|
end
|
36
37
|
end
|
data/lib/selenium-grid/remote.rb
CHANGED
@@ -4,6 +4,7 @@ require File.join(File.dirname(__FILE__), "hub")
|
|
4
4
|
module SeleniumGrid
|
5
5
|
class Remote
|
6
6
|
include Singleton
|
7
|
+
include Utils
|
7
8
|
|
8
9
|
DEFAULT_BROWSER = "*chrome"
|
9
10
|
DEFAULT_PORT = 5555
|
@@ -33,7 +34,7 @@ module SeleniumGrid
|
|
33
34
|
end
|
34
35
|
|
35
36
|
def list
|
36
|
-
return {} unless
|
37
|
+
return {} unless Netstat.instance.running?(Hub::HUB_PORT)
|
37
38
|
remotes = ps.split(/\n|\r/)
|
38
39
|
return {} if remotes.empty?
|
39
40
|
|
@@ -46,7 +47,7 @@ module SeleniumGrid
|
|
46
47
|
end
|
47
48
|
|
48
49
|
def running?(port = ENV['PORT'] || DEFAULT_PORT)
|
49
|
-
|
50
|
+
Netstat.instance.running?(port)
|
50
51
|
end
|
51
52
|
|
52
53
|
def arguments(overrides = {})
|
@@ -71,7 +71,7 @@ module SeleniumGrid
|
|
71
71
|
describe "#list" do
|
72
72
|
context "when the Hub is not running" do
|
73
73
|
before do
|
74
|
-
mock(
|
74
|
+
mock(Utils::Netstat.instance).running?(Hub::HUB_PORT) { false }
|
75
75
|
end
|
76
76
|
|
77
77
|
it "lists empty string" do
|
@@ -81,7 +81,7 @@ module SeleniumGrid
|
|
81
81
|
|
82
82
|
context "when the Hub is running" do
|
83
83
|
before do
|
84
|
-
mock(
|
84
|
+
mock(Utils::Netstat.instance).running?(Hub::HUB_PORT) { true }
|
85
85
|
end
|
86
86
|
|
87
87
|
it "lists details about the running Hub" do
|
@@ -93,7 +93,7 @@ module SeleniumGrid
|
|
93
93
|
describe "#running?" do
|
94
94
|
context "when the Hub is not running" do
|
95
95
|
before do
|
96
|
-
mock(
|
96
|
+
mock(Utils::Netstat.instance).running?(Hub::HUB_PORT) { false }
|
97
97
|
end
|
98
98
|
|
99
99
|
it "returns false" do
|
@@ -103,7 +103,7 @@ module SeleniumGrid
|
|
103
103
|
|
104
104
|
context "when the Hub is running" do
|
105
105
|
before do
|
106
|
-
mock(
|
106
|
+
mock(Utils::Netstat.instance).running?(Hub::HUB_PORT) { true }
|
107
107
|
end
|
108
108
|
|
109
109
|
it "lists returns true" do
|
@@ -103,7 +103,7 @@ module SeleniumGrid
|
|
103
103
|
describe "#list" do
|
104
104
|
context "when there is no Remote running" do
|
105
105
|
before do
|
106
|
-
mock(
|
106
|
+
mock(Utils::Netstat.instance).running?(anything) { false }
|
107
107
|
end
|
108
108
|
|
109
109
|
it "lists nothing" do
|
@@ -113,7 +113,7 @@ module SeleniumGrid
|
|
113
113
|
|
114
114
|
context "when a single Remote is running" do
|
115
115
|
before do
|
116
|
-
mock(
|
116
|
+
mock(Utils::Netstat.instance).running?(Hub::HUB_PORT) { true }
|
117
117
|
mock(remote).ps { "prefix -port #{Remote::DEFAULT_PORT} -env #{Remote::DEFAULT_BROWSER} suffix" }
|
118
118
|
end
|
119
119
|
|
@@ -124,7 +124,7 @@ module SeleniumGrid
|
|
124
124
|
|
125
125
|
context "when multiple Remotes are running" do
|
126
126
|
before do
|
127
|
-
mock(
|
127
|
+
mock(Utils::Netstat.instance).running?(Hub::HUB_PORT) { true }
|
128
128
|
mock(remote).ps do
|
129
129
|
"prefix -port #{Remote::DEFAULT_PORT} -env #{Remote::DEFAULT_BROWSER} suffix\n" +
|
130
130
|
"prefix -port 1234 -env *safari suffix\n"
|
@@ -143,7 +143,7 @@ module SeleniumGrid
|
|
143
143
|
context "when a port number is not provided" do
|
144
144
|
context "when a Remote is not running on the default port" do
|
145
145
|
before do
|
146
|
-
mock(
|
146
|
+
mock(Utils::Netstat.instance).running?(Remote::DEFAULT_PORT) { false }
|
147
147
|
end
|
148
148
|
|
149
149
|
it "returns false" do
|
@@ -153,7 +153,7 @@ module SeleniumGrid
|
|
153
153
|
|
154
154
|
context "when a Remote is running on the default port" do
|
155
155
|
before do
|
156
|
-
mock(
|
156
|
+
mock(Utils::Netstat.instance).running?(Remote::DEFAULT_PORT) { true }
|
157
157
|
end
|
158
158
|
|
159
159
|
it "returns true" do
|
@@ -163,23 +163,29 @@ module SeleniumGrid
|
|
163
163
|
end
|
164
164
|
|
165
165
|
context "when a port number is provided" do
|
166
|
+
attr_reader :port
|
167
|
+
|
168
|
+
before do
|
169
|
+
@port = 1234
|
170
|
+
end
|
171
|
+
|
166
172
|
context "when a Remote is not running on the provided port" do
|
167
173
|
before do
|
168
|
-
mock(
|
174
|
+
mock(Utils::Netstat.instance).running?(port) { false }
|
169
175
|
end
|
170
176
|
|
171
177
|
it "returns false" do
|
172
|
-
remote.running?(
|
178
|
+
remote.running?(port).should be_false
|
173
179
|
end
|
174
180
|
end
|
175
181
|
|
176
182
|
context "when a Remote is running on the provided port" do
|
177
183
|
before do
|
178
|
-
mock(
|
184
|
+
mock(Utils::Netstat.instance).running?(port) { true }
|
179
185
|
end
|
180
186
|
|
181
187
|
it "returns true" do
|
182
|
-
remote.running?(
|
188
|
+
remote.running?(port).should be_true
|
183
189
|
end
|
184
190
|
end
|
185
191
|
end
|
metadata
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pivotal-selenium-grid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Dy
|
8
8
|
- Corey Innis
|
9
|
+
- Kunal Anand
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|