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
path: root/spec
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-10-01 19:00:51 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-10-01 19:00:51 +0300
commitb2e9603724fc002b87cc23926a613b4e7ab10a42 (patch)
tree53b0a2aa2157561545516f0d2baa50de81094fb5 /spec
parenta5131ced0f04bd5e8bc58fc54b60f5e93ed93b4c (diff)
Add latest changes from gitlab-org/gitlab@14-3-stable-ee
Diffstat (limited to 'spec')
-rw-r--r--spec/migrations/20210907211557_finalize_ci_builds_bigint_conversion_spec.rb18
-rw-r--r--spec/support/database/cross-join-allowlist.yml1
-rw-r--r--spec/support/helpers/filtered_search_helpers.rb21
3 files changed, 40 insertions, 0 deletions
diff --git a/spec/migrations/20210907211557_finalize_ci_builds_bigint_conversion_spec.rb b/spec/migrations/20210907211557_finalize_ci_builds_bigint_conversion_spec.rb
new file mode 100644
index 00000000000..362b4be1bc6
--- /dev/null
+++ b/spec/migrations/20210907211557_finalize_ci_builds_bigint_conversion_spec.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+require_migration!('finalize_ci_builds_bigint_conversion')
+
+RSpec.describe FinalizeCiBuildsBigintConversion, :migration, schema: 20210907182359 do
+ context 'with an unexpected FK fk_3f0c88d7dc' do
+ it 'removes the FK and migrates successfully' do
+ # Add the unexpected FK
+ subject.add_foreign_key(:ci_sources_pipelines, :ci_builds, column: :source_job_id, name: 'fk_3f0c88d7dc')
+
+ expect { migrate! }.to change { subject.foreign_key_exists?(:ci_sources_pipelines, :ci_builds, column: :source_job_id, name: 'fk_3f0c88d7dc') }.from(true).to(false)
+
+ # Additional check: The actually expected FK should still exist
+ expect(subject.foreign_key_exists?(:ci_sources_pipelines, :ci_builds, column: :source_job_id, name: 'fk_be5624bf37')).to be_truthy
+ end
+ end
+end
diff --git a/spec/support/database/cross-join-allowlist.yml b/spec/support/database/cross-join-allowlist.yml
index 2b4cfc6773a..45e95cf3262 100644
--- a/spec/support/database/cross-join-allowlist.yml
+++ b/spec/support/database/cross-join-allowlist.yml
@@ -115,6 +115,7 @@
- "./spec/lib/gitlab/background_migration/migrate_legacy_artifacts_spec.rb"
- "./spec/lib/gitlab/prometheus/query_variables_spec.rb"
- "./spec/mailers/emails/pipelines_spec.rb"
+- "./spec/migrations/20210907211557_finalize_ci_builds_bigint_conversion_spec.rb"
- "./spec/migrations/cleanup_legacy_artifact_migration_spec.rb"
- "./spec/migrations/migrate_protected_attribute_to_pending_builds_spec.rb"
- "./spec/migrations/re_schedule_latest_pipeline_id_population_with_all_security_related_artifact_types_spec.rb"
diff --git a/spec/support/helpers/filtered_search_helpers.rb b/spec/support/helpers/filtered_search_helpers.rb
index 10068b9c508..b6cf78b9046 100644
--- a/spec/support/helpers/filtered_search_helpers.rb
+++ b/spec/support/helpers/filtered_search_helpers.rb
@@ -101,6 +101,27 @@ module FilteredSearchHelpers
end
end
+ # Same as `expect_tokens` but works with GlFilteredSearch
+ def expect_vue_tokens(tokens)
+ page.within '.gl-search-box-by-click .gl-filtered-search-scrollable' do
+ token_elements = page.all(:css, '.gl-filtered-search-token')
+
+ tokens.each_with_index do |token, index|
+ el = token_elements[index]
+
+ expect(el.find('.gl-filtered-search-token-type')).to have_content(token[:name])
+ expect(el.find('.gl-filtered-search-token-operator')).to have_content(token[:operator]) if token[:operator].present?
+ expect(el.find('.gl-filtered-search-token-data')).to have_content(token[:value]) if token[:value].present?
+
+ # gl-emoji content is blank when the emoji unicode is not supported
+ if token[:emoji_name].present?
+ selector = %(gl-emoji[data-name="#{token[:emoji_name]}"])
+ expect(el.find('.gl-filtered-search-token-data-content')).to have_css(selector)
+ end
+ end
+ end
+ end
+
def create_token(token_name, token_value = nil, symbol = nil, token_operator = '=')
{ name: token_name, operator: token_operator, value: "#{symbol}#{token_value}" }
end