Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP test against the lmars-dev cluster #424

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
4 changes: 2 additions & 2 deletions spec/acceptance/rest/auth_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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()
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
Loading