2019-07-25 01:11:48 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-12-13 19:13:44 -05:00
|
|
|
FactoryBot.define do
|
2020-01-09 13:07:52 -05:00
|
|
|
factory :clusters_applications_helm, class: 'Clusters::Applications::Helm' do
|
2017-11-07 05:50:00 -05:00
|
|
|
cluster factory: %i(cluster provided_by_gcp)
|
2017-11-03 14:20:29 -04:00
|
|
|
|
2021-04-12 14:12:15 -04:00
|
|
|
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-07-26 01:40:36 -04:00
|
|
|
)
|
2021-04-12 14:12:15 -04:00
|
|
|
end
|
2019-07-26 01:40:36 -04:00
|
|
|
end
|
|
|
|
|
2021-04-12 14:12:15 -04:00
|
|
|
after(:create) do |_record, evaluator|
|
|
|
|
if evaluator.helm_installed
|
|
|
|
allow(Gitlab::Kubernetes::Helm::V2::Certificate).to receive(:generate_root).and_call_original
|
|
|
|
end
|
2019-07-26 01:40:36 -04:00
|
|
|
end
|
|
|
|
|
2017-11-07 08:52:11 -05:00
|
|
|
trait :not_installable do
|
2019-10-01 20:06:26 -04:00
|
|
|
status { -2 }
|
2017-11-07 08:52:11 -05:00
|
|
|
end
|
|
|
|
|
2019-04-07 21:26:05 -04:00
|
|
|
trait :errored do
|
2019-10-01 20:06:26 -04:00
|
|
|
status { -1 }
|
|
|
|
status_reason { 'something went wrong' }
|
2019-04-07 21:26:05 -04:00
|
|
|
end
|
|
|
|
|
2017-11-03 14:20:29 -04:00
|
|
|
trait :installable do
|
2019-10-01 20:06:26 -04:00
|
|
|
status { 0 }
|
2017-11-03 14:20:29 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
trait :scheduled do
|
2019-10-01 20:06:26 -04:00
|
|
|
status { 1 }
|
2017-11-03 14:20:29 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
trait :installing do
|
2019-10-01 20:06:26 -04:00
|
|
|
status { 2 }
|
2017-11-03 14:20:29 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
trait :installed do
|
2019-10-01 20:06:26 -04:00
|
|
|
status { 3 }
|
2017-11-03 14:20:29 -04:00
|
|
|
end
|
|
|
|
|
2018-09-27 02:15:39 -04:00
|
|
|
trait :updating do
|
2019-10-01 20:06:26 -04:00
|
|
|
status { 4 }
|
2018-09-27 02:15:39 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
trait :updated do
|
2019-10-01 20:06:26 -04:00
|
|
|
status { 5 }
|
2018-09-27 02:15:39 -04:00
|
|
|
end
|
|
|
|
|
2019-04-07 21:26:05 -04:00
|
|
|
trait :update_errored do
|
2019-10-01 20:06:26 -04:00
|
|
|
status { 6 }
|
|
|
|
status_reason { 'something went wrong' }
|
2017-11-03 14:20:29 -04:00
|
|
|
end
|
2017-11-06 04:23:15 -05:00
|
|
|
|
2019-04-07 21:26:05 -04:00
|
|
|
trait :uninstalling do
|
2019-10-01 20:06:26 -04:00
|
|
|
status { 7 }
|
2019-04-07 21:26:05 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
trait :uninstall_errored do
|
2019-10-01 20:06:26 -04:00
|
|
|
status { 8 }
|
|
|
|
status_reason { 'something went wrong' }
|
2018-09-27 02:15:39 -04:00
|
|
|
end
|
|
|
|
|
2020-05-18 08:08:08 -04:00
|
|
|
trait :uninstalled do
|
|
|
|
status { 10 }
|
|
|
|
end
|
|
|
|
|
2021-04-06 20:09:26 -04:00
|
|
|
trait :externally_installed do
|
|
|
|
status { 11 }
|
|
|
|
end
|
|
|
|
|
2019-04-29 01:57:12 -04:00
|
|
|
trait :timed_out do
|
2017-11-06 04:23:15 -05:00
|
|
|
installing
|
2018-09-20 13:02:36 -04:00
|
|
|
updated_at { ClusterWaitForAppInstallationWorker::TIMEOUT.ago }
|
2017-11-06 04:23:15 -05:00
|
|
|
end
|
2017-12-22 12:23:43 -05:00
|
|
|
|
2021-04-12 14:12:15 -04:00
|
|
|
# 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-01-09 13:07:52 -05:00
|
|
|
factory :clusters_applications_ingress, class: 'Clusters::Applications::Ingress' do
|
2018-08-07 08:39:38 -04:00
|
|
|
cluster factory: %i(cluster with_installed_helm provided_by_gcp)
|
|
|
|
end
|
|
|
|
|
2020-01-09 13:07:52 -05:00
|
|
|
factory :clusters_applications_cert_manager, class: 'Clusters::Applications::CertManager' do
|
2019-10-01 20:06:26 -04:00
|
|
|
email { 'admin@example.com' }
|
2018-11-19 15:45:33 -05:00
|
|
|
cluster factory: %i(cluster with_installed_helm provided_by_gcp)
|
|
|
|
end
|
|
|
|
|
2020-01-09 13:07:52 -05:00
|
|
|
factory :clusters_applications_elastic_stack, class: 'Clusters::Applications::ElasticStack' do
|
2019-10-22 11:06:06 -04:00
|
|
|
cluster factory: %i(cluster with_installed_helm provided_by_gcp)
|
|
|
|
end
|
|
|
|
|
2020-01-09 13:07:52 -05:00
|
|
|
factory :clusters_applications_crossplane, class: 'Clusters::Applications::Crossplane' do
|
2019-11-17 22:06:28 -05:00
|
|
|
stack { 'gcp' }
|
|
|
|
cluster factory: %i(cluster with_installed_helm provided_by_gcp)
|
|
|
|
end
|
|
|
|
|
2020-01-09 13:07:52 -05:00
|
|
|
factory :clusters_applications_prometheus, class: 'Clusters::Applications::Prometheus' do
|
2018-08-07 08:39:38 -04:00
|
|
|
cluster factory: %i(cluster with_installed_helm provided_by_gcp)
|
|
|
|
end
|
|
|
|
|
2020-01-09 13:07:52 -05:00
|
|
|
factory :clusters_applications_runner, class: 'Clusters::Applications::Runner' do
|
2018-11-26 15:02:33 -05:00
|
|
|
runner factory: %i(ci_runner)
|
2018-08-07 08:39:38 -04:00
|
|
|
cluster factory: %i(cluster with_installed_helm provided_by_gcp)
|
|
|
|
end
|
|
|
|
|
2020-01-09 13:07:52 -05:00
|
|
|
factory :clusters_applications_knative, class: 'Clusters::Applications::Knative' do
|
2019-10-01 20:06:26 -04:00
|
|
|
hostname { 'example.com' }
|
2018-10-25 01:38:44 -04:00
|
|
|
cluster factory: %i(cluster with_installed_helm provided_by_gcp)
|
|
|
|
end
|
|
|
|
|
2020-01-09 13:07:52 -05:00
|
|
|
factory :clusters_applications_jupyter, class: 'Clusters::Applications::Jupyter' do
|
2018-05-25 10:09:26 -04:00
|
|
|
oauth_application factory: :oauth_application
|
2018-09-13 07:57:41 -04:00
|
|
|
cluster factory: %i(cluster with_installed_helm provided_by_gcp project)
|
2018-05-25 10:09:26 -04:00
|
|
|
end
|
2020-04-15 20:09:22 -04:00
|
|
|
|
2020-07-09 02:09:37 -04:00
|
|
|
factory :clusters_applications_cilium, class: 'Clusters::Applications::Cilium' do
|
|
|
|
cluster factory: %i(cluster with_installed_helm provided_by_gcp)
|
|
|
|
end
|
2017-11-03 14:20:29 -04:00
|
|
|
end
|
|
|
|
end
|