summaryrefslogtreecommitdiff
path: root/spec/models/clusters
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-01 03:06:26 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-01 03:06:26 +0000
commit56d96ad7fab4d4b95f5529d8080b3cc2873794a0 (patch)
tree7fe93fc8ff4d82d815000781ffb9c98d7259211a /spec/models/clusters
parent8078bd185fd9fce86cb5a8d9a6b6209e0c23ae44 (diff)
downloadgitlab-ce-56d96ad7fab4d4b95f5529d8080b3cc2873794a0.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/clusters')
-rw-r--r--spec/models/clusters/providers/aws_spec.rb37
1 files changed, 36 insertions, 1 deletions
diff --git a/spec/models/clusters/providers/aws_spec.rb b/spec/models/clusters/providers/aws_spec.rb
index ec8159a7ee0..95549d015c8 100644
--- a/spec/models/clusters/providers/aws_spec.rb
+++ b/spec/models/clusters/providers/aws_spec.rb
@@ -64,13 +64,48 @@ describe Clusters::Providers::Aws do
before do
expect(provider.access_key_id).to be_present
expect(provider.secret_access_key).to be_present
+ expect(provider.session_token).to be_present
end
- it 'removes access_key_id and secret_access_key' do
+ it 'removes access_key_id, secret_access_key and session_token' do
subject
expect(provider.access_key_id).to be_nil
expect(provider.secret_access_key).to be_nil
+ expect(provider.session_token).to be_nil
end
end
+
+ describe '#api_client' do
+ let(:provider) { create(:cluster_provider_aws) }
+ let(:credentials) { double }
+ let(:client) { double }
+
+ subject { provider.api_client }
+
+ before do
+ allow(provider).to receive(:credentials).and_return(credentials)
+
+ expect(Aws::CloudFormation::Client).to receive(:new)
+ .with(credentials: credentials, region: provider.region)
+ .and_return(client)
+ end
+
+ it { is_expected.to eq client }
+ end
+
+ describe '#credentials' do
+ let(:provider) { create(:cluster_provider_aws) }
+ let(:credentials) { double }
+
+ subject { provider.credentials }
+
+ before do
+ expect(Aws::Credentials).to receive(:new)
+ .with(provider.access_key_id, provider.secret_access_key, provider.session_token)
+ .and_return(credentials)
+ end
+
+ it { is_expected.to eq credentials }
+ end
end