Skip to content

Commit 6e539f4

Browse files
committed
Fix specs
1 parent 2331ae3 commit 6e539f4

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

lib/aerospike/node_validator.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@
2020
module Aerospike
2121
class NodeValidator # :nodoc:
2222

23-
attr_reader :host, :aliases, :name, :features, :cluster_name, :tls_options, :conn
23+
attr_reader :host, :timeout, :aliases, :name, :features, :cluster_name, :tls_options, :conn
2424

2525
def initialize(cluster, host, timeout, cluster_name, tls_options = {})
2626
@cluster = cluster
2727
@features = Set.new
2828
@host = host
29+
@timeout = timeout
2930
@cluster_name = cluster_name
3031
@tls_options = tls_options
3132

@@ -44,7 +45,7 @@ def get_hosts(address)
4445

4546
begin
4647
conn = Cluster::CreateConnection.(@cluster, Host.new(address, host.port, host.tls_name))
47-
conn.timeout = @cluster.connection_timeout
48+
conn.timeout = timeout
4849

4950
commands = %w[node features]
5051
commands << address_command unless is_loopback?(address)

spec/aerospike/node_validator_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
before do
2222
allow(socket).to receive(:write).and_return(nil)
2323
allow(socket).to receive(:read).and_return(nil)
24+
allow(socket).to receive(:timeout=).and_return(nil)
2425
expect(::Aerospike::Cluster::CreateConnection).to receive(:call).and_return(socket)
2526
end
2627

@@ -31,6 +32,7 @@
3132
let(:hosts) { [::Aerospike::Host.new('192.168.1.1', '3000')] }
3233

3334
before do
35+
allow(socket).to receive(:timeout=).and_return(nil)
3436
allow(::Aerospike::Cluster::CreateConnection).to receive(:call).and_return(socket)
3537

3638
expect(::Aerospike::Info).to receive(:request).and_return(
@@ -49,6 +51,7 @@
4951
let(:hosts) { [::Aerospike::Host.new('my.lb.com', '3000')] }
5052

5153
before do
54+
allow(socket).to receive(:timeout=).and_return(nil)
5255
allow(::Aerospike::Cluster::CreateConnection).to receive(:call).and_return(socket)
5356
expect(Resolv).to receive(:getaddresses).and_return(['101.1.1.1', '102.1.1.1'])
5457

@@ -79,6 +82,7 @@
7982
let(:policy) { ::Aerospike::ClientPolicy.new(tls: { enable: true }) }
8083

8184
before do
85+
allow(socket).to receive(:timeout=).and_return(nil)
8286
allow(::Aerospike::Cluster::CreateConnection).to receive(:call).and_return(socket)
8387
expect(Resolv).to receive(:getaddresses).and_return(['101.1.1.1', '102.1.1.1'])
8488

0 commit comments

Comments
 (0)