ruby_skynet 1.3.0.alpha2 → 1.3.0.alpha3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d91bd2a63e1f1430910be685ed142d868a513abc
4
- data.tar.gz: ad501fa1158e5e6b8dd3fb951d6f3435b338c51e
3
+ metadata.gz: 6740cfd40beae05bf039e9bd5fa02281cf6a5e8a
4
+ data.tar.gz: 4fe0295d46526174f6756a505982a9e67d6cd127
5
5
  SHA512:
6
- metadata.gz: 3e53d1a355c850095909974fe3af5ffc608e504aa9cbbd185919003e648b7646d58dd037a3d630fca51968b24a3726d4273d905b9c7b73c0e7b37511d45f10b2
7
- data.tar.gz: 973628fb4d8dcbe406cefaebe9777a64199a19637a9184dda38a0109f79da1364ffd64fdb217593691d49223eeca1aaeaed9f20927605191dd95f53908c68910
6
+ metadata.gz: f49f801c0796148c2269a6a82db40980f8bbf6542bffd7bd9b448aebda4497c7a316a4d7a7a9ba512898234221bcb51e634ddd91d67d631ea7ed751b9f35fd22
7
+ data.tar.gz: 1420af0774b7404a1fdc227ff64d64300d214f4b505b17cacba14d56ddde5147a46259fd1067d15dc18940c785caba230552742a8ac0636eb893b0665d03829f
data/Gemfile CHANGED
@@ -10,7 +10,7 @@ gem "resilient_socket"
10
10
  # Doozer Client
11
11
  #gem "ruby_doozer"
12
12
  # Zookeeper Client
13
- gem "zookeeper"
13
+ #gem "zookeeper"
14
14
  # Thread Safe Hash and Array
15
15
  gem "thread_safe"
16
16
  # For looking up Service entries in Service Registry
data/Gemfile.lock CHANGED
@@ -30,7 +30,6 @@ GEM
30
30
  thread_safe (0.1.3)
31
31
  atomic
32
32
  tzinfo (0.3.38)
33
- zookeeper (1.4.7)
34
33
 
35
34
  PLATFORMS
36
35
  ruby
@@ -44,4 +43,3 @@ DEPENDENCIES
44
43
  semantic_logger (>= 2.1)
45
44
  shoulda
46
45
  thread_safe
47
- zookeeper
@@ -51,7 +51,7 @@ module RubySkynet
51
51
  # By default it connects to a local ZooKeeper instance
52
52
  # Use .configure! to supply a configuration file with any other settings
53
53
  sync_cattr_reader :service_registry do
54
- ServiceRegistry.new
54
+ ServiceRegistry.new(registry: {})
55
55
  end
56
56
 
57
57
  # Returns the current Registry Config information
@@ -10,15 +10,15 @@ require 'thread_safe'
10
10
  # Format of the YAML file
11
11
  # key: [String] "<name>/<version>/<region>"
12
12
  # value: [Array<String>] 'host:port', 'host:port'
13
-
14
13
  #
15
14
  module RubySkynet
16
15
  class StaticServiceRegistry
17
16
  include SemanticLogger::Loggable
18
17
 
19
18
  # Create a service registry
20
- def initialize(services = {})
21
- @services = services
19
+ def initialize(params = {})
20
+ @services = params[:registry]
21
+ raise "Missing :registry in config that must list the availables services" unless @services
22
22
  end
23
23
 
24
24
  # Returns the Service Registry as a Hash
@@ -1,3 +1,3 @@
1
1
  module RubySkynet #:nodoc
2
- VERSION = "1.3.0.alpha2"
2
+ VERSION = "1.3.0.alpha3"
3
3
  end
@@ -75,7 +75,8 @@ class ServiceRegistryTest < Test::Unit::TestCase
75
75
 
76
76
  should "using * version match" do
77
77
  assert (servers = RubySkynet.service_registry.servers_for(@service_name, '*', @region)), RubySkynet.service_registry.to_h.inspect
78
- assert_equal 3, servers.size, servers
78
+ expected = RubySkynet::ServiceRegistry.respond_to?(:score_for_server) ? 3 : 4
79
+ assert_equal expected, servers.size, servers
79
80
  assert_equal true, servers.include?("#{@hostname}:#{@port}"), servers
80
81
  assert_equal true, servers.include?("#{@hostname}:#{@port+1}"), servers
81
82
  assert_equal true, servers.include?("#{@hostname}:#{@port+3}"), servers
@@ -110,6 +111,7 @@ class ServiceRegistryTest < Test::Unit::TestCase
110
111
  ['10.0.11.0', 0 ],
111
112
  ].each do |test|
112
113
  should "handle score #{test[1]}" do
114
+ skip "Not applicable to Static Service Registry" unless RubySkynet::ServiceRegistry.respond_to?(:score_for_server)
113
115
  local_ip_address = "192.168.11.0"
114
116
  assert_equal test[1], RubySkynet::ServiceRegistry.score_for_server(test[0], local_ip_address), "Local: #{local_ip_address} Server: #{test[0]} Score: #{test[1]}"
115
117
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_skynet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0.alpha2
4
+ version: 1.3.0.alpha3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Reid Morrison