Module: Helpers::Connections

Included in:
MetadataPassthrough, TestInstance
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/spec/helpers/connections.rb

Instance Method Summary collapse

Instance Method Details

#full_local_urlObject



40
41
42
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/spec/helpers/connections.rb', line 40

def full_local_url
  "http://#{local_url}"
end

#local_connection(endpoints = "http://#{local_url}", allow_reconnect: true) ⇒ Object



8
9
10
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/spec/helpers/connections.rb', line 8

def local_connection(endpoints="http://#{local_url}", allow_reconnect: true)
  Etcdv3.new(endpoints: endpoints, allow_reconnect: allow_reconnect)
end

#local_connection_with_auth(user, password) ⇒ Object



4
5
6
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/spec/helpers/connections.rb', line 4

def local_connection_with_auth(user, password)
  Etcdv3.new(endpoints: "http://#{local_url}", user: user, password: password)
end

#local_connection_with_namespace(namespace) ⇒ Object



16
17
18
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/spec/helpers/connections.rb', line 16

def local_connection_with_namespace(namespace)
  Etcdv3.new(endpoints: "http://#{local_url}", namespace: namespace)
end

#local_connection_with_timeout(timeout) ⇒ Object



12
13
14
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/spec/helpers/connections.rb', line 12

def local_connection_with_timeout(timeout)
  Etcdv3.new(endpoints: "http://#{local_url}", command_timeout: timeout)
end

#local_namespace_stub(interface, timeout = nil, namespace) ⇒ Object



28
29
30
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/spec/helpers/connections.rb', line 28

def local_namespace_stub(interface, timeout=nil, namespace)
  interface.new(local_url, :this_channel_is_insecure, timeout, namespace, {})
end

#local_namespace_stub_with_metadata(interface, timeout: nil, namespace:, metadata: {}) ⇒ Object



32
33
34
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/spec/helpers/connections.rb', line 32

def (interface, timeout: nil, namespace:, metadata: {})
  interface.new(local_url, :this_channel_is_insecure, timeout, namespace, )
end

#local_stub(interface, timeout = nil) ⇒ Object



20
21
22
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/spec/helpers/connections.rb', line 20

def local_stub(interface, timeout=nil)
  interface.new(local_url, :this_channel_is_insecure, timeout, {})
end

#local_stub_with_metadata(interface, timeout: nil, metadata: {}) ⇒ Object



24
25
26
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/spec/helpers/connections.rb', line 24

def (interface, timeout: nil, metadata: {})
  interface.new(local_url, :this_channel_is_insecure, timeout, )
end

#local_urlObject



36
37
38
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/spec/helpers/connections.rb', line 36

def local_url
  "127.0.0.1:#{port}"
end

#portObject



44
45
46
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/spec/helpers/connections.rb', line 44

def port
  ENV.fetch('ETCD_TEST_PORT', 2379).to_i
end