summaryrefslogtreecommitdiff
path: root/spec/factories/clusters
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-16 21:07:22 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-16 21:07:22 +0000
commite924e9e7cb9df21b3bc3d51d5f955da28ba3a225 (patch)
tree598ccb6f09e55ad06e628a90d27628f20ae693fe /spec/factories/clusters
parent8e45d25f7dde6508839ffee719c0ddc2cf6b12d3 (diff)
downloadgitlab-ce-e924e9e7cb9df21b3bc3d51d5f955da28ba3a225.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/factories/clusters')
-rw-r--r--spec/factories/clusters/clusters.rb8
-rw-r--r--spec/factories/clusters/providers/aws.rb38
2 files changed, 46 insertions, 0 deletions
diff --git a/spec/factories/clusters/clusters.rb b/spec/factories/clusters/clusters.rb
index b43a88b39e3..63f33633a3c 100644
--- a/spec/factories/clusters/clusters.rb
+++ b/spec/factories/clusters/clusters.rb
@@ -53,6 +53,14 @@ FactoryBot.define do
platform_kubernetes factory: [:cluster_platform_kubernetes, :configured]
end
+ trait :provided_by_aws do
+ provider_type { :aws }
+ platform_type { :kubernetes }
+
+ provider_aws factory: [:cluster_provider_aws, :created]
+ platform_kubernetes factory: [:cluster_platform_kubernetes, :configured]
+ end
+
trait :providing_by_gcp do
provider_type { :gcp }
provider_gcp factory: [:cluster_provider_gcp, :creating]
diff --git a/spec/factories/clusters/providers/aws.rb b/spec/factories/clusters/providers/aws.rb
new file mode 100644
index 00000000000..f4bc61455c5
--- /dev/null
+++ b/spec/factories/clusters/providers/aws.rb
@@ -0,0 +1,38 @@
+# frozen_string_literal: true
+
+FactoryBot.define do
+ factory :cluster_provider_aws, class: Clusters::Providers::Aws do
+ cluster
+ created_by_user factory: :user
+
+ role_arn { 'arn:aws:iam::123456789012:role/role-name' }
+ vpc_id { 'vpc-00000000000000000' }
+ subnet_ids { %w(subnet-00000000000000000 subnet-11111111111111111) }
+ security_group_id { 'sg-00000000000000000' }
+ key_name { 'user' }
+
+ trait :scheduled do
+ access_key_id { 'access_key_id' }
+ secret_access_key { 'secret_access_key' }
+ session_token { 'session_token' }
+ end
+
+ trait :creating do
+ after(:build) do |provider|
+ provider.make_creating
+ end
+ end
+
+ trait :created do
+ after(:build) do |provider|
+ provider.make_created
+ end
+ end
+
+ trait :errored do
+ after(:build) do |provider|
+ provider.make_errored('An error occurred')
+ end
+ end
+ end
+end