Skip to content

Commit

Permalink
Replaced recovery_key usages with create_recovery_key in all tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sacOO7 committed Jun 10, 2024
1 parent 9574830 commit aeb2e2b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions spec/acceptance/realtime/channel_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2426,7 +2426,7 @@ def self.build_flags(flags)
connection_id = client.connection.id
expect(channel_state_change.resumed).to be_falsey

recover_client = auto_close Ably::Realtime::Client.new(client_options.merge(recover: client.connection.recovery_key))
recover_client = auto_close Ably::Realtime::Client.new(client_options.merge(recover: client.connection.create_recovery_key))
recover_client.connection.once(:connected) do
expect(recover_client.connection.id).to eql(connection_id)
recover_channel = recover_client.channels.get(channel_name)
Expand All @@ -2441,7 +2441,7 @@ def self.build_flags(flags)

it 'is false when a connection fails to recover and the channel is attached' do
client.connection.once(:connected) do
recovery_key = client.connection.recovery_key
recovery_key = client.connection.create_recovery_key
client.connection.once(:closed) do
recover_client = auto_close Ably::Realtime::Client.new(client_options.merge(recover: recovery_key, log_level: :error))
recover_client.connection.once(:connected) do
Expand Down
12 changes: 6 additions & 6 deletions spec/acceptance/realtime/connection_failures_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ def send_disconnect_message
previous_connection_id = connection.id
connection.transport.close_connection_after_writing

expect(connection).to receive(:configure_new).with(previous_connection_id, anything, anything).and_call_original
expect(connection).to receive(:configure_new).with(previous_connection_id, anything).and_call_original

connection.once(:connected) do
expect(connection.key).to_not be_nil
Expand Down Expand Up @@ -1079,7 +1079,7 @@ def send_disconnect_message

def kill_connection_transport_and_prevent_valid_resume
connection.transport.close_connection_after_writing
connection.configure_new '0123456789abcdef', 'wVIsgTHAB1UvXh7z-1991d8586', -1 # force the resume connection key to be invalid
connection.configure_new '0123456789abcdef', '0123456789abcdef-99' # force the resume connection key to be invalid
end

it 'updates the connection_id and connection_key' do
Expand Down Expand Up @@ -1112,7 +1112,7 @@ def kill_connection_transport_and_prevent_valid_resume
end
channel.on(:attaching) do |channel_state_change|
error = channel_state_change.reason
expect(error.message).to match(/Unable to recover connection/i)
expect(error.message).to match(/Invalid connection key/i)
reattaching_channels << channel
end
channel.on(:attached) do
Expand Down Expand Up @@ -1212,9 +1212,9 @@ def kill_connection_transport_and_prevent_valid_resume
it 'sets the error reason on each channel' do
channel.attach do
channel.on(:attaching) do |state_change|
expect(state_change.reason.message).to match(/Unable to recover connection/i)
expect(state_change.reason.code).to eql(80008)
expect(channel.error_reason.code).to eql(80008)
expect(state_change.reason.message).to match(/Invalid connection key/i)
expect(state_change.reason.code).to eql(80018)
expect(channel.error_reason.code).to eql(80018)

channel.on(:attached) do |state_change|
stop_reactor
Expand Down
10 changes: 5 additions & 5 deletions spec/acceptance/realtime/connection_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1364,7 +1364,7 @@ def self.available_states

available_states.each do |state|
connection.on(state) do
states[state.to_sym] = true if connection.recovery_key
states[state.to_sym] = true if connection.create_recovery_key
end
end

Expand All @@ -1382,7 +1382,7 @@ def self.available_states
it 'is nil when connection is explicitly CLOSED' do
connection.once(:connected) do
connection.close do
expect(connection.recovery_key).to be_nil
expect(connection.create_recovery_key).to be_nil
stop_reactor
end
end
Expand Down Expand Up @@ -1418,7 +1418,7 @@ def self.available_states

channel.attach do
connection_id = client.connection.id
recovery_key = client.connection.recovery_key
recovery_key = client.connection.create_recovery_key
connection.transport.__incoming_protocol_msgbus__
publishing_client_channel.publish('event', 'message') do
connection.transition_state_machine! :failed
Expand Down Expand Up @@ -1452,7 +1452,7 @@ def self.available_states
channel.publish('event', 'message') do
msg_serial = connection.send(:client_msg_serial)
expect(msg_serial).to eql(0)
recovery_key = client.connection.recovery_key
recovery_key = client.connection.create_recovery_key
connection.transition_state_machine! :failed
end
end
Expand Down Expand Up @@ -1483,7 +1483,7 @@ def self.available_states
expect(message.data).to eql('message-1')
msg_serial = connection.send(:client_msg_serial)
expect(msg_serial).to eql(0)
recovery_key = client.connection.recovery_key
recovery_key = client.connection.create_recovery_key
connection.transition_state_machine! :failed
end
channel.publish('event', 'message-1')
Expand Down

0 comments on commit aeb2e2b

Please sign in to comment.