Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-10 15:08:59 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-10 15:08:59 +0300
commit7351a484d79236b7e9d47c86f2fcc970b7ae10b0 (patch)
tree651b5fca7ea0460e3ce7c687cfa9e3a3b37eefc8 /spec/models
parentb4ded0ba7b4d2cdbed5b1f331cf2083a25ee4d7c (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/ci/bridge_spec.rb10
-rw-r--r--spec/models/clusters/cluster_spec.rb1
-rw-r--r--spec/models/deployment_cluster_spec.rb22
-rw-r--r--spec/models/deployment_spec.rb1
-rw-r--r--spec/models/project_setting_spec.rb7
-rw-r--r--spec/models/project_spec.rb6
6 files changed, 47 insertions, 0 deletions
diff --git a/spec/models/ci/bridge_spec.rb b/spec/models/ci/bridge_spec.rb
index 43c843b3420..1a97dd60c0e 100644
--- a/spec/models/ci/bridge_spec.rb
+++ b/spec/models/ci/bridge_spec.rb
@@ -53,6 +53,16 @@ describe Ci::Bridge do
end
end
+ describe 'state machine transitions' do
+ context 'when bridge points towards downstream' do
+ it 'schedules downstream pipeline creation' do
+ expect(bridge).to receive(:schedule_downstream_pipeline!)
+
+ bridge.enqueue!
+ end
+ end
+ end
+
describe '#inherit_status_from_downstream!' do
let(:downstream_pipeline) { build(:ci_pipeline, status: downstream_status) }
diff --git a/spec/models/clusters/cluster_spec.rb b/spec/models/clusters/cluster_spec.rb
index 85860da38ad..23592cb0c70 100644
--- a/spec/models/clusters/cluster_spec.rb
+++ b/spec/models/clusters/cluster_spec.rb
@@ -26,6 +26,7 @@ describe Clusters::Cluster, :use_clean_rails_memory_store_caching do
it { is_expected.to have_one(:application_runner) }
it { is_expected.to have_many(:kubernetes_namespaces) }
it { is_expected.to have_one(:cluster_project) }
+ it { is_expected.to have_many(:deployment_clusters) }
it { is_expected.to delegate_method(:status).to(:provider) }
it { is_expected.to delegate_method(:status_reason).to(:provider) }
diff --git a/spec/models/deployment_cluster_spec.rb b/spec/models/deployment_cluster_spec.rb
new file mode 100644
index 00000000000..8bb09e9a510
--- /dev/null
+++ b/spec/models/deployment_cluster_spec.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe DeploymentCluster do
+ let(:cluster) { create(:cluster) }
+ let(:deployment) { create(:deployment) }
+ let(:kubernetes_namespace) { 'an-example-namespace' }
+
+ subject { described_class.new(deployment: deployment, cluster: cluster, kubernetes_namespace: kubernetes_namespace) }
+
+ it { is_expected.to belong_to(:deployment).required }
+ it { is_expected.to belong_to(:cluster).required }
+
+ it do
+ is_expected.to have_attributes(
+ cluster_id: cluster.id,
+ deployment_id: deployment.id,
+ kubernetes_namespace: kubernetes_namespace
+ )
+ end
+end
diff --git a/spec/models/deployment_spec.rb b/spec/models/deployment_spec.rb
index c1beef0b759..bdbe38afc56 100644
--- a/spec/models/deployment_spec.rb
+++ b/spec/models/deployment_spec.rb
@@ -10,6 +10,7 @@ describe Deployment do
it { is_expected.to belong_to(:cluster).class_name('Clusters::Cluster') }
it { is_expected.to belong_to(:user) }
it { is_expected.to belong_to(:deployable) }
+ it { is_expected.to have_one(:deployment_cluster) }
it { is_expected.to have_many(:deployment_merge_requests) }
it { is_expected.to have_many(:merge_requests).through(:deployment_merge_requests) }
diff --git a/spec/models/project_setting_spec.rb b/spec/models/project_setting_spec.rb
new file mode 100644
index 00000000000..5cfb932eb2a
--- /dev/null
+++ b/spec/models/project_setting_spec.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe ProjectSetting, type: :model do
+ it { is_expected.to belong_to(:project) }
+end
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index 924cc7169ea..f847cb63ddc 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -69,6 +69,7 @@ describe Project do
it { is_expected.to have_one(:forked_from_project).through(:fork_network_member) }
it { is_expected.to have_one(:auto_devops).class_name('ProjectAutoDevops') }
it { is_expected.to have_one(:error_tracking_setting).class_name('ErrorTracking::ProjectErrorTrackingSetting') }
+ it { is_expected.to have_one(:project_setting) }
it { is_expected.to have_many(:commit_statuses) }
it { is_expected.to have_many(:ci_pipelines) }
it { is_expected.to have_many(:builds) }
@@ -155,6 +156,11 @@ describe Project do
expect(project.pages_metadatum).to be_an_instance_of(ProjectPagesMetadatum)
expect(project.pages_metadatum).to be_persisted
end
+
+ it 'automatically creates a project setting row' do
+ expect(project.project_setting).to be_an_instance_of(ProjectSetting)
+ expect(project.project_setting).to be_persisted
+ end
end
context 'updating cd_cd_settings' do