Skip to content

Commit

Permalink
WIP test against the lmars-dev cluster
Browse files Browse the repository at this point in the history
Signed-off-by: Lewis Marshall <[email protected]>
  • Loading branch information
lmars committed Jul 8, 2024
1 parent 79cf2f5 commit c695196
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lib/ably/modules/ably.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module Ably
# network failures either at the client, between the client and Ably, within an Ably data center, or at the IO domain registrar
# see https://ably.com/docs/client-lib-development-guide/features/#RSC15a
#
FALLBACK_DOMAIN = 'ably-realtime.com'.freeze
FALLBACK_DOMAIN = 'ably-realtime-nonprod.com'.freeze
FALLBACK_IDS = %w(a b c d e).freeze

# Default production fallbacks a.ably-realtime.com ... e.ably-realtime.com
Expand Down
2 changes: 1 addition & 1 deletion lib/ably/rest/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def initialize(options)
when custom_host || options[:realtime_host] || custom_port || custom_tls_port
[]
when environment
CUSTOM_ENVIRONMENT_FALLBACKS_SUFFIXES.map { |host| "#{environment}#{host}" }
CUSTOM_ENVIRONMENT_FALLBACKS_SUFFIXES.map { |host| "#{environment.sub(/-dev$/, '')}#{host}" }
else
Ably::FALLBACK_HOSTS
end
Expand Down
2 changes: 1 addition & 1 deletion spec/acceptance/realtime/connection_failures_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1469,7 +1469,7 @@ def kill_connection_transport_and_prevent_valid_resume
end

context 'with non-production environment' do
let(:environment) { 'sandbox' }
let(:environment) { 'lmars-dev' }
let(:expected_host) { "#{environment}-#{Ably::Realtime::Client::DOMAIN}" }
let(:client_options) { timeout_options.merge(environment: environment) }

Expand Down
8 changes: 4 additions & 4 deletions spec/acceptance/rest/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ def encode64(text)

context 'when environment is NOT production (#RSC15b)' do
context 'and custom fallback hosts are empty' do
let(:client_options) { default_options.merge(environment: 'sandbox', key: api_key, fallback_hosts: []) }
let(:client_options) { default_options.merge(environment: 'lmars-dev', key: api_key, fallback_hosts: []) }
let!(:default_host_request_stub) do
stub_request(:post, "https://#{environment}-#{Ably::Rest::Client::DOMAIN}#{path}").to_return do
raise Faraday::TimeoutError.new('timeout error message')
Expand All @@ -325,14 +325,14 @@ def encode64(text)
end

context 'and no custom fallback hosts are provided' do
let(:client_options) { default_options.merge(environment: 'sandbox', key: api_key) }
let(:client_options) { default_options.merge(environment: 'lmars-dev', key: api_key) }

it 'should make connection attempts to sandbox-a-fallback.ably-realtime.com, sandbox-b-fallback.ably-realtime.com, sandbox-c-fallback.ably-realtime.com, sandbox-d-fallback.ably-realtime.com, sandbox-e-fallback.ably-realtime.com (#RSC15a)' do
it 'should make connection attempts to lmars-dev-a-fallback.ably-realtime.com, lmars-dev-b-fallback.ably-realtime.com, lmars-dev-c-fallback.ably-realtime.com, lmars-dev-d-fallback.ably-realtime.com, lmars-dev-e-fallback.ably-realtime.com (#RSC15a)' do
hosts = []
5.times do
hosts << client.fallback_connection.host
end
expect(hosts).to match_array(%w(a b c d e).map { |id| "sandbox-#{id}-fallback.ably-realtime.com" })
expect(hosts).to match_array(%w(a b c d e).map { |id| "lmars-dev-#{id}-fallback.ably-realtime.com" })
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/rspec_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
key_name: 'app_id.key_name',
key_secret: 'secret',
api_key: 'app_id.key_name:secret',
environment: 'sandbox'
environment: 'lmars-dev'
))
WebMock.enable!
end
Expand Down
4 changes: 2 additions & 2 deletions spec/shared/client_initializer_behaviour.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,10 @@ def rest?
end

context 'with environment option' do
let(:client_options) { default_options.merge(environment: 'sandbox', auto_connect: false) }
let(:client_options) { default_options.merge(environment: 'lmars-dev', auto_connect: false) }

it 'uses an alternate endpoint' do
expect(subject.endpoint.to_s).to eql("#{protocol}s://sandbox-#{subdomain}.ably.io")
expect(subject.endpoint.to_s).to eql("#{protocol}s://lmars-dev-#{subdomain}.ably.io")
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/support/test_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def delete
end

def environment
ENV['ABLY_ENV'] || 'sandbox'
ENV['ABLY_ENV'] || 'lmars-dev'
end

def create_test_app
Expand Down

0 comments on commit c695196

Please sign in to comment.