summaryrefslogtreecommitdiff
path: root/spec/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-14 12:07:41 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-14 12:07:41 +0000
commit4ce0bee95df15c05cdb0d777eba31fe753bc443b (patch)
tree3dc6a1aae7e0a01280f6d9f7d774dd369f7863e1 /spec/lib
parent02ab65d49fc94be7c91e511899762236c122977d (diff)
downloadgitlab-ce-4ce0bee95df15c05cdb0d777eba31fe753bc443b.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/gitlab/background_migration/activate_prometheus_services_for_shared_cluster_applications_spec.rb75
-rw-r--r--spec/lib/gitlab/ci/pipeline/chain/validate/abilities_spec.rb41
-rw-r--r--spec/lib/gitlab/import_export/all_models.yml27
-rw-r--r--spec/lib/gitlab/import_export/project_tree_restorer_spec.rb8
-rw-r--r--spec/lib/gitlab/import_export/safe_model_attributes.yml30
5 files changed, 61 insertions, 120 deletions
diff --git a/spec/lib/gitlab/background_migration/activate_prometheus_services_for_shared_cluster_applications_spec.rb b/spec/lib/gitlab/background_migration/activate_prometheus_services_for_shared_cluster_applications_spec.rb
deleted file mode 100644
index 9d9281f4e98..00000000000
--- a/spec/lib/gitlab/background_migration/activate_prometheus_services_for_shared_cluster_applications_spec.rb
+++ /dev/null
@@ -1,75 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-describe Gitlab::BackgroundMigration::ActivatePrometheusServicesForSharedClusterApplications, :migration, schema: 2019_12_20_102807 do
- include MigrationHelpers::PrometheusServiceHelpers
-
- let(:namespaces) { table(:namespaces) }
- let(:projects) { table(:projects) }
- let(:services) { table(:services) }
- let(:namespace) { namespaces.create(name: 'user', path: 'user') }
- let(:project) { projects.create(namespace_id: namespace.id) }
-
- let(:columns) do
- %w(project_id active properties type template push_events
- issues_events merge_requests_events tag_push_events
- note_events category default wiki_page_events pipeline_events
- confidential_issues_events commit_events job_events
- confidential_note_events deployment_events)
- end
-
- describe '#perform' do
- it 'is idempotent' do
- expect { subject.perform(project.id) }.to change { services.order(:id).map { |row| row.attributes } }
-
- expect { subject.perform(project.id) }.not_to change { services.order(:id).map { |row| row.attributes } }
- end
-
- context 'non prometheus services' do
- it 'does not change them' do
- other_type = 'SomeOtherService'
- services.create(service_params_for(project.id, active: true, type: other_type))
-
- expect { subject.perform(project.id) }.not_to change { services.where(type: other_type).order(:id).map { |row| row.attributes } }
- end
- end
-
- context 'prometheus services are configured manually ' do
- it 'does not change them' do
- properties = '{"api_url":"http://test.dev","manual_configuration":"1"}'
- services.create(service_params_for(project.id, properties: properties, active: false))
-
- expect { subject.perform(project.id) }.not_to change { services.order(:id).map { |row| row.attributes } }
- end
- end
-
- context 'prometheus integration services do not exist' do
- it 'creates missing services entries' do
- subject.perform(project.id)
-
- rows = services.order(:id).map { |row| row.attributes.slice(*columns).symbolize_keys }
-
- expect([service_params_for(project.id, active: true)]).to eq rows
- end
- end
-
- context 'prometheus integration services exist' do
- context 'in active state' do
- it 'does not change them' do
- services.create(service_params_for(project.id, active: true))
-
- expect { subject.perform(project.id) }.not_to change { services.order(:id).map { |row| row.attributes } }
- end
- end
-
- context 'not in active state' do
- it 'sets active attribute to true' do
- service = services.create(service_params_for(project.id))
-
- expect { subject.perform(project.id) }.to change { service.reload.active? }.from(false).to(true)
- end
- end
- end
- end
-end
diff --git a/spec/lib/gitlab/ci/pipeline/chain/validate/abilities_spec.rb b/spec/lib/gitlab/ci/pipeline/chain/validate/abilities_spec.rb
index ac370433955..24d3beb35b9 100644
--- a/spec/lib/gitlab/ci/pipeline/chain/validate/abilities_spec.rb
+++ b/spec/lib/gitlab/ci/pipeline/chain/validate/abilities_spec.rb
@@ -76,45 +76,8 @@ describe Gitlab::Ci::Pipeline::Chain::Validate::Abilities do
end
end
- context 'when pipeline triggered by legacy trigger' do
- let(:user) { nil }
- let(:trigger_request) do
- build_stubbed(:ci_trigger_request, trigger: build_stubbed(:ci_trigger, owner: nil))
- end
-
- context 'when :use_legacy_pipeline_triggers feature flag is enabled' do
- before do
- stub_feature_flags(use_legacy_pipeline_triggers: true)
- step.perform!
- end
-
- it 'allows legacy triggers to create a pipeline' do
- expect(pipeline).to be_valid
- end
-
- it 'does not break the chain' do
- expect(step.break?).to eq false
- end
- end
-
- context 'when :use_legacy_pipeline_triggers feature flag is disabled' do
- before do
- stub_feature_flags(use_legacy_pipeline_triggers: false)
- step.perform!
- end
-
- it 'prevents legacy triggers from creating a pipeline' do
- expect(pipeline.errors.to_a).to include /Trigger token is invalid/
- end
-
- it 'breaks the pipeline builder chain' do
- expect(step.break?).to eq true
- end
- end
- end
-
- describe '#allowed_to_create?' do
- subject { step.allowed_to_create? }
+ describe '#allowed_to_write_ref?' do
+ subject { step.send(:allowed_to_write_ref?) }
context 'when user is a developer' do
before do
diff --git a/spec/lib/gitlab/import_export/all_models.yml b/spec/lib/gitlab/import_export/all_models.yml
index 07439880beb..ee4db935b58 100644
--- a/spec/lib/gitlab/import_export/all_models.yml
+++ b/spec/lib/gitlab/import_export/all_models.yml
@@ -578,3 +578,30 @@ zoom_meetings:
sentry_issue:
- issue
design_versions: *version
+epic:
+- subscriptions
+- award_emoji
+- description_versions
+- author
+- assignee
+- issues
+- epic_issues
+- milestone
+- notes
+- label_links
+- labels
+- todos
+- metrics
+- group
+- parent
+- children
+- updated_by
+- last_edited_by
+- closed_by
+- start_date_sourcing_milestone
+- due_date_sourcing_milestone
+- start_date_sourcing_epic
+- due_date_sourcing_epic
+- events
+- resource_label_events
+- user_mentions \ No newline at end of file
diff --git a/spec/lib/gitlab/import_export/project_tree_restorer_spec.rb b/spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
index 4d12d05211b..56426bb8110 100644
--- a/spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
+++ b/spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
@@ -36,10 +36,6 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
end
context 'JSON' do
- before do
- stub_feature_flags(use_legacy_pipeline_triggers: false)
- end
-
it 'restores models based on JSON' do
expect(@restored_project_json).to be_truthy
end
@@ -502,7 +498,7 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
end
it_behaves_like 'restores project successfully',
- issues: 2,
+ issues: 3,
labels: 2,
label_with_priorities: 'A project label',
milestones: 2,
@@ -515,7 +511,7 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
it 'restores issue states' do
expect(project.issues.with_state(:closed).count).to eq(1)
- expect(project.issues.with_state(:opened).count).to eq(1)
+ expect(project.issues.with_state(:opened).count).to eq(2)
end
end
diff --git a/spec/lib/gitlab/import_export/safe_model_attributes.yml b/spec/lib/gitlab/import_export/safe_model_attributes.yml
index e5014eeca09..c921e7cadde 100644
--- a/spec/lib/gitlab/import_export/safe_model_attributes.yml
+++ b/spec/lib/gitlab/import_export/safe_model_attributes.yml
@@ -766,3 +766,33 @@ ContainerExpirationPolicy:
- older_than
- keep_n
- enabled
+Epic:
+ - id
+ - milestone_id
+ - group_id
+ - author_id
+ - assignee_id
+ - iid
+ - updated_by_id
+ - last_edited_by_id
+ - lock_version
+ - start_date
+ - end_date
+ - last_edited_at
+ - created_at
+ - updated_at
+ - title
+ - description
+ - start_date_sourcing_milestone_id
+ - due_date_sourcing_milestone_id
+ - start_date_fixed
+ - due_date_fixed
+ - start_date_is_fixed
+ - due_date_is_fixed
+ - closed_by_id
+ - closed_at
+ - parent_id
+ - relative_position
+ - state_id
+ - start_date_sourcing_epic_id
+ - due_date_sourcing_epic_id