spec/rflow/configuration/ruby_dsl_spec.rb in rflow-1.0.0a5 vs spec/rflow/configuration/ruby_dsl_spec.rb in rflow-1.0.0a6
- old
+ new
@@ -174,11 +174,11 @@
end
it "should generate PUSH-PULL inproc ZeroMQ connections for in-shard connections" do
described_class.configure do |c|
- c.shard "s1", :process => 1 do |s|
+ c.shard "s1", :process => 2 do |s|
s.component 'first', 'First', :opt1 => 'opt1'
s.component 'second', 'Second', :opt1 => 'opt1', "opt2" => "opt2"
end
c.connect 'first#out' => 'second#in'
@@ -393,9 +393,41 @@
c.connect 'first#out' => 'second#in', :delivery => 'broadcast'
end
expect(Shard).to have(2).shards
+ expect(Component).to have(2).components
+ expect(Port).to have(2).ports
+ expect(Connection).to have(1).connections
+
+ Connection.first.tap do |conn|
+ expect(conn.type).to eq('RFlow::Configuration::BrokeredZMQConnection')
+ expect(conn.name).to eq('first#out=>second#in')
+ expect(conn.output_port_key).to be_nil
+ expect(conn.input_port_key).to be_nil
+ conn.options.tap do |opts|
+ expect(opts['output_socket_type']).to eq('PUB')
+ expect(opts['output_address']).to eq("ipc://rflow.#{conn.uuid}.in")
+ expect(opts['output_responsibility']).to eq('connect')
+ expect(opts['input_socket_type']).to eq('SUB')
+ expect(opts['input_address']).to eq("ipc://rflow.#{conn.uuid}.out")
+ expect(opts['input_responsibility']).to eq('connect')
+ end
+ end
+ end
+
+ it "should generate PUB-SUB brokered ZeroMQ connections for many-to-many in-shard broadcast connections" do
+ described_class.configure do |c|
+
+ c.shard "s1", :process => 3 do |s|
+ s.component 'first', 'First', :opt1 => 'opt1'
+ s.component 'second', 'Second', :opt1 => 'opt1', "opt2" => "opt2"
+ end
+
+ c.connect 'first#out' => 'second#in', :delivery => 'broadcast'
+ end
+
+ expect(Shard).to have(1).shards
expect(Component).to have(2).components
expect(Port).to have(2).ports
expect(Connection).to have(1).connections
Connection.first.tap do |conn|