Skip to content

Commit

Permalink
removed test for server incorrectly sending duplicate message.
Browse files Browse the repository at this point in the history
checks for the same are dependent on connection serial.
  • Loading branch information
sacOO7 committed Jun 10, 2024
1 parent 897bccf commit cfe0820
Showing 1 changed file with 0 additions and 35 deletions.
35 changes: 0 additions & 35 deletions spec/acceptance/realtime/message_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -418,41 +418,6 @@ def publish_and_check_extras(extras)
end
end

context 'server incorrectly resends a message that was already received by the client library' do
let(:messages_received) { [] }
let(:connection) { client.connection }
let(:client_options) { default_options.merge(log_level: :fatal) }

it 'discards the message and logs it as an error to the channel' do
first_message_protocol_message = nil
connection.__incoming_protocol_msgbus__.subscribe(:protocol_message) do |protocol_message|
first_message_protocol_message ||= protocol_message unless protocol_message.messages.empty?
end

channel.attach do
channel.subscribe do |message|
messages_received << message
if messages_received.count == 2
# simulate a duplicate protocol message being received
EventMachine.next_tick do
connection.__incoming_protocol_msgbus__.publish :protocol_message, first_message_protocol_message
end
end
end
2.times { |i| EventMachine.add_timer(i.to_f / 5) { channel.publish('event', 'data') } }

expect(client.logger).to receive(:error) do |*args, &block|
expect(args.concat([block ? block.call : nil]).join(',')).to match(/duplicate/)

EventMachine.add_timer(0.5) do
expect(messages_received.count).to eql(2)
stop_reactor
end
end
end
end
end

context 'encoding and decoding encrypted messages' do
shared_examples 'an Ably encrypter and decrypter' do |item, data|
let(:algorithm) { data['algorithm'].upcase }
Expand Down

0 comments on commit cfe0820

Please sign in to comment.