-
Notifications
You must be signed in to change notification settings - Fork 603
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Client] Fix extracting cloud host when cloud host provides a port
Fixes #1081
- Loading branch information
1 parent
38a0683
commit f988cab
Showing
2 changed files
with
56 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -433,6 +433,51 @@ | |
).to eq('https://elasticfantastic:[email protected]:9243') | ||
end | ||
end | ||
|
||
context 'when the cloud host provides a port' do | ||
let(:client) do | ||
described_class.new( | ||
cloud_id: 'name:ZWxhc3RpY19zZXJ2ZXI6OTI0MyRlbGFzdGljX2lk', | ||
user: 'elastic', | ||
password: 'changeme' | ||
) | ||
end | ||
|
||
let(:hosts) do | ||
client.transport.hosts | ||
end | ||
|
||
it 'creates the correct full url' do | ||
expect(hosts[0][:host]).to eq('elastic_id.elastic_server') | ||
expect(hosts[0][:protocol]).to eq('https') | ||
expect(hosts[0][:user]).to eq('elastic') | ||
expect(hosts[0][:password]).to eq('changeme') | ||
expect(hosts[0][:port]).to eq(9243) | ||
end | ||
end | ||
|
||
context 'when the cloud host provides a port and the port is also specified' do | ||
let(:client) do | ||
described_class.new( | ||
cloud_id: 'name:ZWxhc3RpY19zZXJ2ZXI6OTI0MyRlbGFzdGljX2lk', | ||
user: 'elastic', | ||
password: 'changeme', | ||
port: 9200 | ||
) | ||
end | ||
|
||
let(:hosts) do | ||
client.transport.hosts | ||
end | ||
|
||
it 'creates the correct full url' do | ||
expect(hosts[0][:host]).to eq('elastic_id.elastic_server') | ||
expect(hosts[0][:protocol]).to eq('https') | ||
expect(hosts[0][:user]).to eq('elastic') | ||
expect(hosts[0][:password]).to eq('changeme') | ||
expect(hosts[0][:port]).to eq(9243) | ||
end | ||
end | ||
end | ||
|
||
shared_examples_for 'a client that extracts hosts' do | ||
|