diff options
author | Robert Speicher <robert@gitlab.com> | 2017-06-06 19:24:13 +0300 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2017-06-06 19:24:13 +0300 |
commit | b9fcc48aef1ea08df98f1955d118f1c1f03dc30c (patch) | |
tree | e7d2b1ab845190e50edc4fce3e61f7f38a775a67 | |
parent | 02a877acc19d821e4ae2a9e81b58c058dd5d2159 (diff) | |
parent | 3cda57b4abee016c35867760ffd07c7b9c93e041 (diff) |
Merge branch 'fix-test_env-set_repo_refs' into 'master'
Actually clean gitlab-test path when TestEnv.set_repo_refs fails
See merge request !11939
-rw-r--r-- | spec/support/test_env.rb | 16 |
1 files changed, 12 insertions, 4 deletions
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 |