diff --git a/lib/ably/modules/ably.rb b/lib/ably/modules/ably.rb index 0cb5ef9a..e67f7905 100644 --- a/lib/ably/modules/ably.rb +++ b/lib/ably/modules/ably.rb @@ -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 diff --git a/lib/ably/rest/client.rb b/lib/ably/rest/client.rb index 3dbda2df..d9e162ee 100644 --- a/lib/ably/rest/client.rb +++ b/lib/ably/rest/client.rb @@ -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 diff --git a/spec/acceptance/realtime/connection_failures_spec.rb b/spec/acceptance/realtime/connection_failures_spec.rb index 6afb7616..c34043e0 100644 --- a/spec/acceptance/realtime/connection_failures_spec.rb +++ b/spec/acceptance/realtime/connection_failures_spec.rb @@ -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) } diff --git a/spec/acceptance/rest/auth_spec.rb b/spec/acceptance/rest/auth_spec.rb index ef07af9f..72a46da4 100644 --- a/spec/acceptance/rest/auth_spec.rb +++ b/spec/acceptance/rest/auth_spec.rb @@ -1300,14 +1300,14 @@ def coerce_if_time_value(field_name, value, params = {}) end context 'when the JWT embeds an Ably token' do - let(:token) { Faraday.post(auth_url, { keyName: key_name, keySecret: key_secret, jwtType: :embedded }).body } + let(:token) { Faraday.post(auth_url, { environment: environment, keyName: key_name, keySecret: key_secret, jwtType: :embedded }).body } it 'authenticates correctly using the embedded token' do expect(client.stats).to_not be_nil() end context 'and the requested token is encrypted' do - let(:token) { Faraday.post(auth_url, { keyName: key_name, keySecret: key_secret, jwtType: :embedded, encrypted: 1 }).body } + let(:token) { Faraday.post(auth_url, { environment: environment, keyName: key_name, keySecret: key_secret, jwtType: :embedded, encrypted: 1 }).body } it 'authenticates correctly using the embedded token' do expect(client.stats).to_not be_nil() diff --git a/spec/acceptance/rest/client_spec.rb b/spec/acceptance/rest/client_spec.rb index e1619c6e..1a1b835d 100644 --- a/spec/acceptance/rest/client_spec.rb +++ b/spec/acceptance/rest/client_spec.rb @@ -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') @@ -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 diff --git a/spec/rspec_config.rb b/spec/rspec_config.rb index c299da4a..b3c92ffb 100644 --- a/spec/rspec_config.rb +++ b/spec/rspec_config.rb @@ -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 diff --git a/spec/shared/client_initializer_behaviour.rb b/spec/shared/client_initializer_behaviour.rb index 84ff2df4..bfe64cdf 100644 --- a/spec/shared/client_initializer_behaviour.rb +++ b/spec/shared/client_initializer_behaviour.rb @@ -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 diff --git a/spec/support/test_app.rb b/spec/support/test_app.rb index 2e7fc394..79986d36 100644 --- a/spec/support/test_app.rb +++ b/spec/support/test_app.rb @@ -66,7 +66,7 @@ def delete end def environment - ENV['ABLY_ENV'] || 'sandbox' + ENV['ABLY_ENV'] || 'lmars-dev' end def create_test_app