diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-08 03:09:31 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-08 03:09:31 +0000 |
commit | e2ee1eec50aa8df8543d7ecc585ec0ba5ee544ac (patch) | |
tree | 7998650d27ada12ee7d06a21cbb3b5e89f298378 /spec/support | |
parent | 060c842402c00f830a810702600cbe39dfa6cf62 (diff) | |
download | gitlab-ce-e2ee1eec50aa8df8543d7ecc585ec0ba5ee544ac.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/helpers/graphql_helpers.rb | 3 | ||||
-rw-r--r-- | spec/support/import_export/common_util.rb | 30 |
2 files changed, 32 insertions, 1 deletions
diff --git a/spec/support/helpers/graphql_helpers.rb b/spec/support/helpers/graphql_helpers.rb index 1bb942ff39b..74582df6cd9 100644 --- a/spec/support/helpers/graphql_helpers.rb +++ b/spec/support/helpers/graphql_helpers.rb @@ -378,8 +378,9 @@ module GraphqlHelpers def execute_query(query_type) schema = Class.new(GraphQL::Schema) do + use GraphQL::Pagination::Connections use Gitlab::Graphql::Authorize - use Gitlab::Graphql::Connections + use Gitlab::Graphql::Pagination::Connections query(query_type) end diff --git a/spec/support/import_export/common_util.rb b/spec/support/import_export/common_util.rb index efe14b7244c..16762f32d8b 100644 --- a/spec/support/import_export/common_util.rb +++ b/spec/support/import_export/common_util.rb @@ -15,9 +15,39 @@ module ImportExport export_path = [prefix, 'spec', 'fixtures', 'lib', 'gitlab', 'import_export', name].compact export_path = File.join(*export_path) + extract_archive(export_path, 'tree.tar.gz') + allow_any_instance_of(Gitlab::ImportExport).to receive(:export_path) { export_path } end + def extract_archive(path, archive) + if File.exist?(File.join(path, archive)) + system("cd #{path}; tar xzvf #{archive} &> /dev/null") + end + end + + def cleanup_artifacts_from_extract_archive(name, prefix = nil) + export_path = [prefix, 'spec', 'fixtures', 'lib', 'gitlab', 'import_export', name].compact + export_path = File.join(*export_path) + + if File.exist?(File.join(export_path, 'tree.tar.gz')) + system("cd #{export_path}; rm -fr tree &> /dev/null") + end + end + + def setup_reader(reader) + case reader + when :legacy_reader + allow_any_instance_of(Gitlab::ImportExport::JSON::LegacyReader::File).to receive(:exist?).and_return(true) + allow_any_instance_of(Gitlab::ImportExport::JSON::NdjsonReader).to receive(:exist?).and_return(false) + when :ndjson_reader + allow_any_instance_of(Gitlab::ImportExport::JSON::LegacyReader::File).to receive(:exist?).and_return(false) + allow_any_instance_of(Gitlab::ImportExport::JSON::NdjsonReader).to receive(:exist?).and_return(true) + else + raise "invalid reader #{reader}. Supported readers: :legacy_reader, :ndjson_reader" + end + end + def fixtures_path "spec/fixtures/lib/gitlab/import_export" end |