diff options
Diffstat (limited to 'spec/factories/clusters/providers')
-rw-r--r-- | spec/factories/clusters/providers/aws.rb | 38 | ||||
-rw-r--r-- | spec/factories/clusters/providers/gcp.rb | 14 |
2 files changed, 47 insertions, 5 deletions
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 diff --git a/spec/factories/clusters/providers/gcp.rb b/spec/factories/clusters/providers/gcp.rb index 22462651b6a..83b65dc8087 100644 --- a/spec/factories/clusters/providers/gcp.rb +++ b/spec/factories/clusters/providers/gcp.rb @@ -3,14 +3,14 @@ FactoryBot.define do factory :cluster_provider_gcp, class: Clusters::Providers::Gcp do cluster - gcp_project_id 'test-gcp-project' + gcp_project_id { 'test-gcp-project' } trait :scheduled do - access_token 'access_token_123' + access_token { 'access_token_123' } end trait :creating do - access_token 'access_token_123' + access_token { 'access_token_123' } after(:build) do |gcp, evaluator| gcp.make_creating('operation-123') @@ -18,7 +18,7 @@ FactoryBot.define do end trait :created do - endpoint '111.111.111.111' + endpoint { '111.111.111.111' } after(:build) do |gcp, evaluator| gcp.make_created @@ -32,7 +32,11 @@ FactoryBot.define do end trait :abac_enabled do - legacy_abac true + legacy_abac { true } + end + + trait :cloud_run_enabled do + cloud_run { true } end end end |