summaryrefslogtreecommitdiff
path: root/spec/migrations
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz@gitlab.com>2019-02-08 07:55:08 +0000
committerGrzegorz Bizon <grzegorz@gitlab.com>2019-02-08 07:55:08 +0000
commit3142d8fc1d6ebd830f5b0bc41155eec30d31829a (patch)
treea8317e9c466fb1d0992791c5b84cb2b851bdad70 /spec/migrations
parent724e904c3d4562bf3f1cee6abae1370e20e5ff58 (diff)
parentb3364566c403b1e7027b1e19d619f5b2f614fcf2 (diff)
downloadgitlab-ce-3142d8fc1d6ebd830f5b0bc41155eec30d31829a.tar.gz
Merge branch '57397-fixes-technical-debt-for-cluster-domain' into 'master'
Fixes technical debt issues for cluster domain Closes #57397 See merge request gitlab-org/gitlab-ce!25010
Diffstat (limited to 'spec/migrations')
-rw-r--r--spec/migrations/migrate_auto_dev_ops_domain_to_cluster_domain_spec.rb16
1 files changed, 12 insertions, 4 deletions
diff --git a/spec/migrations/migrate_auto_dev_ops_domain_to_cluster_domain_spec.rb b/spec/migrations/migrate_auto_dev_ops_domain_to_cluster_domain_spec.rb
index 2ffc0e65fee..b1ff3cfd355 100644
--- a/spec/migrations/migrate_auto_dev_ops_domain_to_cluster_domain_spec.rb
+++ b/spec/migrations/migrate_auto_dev_ops_domain_to_cluster_domain_spec.rb
@@ -55,8 +55,8 @@ describe MigrateAutoDevOpsDomainToClusterDomain, :migration do
expect(clusters_with_domain.count).to eq(20)
project_auto_devops_with_domain.each do |project_auto_devops|
- cluster_project = Clusters::Project.find_by(project_id: project_auto_devops.project_id)
- cluster = Clusters::Cluster.find(cluster_project.cluster_id)
+ cluster_project = find_cluster_project(project_auto_devops.project_id)
+ cluster = find_cluster(cluster_project.cluster_id)
expect(cluster.domain).to be_present
end
@@ -64,8 +64,8 @@ describe MigrateAutoDevOpsDomainToClusterDomain, :migration do
expect(clusters_without_domain.count).to eq(25)
project_auto_devops_without_domain.each do |project_auto_devops|
- cluster_project = Clusters::Project.find_by(project_id: project_auto_devops.project_id)
- cluster = Clusters::Cluster.find(cluster_project.cluster_id)
+ cluster_project = find_cluster_project(project_auto_devops.project_id)
+ cluster = find_cluster(cluster_project.cluster_id)
expect(cluster.domain).not_to be_present
end
@@ -88,6 +88,14 @@ describe MigrateAutoDevOpsDomainToClusterDomain, :migration do
end
end
+ def find_cluster_project(project_id)
+ cluster_projects_table.where(project_id: project_id).first
+ end
+
+ def find_cluster(cluster_id)
+ clusters_table.where(id: cluster_id).first
+ end
+
def project_auto_devops_with_domain
project_auto_devops_table.where.not("domain IS NULL OR domain = ''")
end