Repository navigation
fix(redshift): Redshift basic authentication fails relate to use default image user #2119
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
037131c
Reapply "fix(docker): Move all Centos base images to Fedora base images"
hung-nguyen-hoang f1c20d8
fix(redshift): Redshift basic authentication fails relate to use defa…
hung-nguyen-hoang de2fb86
config(lcm): Bump up LCM version to prepare release
hung-nguyen-hoang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1 +1 @@ | ||
| 3.7.109 | ||
| 3.7.111 |
This file contains hidden or 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
70 changes: 70 additions & 0 deletions
70
spec/unit/cloud_resources/redshift/redshift_client_spec.rb
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| # encoding: UTF-8 | ||
|
gd-ladislavandel marked this conversation as resolved.
Resolved
|
||
| # | ||
| # Copyright (c) 2010-2026 GoodData Corporation. All rights reserved. | ||
| # This source code is licensed under the BSD-style license found in the | ||
| # LICENSE file in the root directory of this source tree. | ||
|
|
||
| if RUBY_PLATFORM =~ /java/ | ||
| require 'gooddata/cloud_resources/redshift/redshift_client' | ||
|
|
||
| describe GoodData::CloudResources::RedshiftClient do | ||
| let(:driver) { double('driver') } | ||
| let(:driver_class) { double('driver_class', new: driver) } | ||
| let(:options) do | ||
| { | ||
| 'redshift_client' => { | ||
| 'connection' => { | ||
| 'url' => 'jdbc:redshift://redshift.example.com:5439', | ||
| 'database' => 'db', | ||
| 'authentication' => authentication | ||
| } | ||
| } | ||
| } | ||
| end | ||
|
|
||
| # Driver jars are not on the classpath in unit tests, so stub the Java package chain | ||
| before do | ||
| allow(Java).to receive_message_chain('com.amazon.redshift.jdbc42.Driver').and_return(driver_class) | ||
| end | ||
|
|
||
| subject do | ||
| client = described_class.new(options) | ||
| allow(client).to receive_message_chain('com.amazon.redshift.jdbc42.Driver').and_return(driver_class) | ||
| client | ||
| end | ||
|
|
||
| def connect_properties | ||
| received = nil | ||
| allow(driver).to receive(:connect) { |_url, props| received = props } | ||
| subject.connect | ||
| received | ||
| end | ||
|
|
||
| context 'with basic authentication' do | ||
| let(:authentication) { { 'basic' => { 'userName' => 'basic_user', 'password' => 'secret' } } } | ||
|
|
||
| it 'sets user and password to the configured values' do | ||
| props = connect_properties | ||
| expect(props.getProperty('user')).to eq 'basic_user' | ||
| expect(props.getProperty('UID')).to eq 'basic_user' | ||
| expect(props.getProperty('password')).to eq 'secret' | ||
| expect(props.getProperty('PWD')).to eq 'secret' | ||
| end | ||
| end | ||
|
|
||
| context 'with IAM authentication' do | ||
| let(:authentication) do | ||
| { 'iam' => { 'accessKeyId' => 'key_id', 'secretAccessKey' => 'secret_key', 'dbUser' => 'iam_user' } } | ||
| end | ||
|
|
||
| it 'sets user to the configured dbUser' do | ||
| props = connect_properties | ||
| expect(props.getProperty('user')).to eq 'iam_user' | ||
| expect(props.getProperty('UID')).to eq 'iam_user' | ||
| expect(props.getProperty('DbUser')).to eq 'iam_user' | ||
| expect(props.getProperty('AccessKeyID')).to eq 'key_id' | ||
| expect(props.getProperty('SecretAccessKey')).to eq 'secret_key' | ||
| end | ||
| end | ||
| end | ||
| end | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.