2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
FactoryBot.define do
|
2020-03-13 15:44:24 +05:30
|
|
|
factory :clusters_applications_helm, class: 'Clusters::Applications::Helm' do
|
2018-03-17 18:26:18 +05:30
|
|
|
cluster factory: %i(cluster provided_by_gcp)
|
|
|
|
|
2021-04-29 21:17:54 +05:30
|
|
|
transient do
|
|
|
|
helm_installed { true }
|
|
|
|
end
|
|
|
|
|
|
|
|
before(:create) do |_record, evaluator|
|
|
|
|
if evaluator.helm_installed
|
|
|
|
allow(Gitlab::Kubernetes::Helm::V2::Certificate).to receive(:generate_root)
|
|
|
|
.and_return(
|
|
|
|
double(
|
|
|
|
key_string: File.read(Rails.root.join('spec/fixtures/clusters/sample_key.key')),
|
|
|
|
cert_string: File.read(Rails.root.join('spec/fixtures/clusters/sample_cert.pem'))
|
|
|
|
)
|
2019-10-12 21:52:04 +05:30
|
|
|
)
|
2021-04-29 21:17:54 +05:30
|
|
|
end
|
2019-10-12 21:52:04 +05:30
|
|
|
end
|
|
|
|
|
2021-04-29 21:17:54 +05:30
|
|
|
after(:create) do |_record, evaluator|
|
|
|
|
if evaluator.helm_installed
|
|
|
|
allow(Gitlab::Kubernetes::Helm::V2::Certificate).to receive(:generate_root).and_call_original
|
|
|
|
end
|
2019-10-12 21:52:04 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
trait :not_installable do
|
2019-12-21 20:55:43 +05:30
|
|
|
status { -2 }
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
|
2019-07-31 22:56:46 +05:30
|
|
|
trait :errored do
|
2019-12-21 20:55:43 +05:30
|
|
|
status { -1 }
|
|
|
|
status_reason { 'something went wrong' }
|
2019-07-31 22:56:46 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
trait :installable do
|
2019-12-21 20:55:43 +05:30
|
|
|
status { 0 }
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
trait :scheduled do
|
2019-12-21 20:55:43 +05:30
|
|
|
status { 1 }
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
trait :installing do
|
2019-12-21 20:55:43 +05:30
|
|
|
status { 2 }
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
trait :installed do
|
2019-12-21 20:55:43 +05:30
|
|
|
status { 3 }
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
|
2018-12-05 23:21:45 +05:30
|
|
|
trait :updating do
|
2019-12-21 20:55:43 +05:30
|
|
|
status { 4 }
|
2018-12-05 23:21:45 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
trait :updated do
|
2019-12-21 20:55:43 +05:30
|
|
|
status { 5 }
|
2018-12-05 23:21:45 +05:30
|
|
|
end
|
|
|
|
|
2019-07-31 22:56:46 +05:30
|
|
|
trait :update_errored do
|
2019-12-21 20:55:43 +05:30
|
|
|
status { 6 }
|
|
|
|
status_reason { 'something went wrong' }
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
|
2019-07-31 22:56:46 +05:30
|
|
|
trait :uninstalling do
|
2019-12-21 20:55:43 +05:30
|
|
|
status { 7 }
|
2019-07-31 22:56:46 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
trait :uninstall_errored do
|
2019-12-21 20:55:43 +05:30
|
|
|
status { 8 }
|
|
|
|
status_reason { 'something went wrong' }
|
2018-12-05 23:21:45 +05:30
|
|
|
end
|
|
|
|
|
2020-05-24 23:13:21 +05:30
|
|
|
trait :uninstalled do
|
|
|
|
status { 10 }
|
|
|
|
end
|
|
|
|
|
2021-04-29 21:17:54 +05:30
|
|
|
trait :externally_installed do
|
|
|
|
status { 11 }
|
|
|
|
end
|
|
|
|
|
2019-07-31 22:56:46 +05:30
|
|
|
trait :timed_out do
|
2018-03-17 18:26:18 +05:30
|
|
|
installing
|
2018-12-05 23:21:45 +05:30
|
|
|
updated_at { ClusterWaitForAppInstallationWorker::TIMEOUT.ago }
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
|
2021-04-29 21:17:54 +05:30
|
|
|
# Common trait used by the apps below
|
|
|
|
trait :no_helm_installed do
|
|
|
|
cluster factory: %i(cluster provided_by_gcp)
|
|
|
|
|
|
|
|
transient do
|
|
|
|
helm_installed { false }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
factory :clusters_applications_ingress, class: 'Clusters::Applications::Ingress' do
|
|
|
|
modsecurity_enabled { false }
|
2018-11-18 11:00:15 +05:30
|
|
|
cluster factory: %i(cluster with_installed_helm provided_by_gcp)
|
2020-04-08 14:13:33 +05:30
|
|
|
|
2020-05-24 23:13:21 +05:30
|
|
|
trait :modsecurity_blocking do
|
|
|
|
modsecurity_enabled { true }
|
|
|
|
modsecurity_mode { :blocking }
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :modsecurity_logging do
|
|
|
|
modsecurity_enabled { true }
|
|
|
|
modsecurity_mode { :logging }
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :modsecurity_disabled do
|
|
|
|
modsecurity_enabled { false }
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :modsecurity_not_installed do
|
|
|
|
modsecurity_enabled { nil }
|
|
|
|
end
|
2018-11-18 11:00:15 +05:30
|
|
|
end
|
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
factory :clusters_applications_cert_manager, class: 'Clusters::Applications::CertManager' do
|
2019-12-21 20:55:43 +05:30
|
|
|
email { 'admin@example.com' }
|
2019-02-15 15:39:39 +05:30
|
|
|
cluster factory: %i(cluster with_installed_helm provided_by_gcp)
|
|
|
|
end
|
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
factory :clusters_applications_elastic_stack, class: 'Clusters::Applications::ElasticStack' do
|
2019-12-26 22:10:19 +05:30
|
|
|
cluster factory: %i(cluster with_installed_helm provided_by_gcp)
|
|
|
|
end
|
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
factory :clusters_applications_crossplane, class: 'Clusters::Applications::Crossplane' do
|
2019-12-26 22:10:19 +05:30
|
|
|
stack { 'gcp' }
|
|
|
|
cluster factory: %i(cluster with_installed_helm provided_by_gcp)
|
|
|
|
end
|
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
factory :clusters_applications_prometheus, class: 'Clusters::Applications::Prometheus' do
|
2018-11-18 11:00:15 +05:30
|
|
|
cluster factory: %i(cluster with_installed_helm provided_by_gcp)
|
|
|
|
end
|
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
factory :clusters_applications_runner, class: 'Clusters::Applications::Runner' do
|
2019-02-15 15:39:39 +05:30
|
|
|
runner factory: %i(ci_runner)
|
2018-11-18 11:00:15 +05:30
|
|
|
cluster factory: %i(cluster with_installed_helm provided_by_gcp)
|
|
|
|
end
|
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
factory :clusters_applications_knative, class: 'Clusters::Applications::Knative' do
|
2019-12-21 20:55:43 +05:30
|
|
|
hostname { 'example.com' }
|
2018-12-13 13:39:08 +05:30
|
|
|
cluster factory: %i(cluster with_installed_helm provided_by_gcp)
|
|
|
|
end
|
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
factory :clusters_applications_jupyter, class: 'Clusters::Applications::Jupyter' do
|
2018-11-08 19:23:39 +05:30
|
|
|
oauth_application factory: :oauth_application
|
2018-12-05 23:21:45 +05:30
|
|
|
cluster factory: %i(cluster with_installed_helm provided_by_gcp project)
|
2018-11-08 19:23:39 +05:30
|
|
|
end
|
2020-04-22 19:07:51 +05:30
|
|
|
|
|
|
|
factory :clusters_applications_fluentd, class: 'Clusters::Applications::Fluentd' do
|
|
|
|
host { 'example.com' }
|
2020-05-24 23:13:21 +05:30
|
|
|
waf_log_enabled { true }
|
|
|
|
cilium_log_enabled { true }
|
2020-04-22 19:07:51 +05:30
|
|
|
cluster factory: %i(cluster with_installed_helm provided_by_gcp)
|
|
|
|
end
|
2020-07-28 23:09:34 +05:30
|
|
|
|
|
|
|
factory :clusters_applications_cilium, class: 'Clusters::Applications::Cilium' do
|
|
|
|
cluster factory: %i(cluster with_installed_helm provided_by_gcp)
|
|
|
|
end
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
end
|