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:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-06-06 22:21:11 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-06-06 22:21:11 +0300
commit36ed05faf48bddd53f54971ec9b0f2c611c958d7 (patch)
treeca8282d1b3cccb89809b7096bd21bffaf26d629c /spec/support
parentda8bd81fe7c1042c50d7c693fdf37ea5b7b78285 (diff)
parent6ac1caa01a4c059f5bcb7c9da2e83001e5469f73 (diff)
Merge commit '6ac1caa01a4c059f5bcb7c9da2e83001e5469f73' into feature/gb/migrate-pipeline-stages
* commit '6ac1caa01a4c059f5bcb7c9da2e83001e5469f73': (76 commits) redesign caching of application settings Fix binary encoding error on MR diffs Fix missing tooltip and ARIA labels for accessibility Add info on using self-signed certs with Registry Actually clean gitlab-test path when TestEnv.set_repo_refs fails Introduce optimistic locking support via optional parameter last_commit_id on File Update API Move issuable bulk edit form into a new sidebar. Add PowerShell to CI variable docs Responsive environment tables Accept a username for User-level Events API Introduce an Events API Update GitLab Pages to v0.4.3 Allow numeric pages domain Remove references to old settings location Resolve "API: Environment info missed" Fix Projects API spec Resolve "When changing project visibility setting, change other dropdowns automatically" Update explanation of job-level variable override to fit example change headings to improve SEO backports changed import logic from pull mirroring feature into CE ...
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/git_http_helpers.rb22
-rw-r--r--spec/support/test_env.rb16
2 files changed, 33 insertions, 5 deletions
diff --git a/spec/support/git_http_helpers.rb b/spec/support/git_http_helpers.rb
index 46b686fce94..b8289e6c5f1 100644
--- a/spec/support/git_http_helpers.rb
+++ b/spec/support/git_http_helpers.rb
@@ -35,9 +35,14 @@ module GitHttpHelpers
yield response
end
+ def download_or_upload(*args, &block)
+ download(*args, &block)
+ upload(*args, &block)
+ end
+
def auth_env(user, password, spnego_request_token)
env = workhorse_internal_api_request_header
- if user && password
+ if user
env['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Basic.encode_credentials(user, password)
elsif spnego_request_token
env['HTTP_AUTHORIZATION'] = "Negotiate #{::Base64.strict_encode64('opaque_request_token')}"
@@ -45,4 +50,19 @@ module GitHttpHelpers
env
end
+
+ def git_access_error(error_key)
+ message = Gitlab::GitAccess::ERROR_MESSAGES[error_key]
+ message || raise("GitAccess error message key '#{error_key}' not found")
+ end
+
+ def git_access_wiki_error(error_key)
+ message = Gitlab::GitAccessWiki::ERROR_MESSAGES[error_key]
+ message || raise("GitAccessWiki error message key '#{error_key}' not found")
+ end
+
+ def change_access_error(error_key)
+ message = Gitlab::Checks::ChangeAccess::ERROR_MESSAGES[error_key]
+ message || raise("ChangeAccess error message key '#{error_key}' not found")
+ end
end
diff --git a/spec/support/test_env.rb b/spec/support/test_env.rb
index 72b3b226c1e..3f472e59c49 100644
--- a/spec/support/test_env.rb
+++ b/spec/support/test_env.rb
@@ -54,6 +54,8 @@ module TestEnv
'conflict-resolvable-fork' => '404fa3f'
}.freeze
+ TMP_TEST_PATH = Rails.root.join('tmp', 'tests', '**')
+
# Test environment
#
# See gitlab.yml.example test section for paths
@@ -98,9 +100,7 @@ module TestEnv
#
# Keeps gitlab-shell and gitlab-test
def clean_test_path
- tmp_test_path = Rails.root.join('tmp', 'tests', '**')
-
- Dir[tmp_test_path].each do |entry|
+ Dir[TMP_TEST_PATH].each do |entry|
unless File.basename(entry) =~ /\A(gitaly|gitlab-(shell|test|test_bare|test-fork|test-fork_bare))\z/
FileUtils.rm_rf(entry)
end
@@ -111,6 +111,14 @@ module TestEnv
FileUtils.mkdir_p(pages_path)
end
+ def clean_gitlab_test_path
+ Dir[TMP_TEST_PATH].each do |entry|
+ if File.basename(entry) =~ /\A(gitlab-(test|test_bare|test-fork|test-fork_bare))\z/
+ FileUtils.rm_rf(entry)
+ end
+ end
+ end
+
def setup_gitlab_shell
unless File.directory?(Gitlab.config.gitlab_shell.path)
unless system('rake', 'gitlab:shell:install')
@@ -249,7 +257,7 @@ module TestEnv
# Before we used Git clone's --mirror option, bare repos could end up
# with missing refs, clearing them and retrying should fix the issue.
- cleanup && init unless reset.call
+ cleanup && clean_gitlab_test_path && init unless reset.call
end
end