hoodoo 1.0.5 → 1.1.0
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 +8 -8
- data/lib/hoodoo/client/endpoint/endpoints/amqp.rb +43 -25
- data/lib/hoodoo/discovery.rb +1 -1
- data/lib/hoodoo/services/discovery/discoverers/by_flux.rb +130 -0
- data/lib/hoodoo/services/discovery/results/for_amqp.rb +15 -21
- data/lib/hoodoo/services/discovery/results/for_local.rb +17 -0
- data/lib/hoodoo/services/middleware/amqp_log_message.rb +92 -154
- data/lib/hoodoo/services/middleware/amqp_log_writer.rb +25 -50
- data/lib/hoodoo/services/middleware/middleware.rb +75 -25
- data/lib/hoodoo/services/services/service.rb +2 -2
- data/lib/hoodoo/version.rb +1 -1
- data/spec/services/discovery/discoverers/by_flux_spec.rb +134 -0
- data/spec/services/discovery/results/for_amqp_spec.rb +4 -7
- data/spec/services/discovery/results/for_local_spec.rb +4 -0
- data/spec/services/middleware/amqp_log_message_spec.rb +32 -34
- data/spec/services/middleware/amqp_log_writer_spec.rb +2 -5
- data/spec/services/middleware/middleware_exotic_communication_spec.rb +147 -143
- data/spec/services/middleware/middleware_logging_spec.rb +10 -10
- data/spec/services/middleware/middleware_multi_remote_spec.rb +1 -1
- data/spec/services/middleware/middleware_public_spec.rb +73 -18
- data/spec/services/middleware/middleware_spec.rb +4 -4
- data/spec/services/services/application_spec.rb +3 -3
- data/spec/spec_helper.rb +3 -8
- metadata +19 -7
- data/lib/hoodoo/services/discovery/discoverers/by_consul.rb +0 -66
- data/spec/alchemy/alchemy-amq.rb +0 -33
- data/spec/services/discovery/discoverers/by_consul_spec.rb +0 -29
data/spec/alchemy/alchemy-amq.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
# Hoodoo is going open source before AlchemyAMQ, but the test suite has
|
2
|
-
# Alchemy dependencies. The Gemfile even used to require Alchemy in test
|
3
|
-
# mode directly from the private GitHub repository.
|
4
|
-
#
|
5
|
-
# That doesn't work for a public gem, so this file is a temporary mock
|
6
|
-
# of relevant Alchemy namespaces to get tests to pass until Alchemy AMQ
|
7
|
-
# is released.
|
8
|
-
#
|
9
|
-
# Without being able to see bits of Alchemy code that this minimally
|
10
|
-
# mocks, neither this file nor the tests that run through it will make
|
11
|
-
# much sense unfortunately.
|
12
|
-
|
13
|
-
require 'ostruct'
|
14
|
-
require 'msgpack'
|
15
|
-
|
16
|
-
module AlchemyAMQ
|
17
|
-
class HTTPResponse < OpenStruct
|
18
|
-
end
|
19
|
-
|
20
|
-
class Message < OpenStruct
|
21
|
-
def serialize
|
22
|
-
self.payload = MessagePack.pack(@content)
|
23
|
-
end
|
24
|
-
|
25
|
-
def deserialize
|
26
|
-
@content = MessagePack.unpack(self.payload, :symbolize_keys => true)
|
27
|
-
end
|
28
|
-
|
29
|
-
def send_message; end
|
30
|
-
|
31
|
-
def self.register_type( *args ); end
|
32
|
-
end
|
33
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Hoodoo::Services::Discovery::ByConsul do
|
4
|
-
before :each do
|
5
|
-
@d = described_class.new
|
6
|
-
end
|
7
|
-
|
8
|
-
# TODO: Assume static mapping and no Consul communication to mock out.
|
9
|
-
|
10
|
-
it 'announces' do
|
11
|
-
result = @d.announce( 'Version', '2' ) # Intentional string use
|
12
|
-
expect( result ).to be_a( Hoodoo::Services::Discovery::ForAMQP )
|
13
|
-
expect( result.resource ).to eq( :Version )
|
14
|
-
expect( result.version ).to eq( 2 )
|
15
|
-
expect( result.queue_name ).to eq( 'service.version' )
|
16
|
-
expect( result.equivalent_path ).to eq( '/v2/versions')
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'discovers' do
|
20
|
-
result = @d.announce( 'Version', 2 )
|
21
|
-
@d.instance_variable_set( '@known_local_resources', {} ) # Hack for test!
|
22
|
-
|
23
|
-
result = @d.discover( :Version, 2 )
|
24
|
-
expect( result.resource ).to eq( :Version )
|
25
|
-
expect( result.version ).to eq( 2 )
|
26
|
-
expect( result.queue_name ).to eq( 'service.version' )
|
27
|
-
expect( result.equivalent_path ).to eq( '/v2/versions')
|
28
|
-
end
|
29
|
-
end
|