summaryrefslogtreecommitdiff
path: root/spec/features
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-06 12:10:44 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-06 12:10:44 +0000
commitba174c982f40d71a87fd511b091753807174f7e7 (patch)
treeb89d55c715288f2c2f76724c1b7ff4a6ebf90154 /spec/features
parenteaea945e0355826c58c3dcf887496ea91064f85c (diff)
downloadgitlab-ce-ba174c982f40d71a87fd511b091753807174f7e7.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features')
-rw-r--r--spec/features/issues/filtered_search/filter_issues_spec.rb8
-rw-r--r--spec/features/projects/import_export/export_file_spec.rb114
2 files changed, 86 insertions, 36 deletions
diff --git a/spec/features/issues/filtered_search/filter_issues_spec.rb b/spec/features/issues/filtered_search/filter_issues_spec.rb
index 756699fb854..5e2b5921e06 100644
--- a/spec/features/issues/filtered_search/filter_issues_spec.rb
+++ b/spec/features/issues/filtered_search/filter_issues_spec.rb
@@ -224,14 +224,6 @@ describe 'Filter issues', :js do
expect_no_issues_list
expect_filtered_search_input_empty
end
-
- it 'does show issues for bug label' do
- input_filtered_search("label:!=~#{bug_label.title}")
-
- expect_tokens([label_token(bug_label.title)])
- expect_issues_list_count(6)
- expect_filtered_search_input_empty
- end
end
context 'label with multiple words' do
diff --git a/spec/features/projects/import_export/export_file_spec.rb b/spec/features/projects/import_export/export_file_spec.rb
index 54a6ac1551b..1e13afc6033 100644
--- a/spec/features/projects/import_export/export_file_spec.rb
+++ b/spec/features/projects/import_export/export_file_spec.rb
@@ -38,51 +38,109 @@ describe 'Import/Export - project export integration test', :js do
sign_in(user)
end
- it 'exports a project successfully', :sidekiq_might_not_need_inline do
- visit edit_project_path(project)
+ shared_examples 'export file without sensitive words' do
+ it 'exports a project successfully', :sidekiq_inline do
+ export_project_and_download_file(page, project)
- expect(page).to have_content('Export project')
+ in_directory_with_expanded_export(project) do |exit_status, tmpdir|
+ expect(exit_status).to eq(0)
- find(:link, 'Export project').send_keys(:return)
+ project_json_path = File.join(tmpdir, 'project.json')
+ expect(File).to exist(project_json_path)
- visit edit_project_path(project)
+ project_hash = JSON.parse(IO.read(project_json_path))
- expect(page).to have_content('Download export')
+ sensitive_words.each do |sensitive_word|
+ found = find_sensitive_attributes(sensitive_word, project_hash)
- expect(project.export_status).to eq(:finished)
- expect(project.export_file.path).to include('tar.gz')
+ expect(found).to be_nil, failure_message(found.try(:key_found), found.try(:parent), sensitive_word)
+ end
+ end
+ end
+ end
+
+ context "with legacy export" do
+ before do
+ stub_feature_flags(streaming_serializer: false)
+ stub_feature_flags(project_export_as_ndjson: false)
+ end
+
+ it_behaves_like "export file without sensitive words"
+ end
+
+ context "with streaming serializer" do
+ before do
+ stub_feature_flags(streaming_serializer: true)
+ stub_feature_flags(project_export_as_ndjson: false)
+ end
+
+ it_behaves_like "export file without sensitive words"
+ end
- in_directory_with_expanded_export(project) do |exit_status, tmpdir|
- expect(exit_status).to eq(0)
+ context "with ndjson" do
+ before do
+ stub_feature_flags(streaming_serializer: true)
+ stub_feature_flags(project_export_as_ndjson: true)
+ end
+
+ it 'exports a project successfully', :sidekiq_inline do
+ export_project_and_download_file(page, project)
+
+ in_directory_with_expanded_export(project) do |exit_status, tmpdir|
+ expect(exit_status).to eq(0)
- project_json_path = File.join(tmpdir, 'project.json')
- expect(File).to exist(project_json_path)
+ project_json_path = File.join(tmpdir, 'tree', 'project.json')
+ expect(File).to exist(project_json_path)
- project_hash = JSON.parse(IO.read(project_json_path))
+ relations = []
+ relations << JSON.parse(IO.read(project_json_path))
+ Dir.glob(File.join(tmpdir, 'tree/project', '*.ndjson')) do |rb_filename|
+ File.foreach(rb_filename) do |line|
+ json = ActiveSupport::JSON.decode(line)
+ relations << json
+ end
+ end
- sensitive_words.each do |sensitive_word|
- found = find_sensitive_attributes(sensitive_word, project_hash)
+ relations.each do |relation_hash|
+ sensitive_words.each do |sensitive_word|
+ found = find_sensitive_attributes(sensitive_word, relation_hash)
- expect(found).to be_nil, failure_message(found.try(:key_found), found.try(:parent), sensitive_word)
+ expect(found).to be_nil, failure_message(found.try(:key_found), found.try(:parent), sensitive_word)
+ end
+ end
end
end
end
+ end
- def failure_message(key_found, parent, sensitive_word)
- <<-MSG
- Found a new sensitive word <#{key_found}>, which is part of the hash #{parent.inspect}
+ def export_project_and_download_file(page, project)
+ visit edit_project_path(project)
- If you think this information shouldn't get exported, please exclude the model or attribute in IMPORT_EXPORT_CONFIG.
+ expect(page).to have_content('Export project')
- Otherwise, please add the exception to +safe_list+ in CURRENT_SPEC using #{sensitive_word} as the key and the
- correspondent hash or model as the value.
+ find(:link, 'Export project').send_keys(:return)
- Also, if the attribute is a generated unique token, please add it to RelationFactory::TOKEN_RESET_MODELS if it needs to be
- reset (to prevent duplicate column problems while importing to the same instance).
+ visit edit_project_path(project)
- IMPORT_EXPORT_CONFIG: #{Gitlab::ImportExport.config_file}
- CURRENT_SPEC: #{__FILE__}
- MSG
- end
+ expect(page).to have_content('Download export')
+ expect(project.export_status).to eq(:finished)
+ expect(project.export_file.path).to include('tar.gz')
+ end
+
+ def failure_message(key_found, parent, sensitive_word)
+ <<-MSG
+ Found a new sensitive word <#{key_found}>, which is part of the hash #{parent.inspect}
+
+ If you think this information shouldn't get exported, please exclude the model or attribute in IMPORT_EXPORT_CONFIG.
+
+ Otherwise, please add the exception to +safe_list+ in CURRENT_SPEC using #{sensitive_word} as the key and the
+ correspondent hash or model as the value.
+
+ Also, if the attribute is a generated unique token, please add it to RelationFactory::TOKEN_RESET_MODELS if it needs to be
+ reset (to prevent duplicate column problems while importing to the same instance).
+
+ IMPORT_EXPORT_CONFIG: #{Gitlab::ImportExport.config_file}
+ CURRENT_SPEC: #{__FILE__}
+ MSG
end
end