diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-03-12 11:03:07 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-03-12 11:03:07 +0200 |
commit | c8a713cbde5c9149539bba51917bd094ef2b5189 (patch) | |
tree | 12bfe1042f16aeaf4f444543e6b239f6d440b183 /spec/gitlab_projects_spec.rb | |
parent | 3df553676aca6f07864c3c7bbd4422e4d70b454c (diff) | |
download | gitlab-shell-c8a713cbde5c9149539bba51917bd094ef2b5189.tar.gz |
Add support for import repo timeout
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'spec/gitlab_projects_spec.rb')
-rw-r--r-- | spec/gitlab_projects_spec.rb | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/spec/gitlab_projects_spec.rb b/spec/gitlab_projects_spec.rb index dbdbfd9..ac0af4f 100644 --- a/spec/gitlab_projects_spec.rb +++ b/spec/gitlab_projects_spec.rb @@ -196,17 +196,38 @@ describe GitlabProjects do end describe :import_project do - let(:gl_projects) { build_gitlab_projects('import-project', repo_name, 'https://github.com/randx/six.git') } + context 'success import' do + let(:gl_projects) { build_gitlab_projects('import-project', repo_name, 'https://github.com/randx/six.git') } - it "should import a repo" do - gl_projects.exec - File.exists?(File.join(tmp_repo_path, 'HEAD')).should be_true + it { gl_projects.exec.should be_true } + + it "should import a repo" do + gl_projects.exec + File.exists?(File.join(tmp_repo_path, 'HEAD')).should be_true + end + + it "should log an import-project event" do + message = "Importing project #{repo_name} from <https://github.com/randx/six.git> to <#{tmp_repo_path}>." + $logger.should_receive(:info).with(message) + gl_projects.exec + end end - it "should log an import-project event" do - message = "Importing project #{repo_name} from <https://github.com/randx/six.git> to <#{tmp_repo_path}>." - $logger.should_receive(:info).with(message) - gl_projects.exec + context 'timeout' do + let(:gl_projects) { build_gitlab_projects('import-project', repo_name, 'https://dev.gitlab.org/samples/private.git', '1') } + + it { gl_projects.exec.should be_false } + + it "should not import a repo" do + gl_projects.exec + File.exists?(File.join(tmp_repo_path, 'HEAD')).should be_false + end + + it "should log an import-project event" do + message = "Importing project #{repo_name} from <https://dev.gitlab.org/samples/private.git> failed due to timeout." + $logger.should_receive(:error).with(message) + gl_projects.exec + end end end |