Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
717fdd6d
Commit
717fdd6d
authored
Jun 03, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename Ci::Build commit to pipeline
parent
b2acebb4
Changes
24
Show whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
100 additions
and
100 deletions
+100
-100
features/steps/project/commits/commits.rb
features/steps/project/commits/commits.rb
+1
-1
features/steps/project/merge_requests.rb
features/steps/project/merge_requests.rb
+1
-1
features/steps/shared/builds.rb
features/steps/shared/builds.rb
+1
-1
spec/factories/ci/builds.rb
spec/factories/ci/builds.rb
+1
-1
spec/factories/commit_statuses.rb
spec/factories/commit_statuses.rb
+1
-1
spec/features/admin/admin_builds_spec.rb
spec/features/admin/admin_builds_spec.rb
+12
-12
spec/features/admin/admin_runners_spec.rb
spec/features/admin/admin_runners_spec.rb
+1
-1
spec/features/builds_spec.rb
spec/features/builds_spec.rb
+1
-1
spec/features/commits_spec.rb
spec/features/commits_spec.rb
+2
-2
spec/features/merge_requests/merge_when_build_succeeds_spec.rb
...features/merge_requests/merge_when_build_succeeds_spec.rb
+2
-2
spec/features/pipelines_spec.rb
spec/features/pipelines_spec.rb
+10
-10
spec/features/security/project/public_access_spec.rb
spec/features/security/project/public_access_spec.rb
+1
-1
spec/lib/ci/charts_spec.rb
spec/lib/ci/charts_spec.rb
+1
-1
spec/lib/gitlab/badge/build_spec.rb
spec/lib/gitlab/badge/build_spec.rb
+1
-1
spec/models/build_spec.rb
spec/models/build_spec.rb
+9
-9
spec/models/ci/commit_spec.rb
spec/models/ci/commit_spec.rb
+21
-21
spec/models/commit_status_spec.rb
spec/models/commit_status_spec.rb
+15
-15
spec/models/generic_commit_status_spec.rb
spec/models/generic_commit_status_spec.rb
+1
-1
spec/requests/api/builds_spec.rb
spec/requests/api/builds_spec.rb
+6
-6
spec/requests/api/commit_statuses_spec.rb
spec/requests/api/commit_statuses_spec.rb
+2
-2
spec/requests/ci/api/builds_spec.rb
spec/requests/ci/api/builds_spec.rb
+6
-6
spec/services/ci/image_for_build_service_spec.rb
spec/services/ci/image_for_build_service_spec.rb
+1
-1
spec/services/ci/register_build_service_spec.rb
spec/services/ci/register_build_service_spec.rb
+1
-1
spec/services/merge_requests/add_todo_when_build_fails_service_spec.rb
.../merge_requests/add_todo_when_build_fails_service_spec.rb
+2
-2
No files found.
features/steps/project/commits/commits.rb
View file @
717fdd6d
...
@@ -165,7 +165,7 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps
...
@@ -165,7 +165,7 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps
step
'commit has ci status'
do
step
'commit has ci status'
do
@project
.
enable_ci
@project
.
enable_ci
ci_commit
=
create
:ci_commit
,
project:
@project
,
sha:
sample_commit
.
id
ci_commit
=
create
:ci_commit
,
project:
@project
,
sha:
sample_commit
.
id
create
:ci_build
,
commit
:
ci_commit
create
:ci_build
,
pipeline
:
ci_commit
end
end
step
'repository contains ".gitlab-ci.yml" file'
do
step
'repository contains ".gitlab-ci.yml" file'
do
...
...
features/steps/project/merge_requests.rb
View file @
717fdd6d
...
@@ -520,7 +520,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
...
@@ -520,7 +520,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
project
=
merge_request
.
source_project
project
=
merge_request
.
source_project
project
.
enable_ci
project
.
enable_ci
ci_commit
=
create
:ci_commit
,
project:
project
,
sha:
merge_request
.
last_commit
.
id
,
ref:
merge_request
.
source_branch
ci_commit
=
create
:ci_commit
,
project:
project
,
sha:
merge_request
.
last_commit
.
id
,
ref:
merge_request
.
source_branch
create
:ci_build
,
commit
:
ci_commit
create
:ci_build
,
pipeline
:
ci_commit
end
end
step
'I should see merge request "Bug NS-05" with CI status'
do
step
'I should see merge request "Bug NS-05" with CI status'
do
...
...
features/steps/shared/builds.rb
View file @
717fdd6d
...
@@ -23,7 +23,7 @@ module SharedBuilds
...
@@ -23,7 +23,7 @@ module SharedBuilds
end
end
step
'project has another build that is running'
do
step
'project has another build that is running'
do
create
(
:ci_build
,
commit
:
@ci_commit
,
name:
'second build'
,
status:
'running'
)
create
(
:ci_build
,
pipeline
:
@ci_commit
,
name:
'second build'
,
status:
'running'
)
end
end
step
'I visit recent build details page'
do
step
'I visit recent build details page'
do
...
...
spec/factories/ci/builds.rb
View file @
717fdd6d
...
@@ -16,7 +16,7 @@ FactoryGirl.define do
...
@@ -16,7 +16,7 @@ FactoryGirl.define do
}
}
end
end
commit
factory: :ci_commit
pipeline
factory: :ci_commit
trait
:success
do
trait
:success
do
status
'success'
status
'success'
...
...
spec/factories/commit_statuses.rb
View file @
717fdd6d
...
@@ -3,7 +3,7 @@ FactoryGirl.define do
...
@@ -3,7 +3,7 @@ FactoryGirl.define do
name
'default'
name
'default'
status
'success'
status
'success'
description
'commit status'
description
'commit status'
commit
factory: :ci_commit_with_one_job
pipeline
factory: :ci_commit_with_one_job
started_at
'Tue, 26 Jan 2016 08:21:42 +0100'
started_at
'Tue, 26 Jan 2016 08:21:42 +0100'
finished_at
'Tue, 26 Jan 2016 08:23:42 +0100'
finished_at
'Tue, 26 Jan 2016 08:23:42 +0100'
...
...
spec/features/admin/admin_builds_spec.rb
View file @
717fdd6d
...
@@ -11,10 +11,10 @@ describe 'Admin Builds' do
...
@@ -11,10 +11,10 @@ describe 'Admin Builds' do
context
'All tab'
do
context
'All tab'
do
context
'when have builds'
do
context
'when have builds'
do
it
'shows all builds'
do
it
'shows all builds'
do
create
(
:ci_build
,
commit
:
commit
,
status: :pending
)
create
(
:ci_build
,
pipeline
:
commit
,
status: :pending
)
create
(
:ci_build
,
commit
:
commit
,
status: :running
)
create
(
:ci_build
,
pipeline
:
commit
,
status: :running
)
create
(
:ci_build
,
commit
:
commit
,
status: :success
)
create
(
:ci_build
,
pipeline
:
commit
,
status: :success
)
create
(
:ci_build
,
commit
:
commit
,
status: :failed
)
create
(
:ci_build
,
pipeline
:
commit
,
status: :failed
)
visit
admin_builds_path
visit
admin_builds_path
...
@@ -39,9 +39,9 @@ describe 'Admin Builds' do
...
@@ -39,9 +39,9 @@ describe 'Admin Builds' do
context
'Running tab'
do
context
'Running tab'
do
context
'when have running builds'
do
context
'when have running builds'
do
it
'shows running builds'
do
it
'shows running builds'
do
build1
=
create
(
:ci_build
,
commit
:
commit
,
status: :pending
)
build1
=
create
(
:ci_build
,
pipeline
:
commit
,
status: :pending
)
build2
=
create
(
:ci_build
,
commit
:
commit
,
status: :success
)
build2
=
create
(
:ci_build
,
pipeline
:
commit
,
status: :success
)
build3
=
create
(
:ci_build
,
commit
:
commit
,
status: :failed
)
build3
=
create
(
:ci_build
,
pipeline
:
commit
,
status: :failed
)
visit
admin_builds_path
(
scope: :running
)
visit
admin_builds_path
(
scope: :running
)
...
@@ -55,7 +55,7 @@ describe 'Admin Builds' do
...
@@ -55,7 +55,7 @@ describe 'Admin Builds' do
context
'when have no builds running'
do
context
'when have no builds running'
do
it
'shows a message'
do
it
'shows a message'
do
create
(
:ci_build
,
commit
:
commit
,
status: :success
)
create
(
:ci_build
,
pipeline
:
commit
,
status: :success
)
visit
admin_builds_path
(
scope: :running
)
visit
admin_builds_path
(
scope: :running
)
...
@@ -69,9 +69,9 @@ describe 'Admin Builds' do
...
@@ -69,9 +69,9 @@ describe 'Admin Builds' do
context
'Finished tab'
do
context
'Finished tab'
do
context
'when have finished builds'
do
context
'when have finished builds'
do
it
'shows finished builds'
do
it
'shows finished builds'
do
build1
=
create
(
:ci_build
,
commit
:
commit
,
status: :pending
)
build1
=
create
(
:ci_build
,
pipeline
:
commit
,
status: :pending
)
build2
=
create
(
:ci_build
,
commit
:
commit
,
status: :running
)
build2
=
create
(
:ci_build
,
pipeline
:
commit
,
status: :running
)
build3
=
create
(
:ci_build
,
commit
:
commit
,
status: :success
)
build3
=
create
(
:ci_build
,
pipeline
:
commit
,
status: :success
)
visit
admin_builds_path
(
scope: :finished
)
visit
admin_builds_path
(
scope: :finished
)
...
@@ -85,7 +85,7 @@ describe 'Admin Builds' do
...
@@ -85,7 +85,7 @@ describe 'Admin Builds' do
context
'when have no builds finished'
do
context
'when have no builds finished'
do
it
'shows a message'
do
it
'shows a message'
do
create
(
:ci_build
,
commit
:
commit
,
status: :running
)
create
(
:ci_build
,
pipeline
:
commit
,
status: :running
)
visit
admin_builds_path
(
scope: :finished
)
visit
admin_builds_path
(
scope: :finished
)
...
...
spec/features/admin/admin_runners_spec.rb
View file @
717fdd6d
...
@@ -9,7 +9,7 @@ describe "Admin Runners" do
...
@@ -9,7 +9,7 @@ describe "Admin Runners" do
before
do
before
do
runner
=
FactoryGirl
.
create
(
:ci_runner
)
runner
=
FactoryGirl
.
create
(
:ci_runner
)
commit
=
FactoryGirl
.
create
(
:ci_commit
)
commit
=
FactoryGirl
.
create
(
:ci_commit
)
FactoryGirl
.
create
(
:ci_build
,
commit
:
commit
,
runner_id:
runner
.
id
)
FactoryGirl
.
create
(
:ci_build
,
pipeline
:
commit
,
runner_id:
runner
.
id
)
visit
admin_runners_path
visit
admin_runners_path
end
end
...
...
spec/features/builds_spec.rb
View file @
717fdd6d
...
@@ -6,7 +6,7 @@ describe "Builds" do
...
@@ -6,7 +6,7 @@ describe "Builds" do
before
do
before
do
login_as
(
:user
)
login_as
(
:user
)
@commit
=
FactoryGirl
.
create
:ci_commit
@commit
=
FactoryGirl
.
create
:ci_commit
@build
=
FactoryGirl
.
create
:ci_build
,
commit
:
@commit
@build
=
FactoryGirl
.
create
:ci_build
,
pipeline
:
@commit
@project
=
@commit
.
project
@project
=
@commit
.
project
@project
.
team
<<
[
@user
,
:developer
]
@project
.
team
<<
[
@user
,
:developer
]
end
end
...
...
spec/features/commits_spec.rb
View file @
717fdd6d
...
@@ -16,7 +16,7 @@ describe 'Commits' do
...
@@ -16,7 +16,7 @@ describe 'Commits' do
end
end
context
'commit status is Generic Commit Status'
do
context
'commit status is Generic Commit Status'
do
let!
(
:status
)
{
FactoryGirl
.
create
:generic_commit_status
,
commit
:
commit
}
let!
(
:status
)
{
FactoryGirl
.
create
:generic_commit_status
,
pipeline
:
commit
}
before
do
before
do
project
.
team
<<
[
@user
,
:reporter
]
project
.
team
<<
[
@user
,
:reporter
]
...
@@ -39,7 +39,7 @@ describe 'Commits' do
...
@@ -39,7 +39,7 @@ describe 'Commits' do
end
end
context
'commit status is Ci Build'
do
context
'commit status is Ci Build'
do
let!
(
:build
)
{
FactoryGirl
.
create
:ci_build
,
commit
:
commit
}
let!
(
:build
)
{
FactoryGirl
.
create
:ci_build
,
pipeline
:
commit
}
let
(
:artifacts_file
)
{
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/banana_sample.gif'
,
'image/gif'
)
}
let
(
:artifacts_file
)
{
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/banana_sample.gif'
,
'image/gif'
)
}
context
'when logged as developer'
do
context
'when logged as developer'
do
...
...
spec/features/merge_requests/merge_when_build_succeeds_spec.rb
View file @
717fdd6d
...
@@ -13,7 +13,7 @@ feature 'Merge When Build Succeeds', feature: true, js: true do
...
@@ -13,7 +13,7 @@ feature 'Merge When Build Succeeds', feature: true, js: true do
context
"Active build for Merge Request"
do
context
"Active build for Merge Request"
do
let!
(
:ci_commit
)
{
create
(
:ci_commit
,
project:
project
,
sha:
merge_request
.
last_commit
.
id
,
ref:
merge_request
.
source_branch
)
}
let!
(
:ci_commit
)
{
create
(
:ci_commit
,
project:
project
,
sha:
merge_request
.
last_commit
.
id
,
ref:
merge_request
.
source_branch
)
}
let!
(
:ci_build
)
{
create
(
:ci_build
,
commit
:
ci_commit
)
}
let!
(
:ci_build
)
{
create
(
:ci_build
,
pipeline
:
ci_commit
)
}
before
do
before
do
login_as
user
login_as
user
...
@@ -48,7 +48,7 @@ feature 'Merge When Build Succeeds', feature: true, js: true do
...
@@ -48,7 +48,7 @@ feature 'Merge When Build Succeeds', feature: true, js: true do
end
end
let!
(
:ci_commit
)
{
create
(
:ci_commit
,
project:
project
,
sha:
merge_request
.
last_commit
.
id
,
ref:
merge_request
.
source_branch
)
}
let!
(
:ci_commit
)
{
create
(
:ci_commit
,
project:
project
,
sha:
merge_request
.
last_commit
.
id
,
ref:
merge_request
.
source_branch
)
}
let!
(
:ci_build
)
{
create
(
:ci_build
,
commit
:
ci_commit
)
}
let!
(
:ci_build
)
{
create
(
:ci_build
,
pipeline
:
ci_commit
)
}
before
do
before
do
login_as
user
login_as
user
...
...
spec/features/pipelines_spec.rb
View file @
717fdd6d
...
@@ -31,7 +31,7 @@ describe "Pipelines" do
...
@@ -31,7 +31,7 @@ describe "Pipelines" do
end
end
context
'cancelable pipeline'
do
context
'cancelable pipeline'
do
let!
(
:running
)
{
create
(
:ci_build
,
:running
,
commit
:
pipeline
,
stage:
'test'
,
commands:
'test'
)
}
let!
(
:running
)
{
create
(
:ci_build
,
:running
,
pipeline
:
pipeline
,
stage:
'test'
,
commands:
'test'
)
}
before
{
visit
namespace_project_pipelines_path
(
project
.
namespace
,
project
)
}
before
{
visit
namespace_project_pipelines_path
(
project
.
namespace
,
project
)
}
...
@@ -47,7 +47,7 @@ describe "Pipelines" do
...
@@ -47,7 +47,7 @@ describe "Pipelines" do
end
end
context
'retryable pipelines'
do
context
'retryable pipelines'
do
let!
(
:failed
)
{
create
(
:ci_build
,
:failed
,
commit
:
pipeline
,
stage:
'test'
,
commands:
'test'
)
}
let!
(
:failed
)
{
create
(
:ci_build
,
:failed
,
pipeline
:
pipeline
,
stage:
'test'
,
commands:
'test'
)
}
before
{
visit
namespace_project_pipelines_path
(
project
.
namespace
,
project
)
}
before
{
visit
namespace_project_pipelines_path
(
project
.
namespace
,
project
)
}
...
@@ -64,7 +64,7 @@ describe "Pipelines" do
...
@@ -64,7 +64,7 @@ describe "Pipelines" do
context
'for generic statuses'
do
context
'for generic statuses'
do
context
'when running'
do
context
'when running'
do
let!
(
:running
)
{
create
(
:generic_commit_status
,
status:
'running'
,
commit
:
pipeline
,
stage:
'test'
)
}
let!
(
:running
)
{
create
(
:generic_commit_status
,
status:
'running'
,
pipeline
:
pipeline
,
stage:
'test'
)
}
before
{
visit
namespace_project_pipelines_path
(
project
.
namespace
,
project
)
}
before
{
visit
namespace_project_pipelines_path
(
project
.
namespace
,
project
)
}
...
@@ -78,7 +78,7 @@ describe "Pipelines" do
...
@@ -78,7 +78,7 @@ describe "Pipelines" do
end
end
context
'when failed'
do
context
'when failed'
do
let!
(
:running
)
{
create
(
:generic_commit_status
,
status:
'failed'
,
commit
:
pipeline
,
stage:
'test'
)
}
let!
(
:running
)
{
create
(
:generic_commit_status
,
status:
'failed'
,
pipeline
:
pipeline
,
stage:
'test'
)
}
before
{
visit
namespace_project_pipelines_path
(
project
.
namespace
,
project
)
}
before
{
visit
namespace_project_pipelines_path
(
project
.
namespace
,
project
)
}
...
@@ -94,7 +94,7 @@ describe "Pipelines" do
...
@@ -94,7 +94,7 @@ describe "Pipelines" do
context
'downloadable pipelines'
do
context
'downloadable pipelines'
do
context
'with artifacts'
do
context
'with artifacts'
do
let!
(
:with_artifacts
)
{
create
(
:ci_build
,
:artifacts
,
:success
,
commit
:
pipeline
,
name:
'rspec tests'
,
stage:
'test'
)
}
let!
(
:with_artifacts
)
{
create
(
:ci_build
,
:artifacts
,
:success
,
pipeline
:
pipeline
,
name:
'rspec tests'
,
stage:
'test'
)
}
before
{
visit
namespace_project_pipelines_path
(
project
.
namespace
,
project
)
}
before
{
visit
namespace_project_pipelines_path
(
project
.
namespace
,
project
)
}
...
@@ -103,7 +103,7 @@ describe "Pipelines" do
...
@@ -103,7 +103,7 @@ describe "Pipelines" do
end
end
context
'without artifacts'
do
context
'without artifacts'
do
let!
(
:without_artifacts
)
{
create
(
:ci_build
,
:success
,
commit
:
pipeline
,
name:
'rspec'
,
stage:
'test'
)
}
let!
(
:without_artifacts
)
{
create
(
:ci_build
,
:success
,
pipeline
:
pipeline
,
name:
'rspec'
,
stage:
'test'
)
}
it
{
expect
(
page
).
not_to
have_selector
(
'.build-artifacts'
)
}
it
{
expect
(
page
).
not_to
have_selector
(
'.build-artifacts'
)
}
end
end
...
@@ -114,10 +114,10 @@ describe "Pipelines" do
...
@@ -114,10 +114,10 @@ describe "Pipelines" do
let
(
:pipeline
)
{
create
(
:ci_commit
,
project:
project
,
ref:
'master'
)
}
let
(
:pipeline
)
{
create
(
:ci_commit
,
project:
project
,
ref:
'master'
)
}
before
do
before
do
@success
=
create
(
:ci_build
,
:success
,
commit
:
pipeline
,
stage:
'build'
,
name:
'build'
)
@success
=
create
(
:ci_build
,
:success
,
pipeline
:
pipeline
,
stage:
'build'
,
name:
'build'
)
@failed
=
create
(
:ci_build
,
:failed
,
commit
:
pipeline
,
stage:
'test'
,
name:
'test'
,
commands:
'test'
)
@failed
=
create
(
:ci_build
,
:failed
,
pipeline
:
pipeline
,
stage:
'test'
,
name:
'test'
,
commands:
'test'
)
@running
=
create
(
:ci_build
,
:running
,
commit
:
pipeline
,
stage:
'deploy'
,
name:
'deploy'
)
@running
=
create
(
:ci_build
,
:running
,
pipeline
:
pipeline
,
stage:
'deploy'
,
name:
'deploy'
)
@external
=
create
(
:generic_commit_status
,
status:
'success'
,
commit
:
pipeline
,
name:
'jenkins'
,
stage:
'external'
)
@external
=
create
(
:generic_commit_status
,
status:
'success'
,
pipeline
:
pipeline
,
name:
'jenkins'
,
stage:
'external'
)
end
end
before
{
visit
namespace_project_pipeline_path
(
project
.
namespace
,
project
,
pipeline
)
}
before
{
visit
namespace_project_pipeline_path
(
project
.
namespace
,
project
,
pipeline
)
}
...
...
spec/features/security/project/public_access_spec.rb
View file @
717fdd6d
...
@@ -143,7 +143,7 @@ describe "Public Project Access", feature: true do
...
@@ -143,7 +143,7 @@ describe "Public Project Access", feature: true do
describe
"GET /:project_path/builds/:id"
do
describe
"GET /:project_path/builds/:id"
do
let
(
:commit
)
{
create
(
:ci_commit
,
project:
project
)
}
let
(
:commit
)
{
create
(
:ci_commit
,
project:
project
)
}
let
(
:build
)
{
create
(
:ci_build
,
commit
:
commit
)
}
let
(
:build
)
{
create
(
:ci_build
,
pipeline
:
commit
)
}
subject
{
namespace_project_build_path
(
project
.
namespace
,
project
,
build
.
id
)
}
subject
{
namespace_project_build_path
(
project
.
namespace
,
project
,
build
.
id
)
}
context
"when allowed for public"
do
context
"when allowed for public"
do
...
...
spec/lib/ci/charts_spec.rb
View file @
717fdd6d
...
@@ -5,7 +5,7 @@ describe Ci::Charts, lib: true do
...
@@ -5,7 +5,7 @@ describe Ci::Charts, lib: true do
context
"build_times"
do
context
"build_times"
do
before
do
before
do
@commit
=
FactoryGirl
.
create
(
:ci_commit
)
@commit
=
FactoryGirl
.
create
(
:ci_commit
)
FactoryGirl
.
create
(
:ci_build
,
commit
:
@commit
)
FactoryGirl
.
create
(
:ci_build
,
pipeline
:
@commit
)
end
end
it
'should return build times in minutes'
do
it
'should return build times in minutes'
do
...
...
spec/lib/gitlab/badge/build_spec.rb
View file @
717fdd6d
...
@@ -43,7 +43,7 @@ describe Gitlab::Badge::Build do
...
@@ -43,7 +43,7 @@ describe Gitlab::Badge::Build do
context
'build exists'
do
context
'build exists'
do
let
(
:ci_commit
)
{
create
(
:ci_commit
,
project:
project
,
sha:
sha
,
ref:
branch
)
}
let
(
:ci_commit
)
{
create
(
:ci_commit
,
project:
project
,
sha:
sha
,
ref:
branch
)
}
let!
(
:build
)
{
create
(
:ci_build
,
commit
:
ci_commit
)
}
let!
(
:build
)
{
create
(
:ci_build
,
pipeline
:
ci_commit
)
}
context
'build success'
do
context
'build success'
do
...
...
spec/models/build_spec.rb
View file @
717fdd6d
...
@@ -3,15 +3,15 @@ require 'spec_helper'
...
@@ -3,15 +3,15 @@ require 'spec_helper'
describe
Ci
::
Build
,
models:
true
do
describe
Ci
::
Build
,
models:
true
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:commit
)
{
create
(
:ci_commit
,
project:
project
)
}
let
(
:commit
)
{
create
(
:ci_commit
,
project:
project
)
}
let
(
:build
)
{
create
(
:ci_build
,
commit
:
commit
)
}
let
(
:build
)
{
create
(
:ci_build
,
pipeline
:
commit
)
}
it
{
is_expected
.
to
validate_presence_of
:ref
}
it
{
is_expected
.
to
validate_presence_of
:ref
}
it
{
is_expected
.
to
respond_to
:trace_html
}
it
{
is_expected
.
to
respond_to
:trace_html
}
describe
'#first_pending'
do
describe
'#first_pending'
do
let!
(
:first
)
{
create
(
:ci_build
,
commit
:
commit
,
status:
'pending'
,
created_at:
Date
.
yesterday
)
}
let!
(
:first
)
{
create
(
:ci_build
,
pipeline
:
commit
,
status:
'pending'
,
created_at:
Date
.
yesterday
)
}
let!
(
:second
)
{
create
(
:ci_build
,
commit
:
commit
,
status:
'pending'
)
}
let!
(
:second
)
{
create
(
:ci_build
,
pipeline
:
commit
,
status:
'pending'
)
}
subject
{
Ci
::
Build
.
first_pending
}
subject
{
Ci
::
Build
.
first_pending
}
it
{
is_expected
.
to
be_a
(
Ci
::
Build
)
}
it
{
is_expected
.
to
be_a
(
Ci
::
Build
)
}
...
@@ -219,7 +219,7 @@ describe Ci::Build, models: true do
...
@@ -219,7 +219,7 @@ describe Ci::Build, models: true do
context
'and trigger variables'
do
context
'and trigger variables'
do
let
(
:trigger
)
{
create
(
:ci_trigger
,
project:
project
)
}
let
(
:trigger
)
{
create
(
:ci_trigger
,
project:
project
)
}
let
(
:trigger_request
)
{
create
(
:ci_trigger_request_with_variables
,
commit
:
commit
,
trigger:
trigger
)
}
let
(
:trigger_request
)
{
create
(
:ci_trigger_request_with_variables
,
pipeline
:
commit
,
trigger:
trigger
)
}
let
(
:trigger_variables
)
do
let
(
:trigger_variables
)
do
[
[
{
key: :TRIGGER_KEY
,
value:
'TRIGGER_VALUE'
,
public:
false
}
{
key: :TRIGGER_KEY
,
value:
'TRIGGER_VALUE'
,
public:
false
}
...
@@ -428,10 +428,10 @@ describe Ci::Build, models: true do
...
@@ -428,10 +428,10 @@ describe Ci::Build, models: true do
end
end
describe
'#depends_on_builds'
do
describe
'#depends_on_builds'
do
let!
(
:build
)
{
create
(
:ci_build
,
commit
:
commit
,
name:
'build'
,
stage_idx:
0
,
stage:
'build'
)
}
let!
(
:build
)
{
create
(
:ci_build
,
pipeline
:
commit
,
name:
'build'
,
stage_idx:
0
,
stage:
'build'
)
}
let!
(
:rspec_test
)
{
create
(
:ci_build
,
commit
:
commit
,
name:
'rspec'
,
stage_idx:
1
,
stage:
'test'
)
}
let!
(
:rspec_test
)
{
create
(
:ci_build
,
pipeline
:
commit
,
name:
'rspec'
,
stage_idx:
1
,
stage:
'test'
)
}
let!
(
:rubocop_test
)
{
create
(
:ci_build
,
commit
:
commit
,
name:
'rubocop'
,
stage_idx:
1
,
stage:
'test'
)
}
let!
(
:rubocop_test
)
{
create
(
:ci_build
,
pipeline
:
commit
,
name:
'rubocop'
,
stage_idx:
1
,
stage:
'test'
)
}
let!
(
:staging
)
{
create
(
:ci_build
,
commit
:
commit
,
name:
'staging'
,
stage_idx:
2
,
stage:
'deploy'
)
}
let!
(
:staging
)
{
create
(
:ci_build
,
pipeline
:
commit
,
name:
'staging'
,
stage_idx:
2
,
stage:
'deploy'
)
}
it
'to have no dependents if this is first build'
do
it
'to have no dependents if this is first build'
do
expect
(
build
.
depends_on_builds
).
to
be_empty
expect
(
build
.
depends_on_builds
).
to
be_empty
...
@@ -500,7 +500,7 @@ describe Ci::Build, models: true do
...
@@ -500,7 +500,7 @@ describe Ci::Build, models: true do
before
do
before
do
@merge_request
=
create_mr
(
build
,
commit
,
factory: :merge_request_with_diffs
)
@merge_request
=
create_mr
(
build
,
commit
,
factory: :merge_request_with_diffs
)
commit2
=
create
(
:ci_commit
,
project:
project
)
commit2
=
create
(
:ci_commit
,
project:
project
)
@build2
=
create
(
:ci_build
,
commit
:
commit2
)
@build2
=
create
(
:ci_build
,
pipeline
:
commit2
)
commits
=
[
double
(
id:
commit
.
sha
),
double
(
id:
commit2
.
sha
)]
commits
=
[
double
(
id:
commit
.
sha
),
double
(
id:
commit2
.
sha
)]
allow
(
@merge_request
).
to
receive
(
:commits
).
and_return
(
commits
)
allow
(
@merge_request
).
to
receive
(
:commits
).
and_return
(
commits
)
...
...
spec/models/ci/commit_spec.rb
View file @
717fdd6d
...
@@ -42,8 +42,8 @@ describe Ci::Pipeline, models: true do
...
@@ -42,8 +42,8 @@ describe Ci::Pipeline, models: true do
subject
{
commit
.
retried
}
subject
{
commit
.
retried
}
before
do
before
do
@commit1
=
FactoryGirl
.
create
:ci_build
,
commit
:
commit
,
name:
'deploy'
@commit1
=
FactoryGirl
.
create
:ci_build
,
pipeline
:
commit
,
name:
'deploy'
@commit2
=
FactoryGirl
.
create
:ci_build
,
commit
:
commit
,
name:
'deploy'
@commit2
=
FactoryGirl
.
create
:ci_build
,
pipeline
:
commit
,
name:
'deploy'
end
end
it
'returns old builds'
do
it
'returns old builds'
do
...
@@ -264,14 +264,14 @@ describe Ci::Pipeline, models: true do
...
@@ -264,14 +264,14 @@ describe Ci::Pipeline, models: true do
let
(
:commit
)
{
FactoryGirl
.
create
:ci_commit
}
let
(
:commit
)
{
FactoryGirl
.
create
:ci_commit
}
it
"returns finished_at of latest build"
do
it
"returns finished_at of latest build"
do
build
=
FactoryGirl
.
create
:ci_build
,
commit
:
commit
,
finished_at:
Time
.
now
-
60
build
=
FactoryGirl
.
create
:ci_build
,
pipeline
:
commit
,
finished_at:
Time
.
now
-
60
FactoryGirl
.
create
:ci_build
,
commit
:
commit
,
finished_at:
Time
.
now
-
120
FactoryGirl
.
create
:ci_build
,
pipeline
:
commit
,
finished_at:
Time
.
now
-
120
expect
(
commit
.
finished_at
.
to_i
).
to
eq
(
build
.
finished_at
.
to_i
)
expect
(
commit
.
finished_at
.
to_i
).
to
eq
(
build
.
finished_at
.
to_i
)
end
end
it
"returns nil if there is no finished build"
do
it
"returns nil if there is no finished build"
do
FactoryGirl
.
create
:ci_not_started_build
,
commit
:
commit
FactoryGirl
.
create
:ci_not_started_build
,
pipeline
:
commit
expect
(
commit
.
finished_at
).
to
be_nil
expect
(
commit
.
finished_at
).
to
be_nil
end
end
...
@@ -282,27 +282,27 @@ describe Ci::Pipeline, models: true do
...
@@ -282,27 +282,27 @@ describe Ci::Pipeline, models: true do
let
(
:commit
)
{
FactoryGirl
.
create
:ci_commit
,
project:
project
}
let
(
:commit
)
{
FactoryGirl
.
create
:ci_commit
,
project:
project
}
it
"calculates average when there are two builds with coverage"
do
it
"calculates average when there are two builds with coverage"
do
FactoryGirl
.
create
:ci_build
,
name:
"rspec"
,
coverage:
30
,
commit
:
commit
FactoryGirl
.
create
:ci_build
,
name:
"rspec"
,
coverage:
30
,
pipeline
:
commit
FactoryGirl
.
create
:ci_build
,
name:
"rubocop"
,
coverage:
40
,
commit
:
commit
FactoryGirl
.
create
:ci_build
,
name:
"rubocop"
,
coverage:
40
,
pipeline
:
commit
expect
(
commit
.
coverage
).
to
eq
(
"35.00"
)
expect
(
commit
.
coverage
).
to
eq
(
"35.00"
)
end
end
it
"calculates average when there are two builds with coverage and one with nil"
do
it
"calculates average when there are two builds with coverage and one with nil"
do
FactoryGirl
.
create
:ci_build
,
name:
"rspec"
,
coverage:
30
,
commit
:
commit
FactoryGirl
.
create
:ci_build
,
name:
"rspec"
,
coverage:
30
,
pipeline
:
commit
FactoryGirl
.
create
:ci_build
,
name:
"rubocop"
,
coverage:
40
,
commit
:
commit
FactoryGirl
.
create
:ci_build
,
name:
"rubocop"
,
coverage:
40
,
pipeline
:
commit
FactoryGirl
.
create
:ci_build
,
commit
:
commit
FactoryGirl
.
create
:ci_build
,
pipeline
:
commit
expect
(
commit
.
coverage
).
to
eq
(
"35.00"
)
expect
(
commit
.
coverage
).
to
eq
(
"35.00"
)
end
end
it
"calculates average when there are two builds with coverage and one is retried"
do
it
"calculates average when there are two builds with coverage and one is retried"
do
FactoryGirl
.
create
:ci_build
,
name:
"rspec"
,
coverage:
30
,
commit
:
commit
FactoryGirl
.
create
:ci_build
,
name:
"rspec"
,
coverage:
30
,
pipeline
:
commit
FactoryGirl
.
create
:ci_build
,
name:
"rubocop"
,
coverage:
30
,
commit
:
commit
FactoryGirl
.
create
:ci_build
,
name:
"rubocop"
,
coverage:
30
,
pipeline
:
commit
FactoryGirl
.
create
:ci_build
,
name:
"rubocop"
,
coverage:
40
,
commit
:
commit
FactoryGirl
.
create
:ci_build
,
name:
"rubocop"
,
coverage:
40
,
pipeline
:
commit
expect
(
commit
.
coverage
).
to
eq
(
"35.00"
)
expect
(
commit
.
coverage
).
to
eq
(
"35.00"
)
end
end
it
"calculates average when there is one build without coverage"
do
it
"calculates average when there is one build without coverage"
do
FactoryGirl
.
create
:ci_build
,
commit
:
commit
FactoryGirl
.
create
:ci_build
,
pipeline
:
commit
expect
(
commit
.
coverage
).
to
be_nil
expect
(
commit
.
coverage
).
to
be_nil
end
end
end
end
...
@@ -312,7 +312,7 @@ describe Ci::Pipeline, models: true do
...
@@ -312,7 +312,7 @@ describe Ci::Pipeline, models: true do
context
'no failed builds'
do
context
'no failed builds'
do
before
do
before
do
FactoryGirl
.
create
:ci_build
,
name:
"rspec"
,
commit
:
commit
,
status:
'success'
FactoryGirl
.
create
:ci_build
,
name:
"rspec"
,
pipeline
:
commit
,
status:
'success'
end
end
it
'be not retryable'
do
it
'be not retryable'
do
...
@@ -322,8 +322,8 @@ describe Ci::Pipeline, models: true do
...
@@ -322,8 +322,8 @@ describe Ci::Pipeline, models: true do
context
'with failed builds'
do
context
'with failed builds'
do
before
do
before
do
FactoryGirl
.
create
:ci_build
,
name:
"rspec"
,
commit
:
commit
,
status:
'running'
FactoryGirl
.
create
:ci_build
,
name:
"rspec"
,
pipeline
:
commit
,
status:
'running'
FactoryGirl
.
create
:ci_build
,
name:
"rubocop"
,
commit
:
commit
,
status:
'failed'
FactoryGirl
.
create
:ci_build
,
name:
"rubocop"
,
pipeline
:
commit
,
status:
'failed'
end
end
it
'be retryable'
do
it
'be retryable'
do
...
@@ -337,8 +337,8 @@ describe Ci::Pipeline, models: true do
...
@@ -337,8 +337,8 @@ describe Ci::Pipeline, models: true do
subject
{
CommitStatus
.
where
(
commit:
[
commit
,
commit2
]).
stages
}
subject
{
CommitStatus
.
where
(
commit:
[
commit
,
commit2
]).
stages
}
before
do
before
do
FactoryGirl
.
create
:ci_build
,
commit
:
commit2
,
stage:
'test'
,
stage_idx:
1
FactoryGirl
.
create
:ci_build
,
pipeline
:
commit2
,
stage:
'test'
,
stage_idx:
1
FactoryGirl
.
create
:ci_build
,
commit
:
commit
,
stage:
'build'
,
stage_idx:
0
FactoryGirl
.
create
:ci_build
,
pipeline
:
commit
,
stage:
'build'
,
stage_idx:
0
end
end
it
'return all stages'
do
it
'return all stages'
do
...
@@ -353,7 +353,7 @@ describe Ci::Pipeline, models: true do
...
@@ -353,7 +353,7 @@ describe Ci::Pipeline, models: true do
end
end
context
'dependent objects'
do
context
'dependent objects'
do
let
(
:commit_status
)
{
build
:commit_status
,
commit
:
commit
}
let
(
:commit_status
)
{
build
:commit_status
,
pipeline
:
commit
}
it
'execute update_state after saving dependent object'
do
it
'execute update_state after saving dependent object'
do
expect
(
commit
).
to
receive
(
:update_state
).
and_return
(
true
)
expect
(
commit
).
to
receive
(
:update_state
).
and_return
(
true
)
...
@@ -363,7 +363,7 @@ describe Ci::Pipeline, models: true do
...
@@ -363,7 +363,7 @@ describe Ci::Pipeline, models: true do
context
'update state'
do
context
'update state'
do
let
(
:current
)
{
Time
.
now
.
change
(
usec:
0
)
}
let
(
:current
)
{
Time
.
now
.
change
(
usec:
0
)
}
let
(
:build
)
{
FactoryGirl
.
create
:ci_build
,
:success
,
commit
:
commit
,
started_at:
current
-
120
,
finished_at:
current
-
60
}
let
(
:build
)
{
FactoryGirl
.
create
:ci_build
,
:success
,
pipeline
:
commit
,
started_at:
current
-
120
,
finished_at:
current
-
60
}
before
do
before
do
build
build
...
...
spec/models/commit_status_spec.rb
View file @
717fdd6d
...
@@ -2,7 +2,7 @@ require 'spec_helper'
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
CommitStatus
,
models:
true
do
describe
CommitStatus
,
models:
true
do
let
(
:commit
)
{
FactoryGirl
.
create
:ci_commit
}
let
(
:commit
)
{
FactoryGirl
.
create
:ci_commit
}
let
(
:commit_status
)
{
FactoryGirl
.
create
:commit_status
,
commit
:
commit
}
let
(
:commit_status
)
{
FactoryGirl
.
create
:commit_status
,
pipeline
:
commit
}
it
{
is_expected
.
to
belong_to
(
:commit
)
}
it
{
is_expected
.
to
belong_to
(
:commit
)
}
it
{
is_expected
.
to
belong_to
(
:user
)
}
it
{
is_expected
.
to
belong_to
(
:user
)
}
...
@@ -121,11 +121,11 @@ describe CommitStatus, models: true do
...
@@ -121,11 +121,11 @@ describe CommitStatus, models: true do
subject
{
CommitStatus
.
latest
.
order
(
:id
)
}
subject
{
CommitStatus
.
latest
.
order
(
:id
)
}
before
do
before
do
@commit1
=
FactoryGirl
.
create
:commit_status
,
commit
:
commit
,
name:
'aa'
,
ref:
'bb'
,
status:
'running'
@commit1
=
FactoryGirl
.
create
:commit_status
,
pipeline
:
commit
,
name:
'aa'
,
ref:
'bb'
,
status:
'running'
@commit2
=
FactoryGirl
.
create
:commit_status
,
commit
:
commit
,
name:
'cc'
,
ref:
'cc'
,
status:
'pending'
@commit2
=
FactoryGirl
.
create
:commit_status
,
pipeline
:
commit
,
name:
'cc'
,
ref:
'cc'
,
status:
'pending'
@commit3
=
FactoryGirl
.
create
:commit_status
,
commit
:
commit
,
name:
'aa'
,
ref:
'cc'
,
status:
'success'
@commit3
=
FactoryGirl
.
create
:commit_status
,
pipeline
:
commit
,
name:
'aa'
,
ref:
'cc'
,
status:
'success'
@commit4
=
FactoryGirl
.
create
:commit_status
,
commit
:
commit
,
name:
'cc'
,
ref:
'bb'
,
status:
'success'
@commit4
=
FactoryGirl
.
create
:commit_status
,
pipeline
:
commit
,
name:
'cc'
,
ref:
'bb'
,
status:
'success'
@commit5
=
FactoryGirl
.
create
:commit_status
,
commit
:
commit
,
name:
'aa'
,
ref:
'bb'
,
status:
'success'
@commit5
=
FactoryGirl
.
create
:commit_status
,
pipeline
:
commit
,
name:
'aa'
,
ref:
'bb'
,
status:
'success'
end
end
it
'return unique statuses'
do
it
'return unique statuses'
do
...
@@ -137,11 +137,11 @@ describe CommitStatus, models: true do
...
@@ -137,11 +137,11 @@ describe CommitStatus, models: true do
subject
{
CommitStatus
.
running_or_pending
.
order
(
:id
)
}
subject
{
CommitStatus
.
running_or_pending
.
order
(
:id
)
}
before
do
before
do
@commit1
=
FactoryGirl
.
create
:commit_status
,
commit
:
commit
,
name:
'aa'
,
ref:
'bb'
,
status:
'running'
@commit1
=
FactoryGirl
.
create
:commit_status
,
pipeline
:
commit
,
name:
'aa'
,
ref:
'bb'
,
status:
'running'
@commit2
=
FactoryGirl
.
create
:commit_status
,
commit
:
commit
,
name:
'cc'
,
ref:
'cc'
,
status:
'pending'
@commit2
=
FactoryGirl
.
create
:commit_status
,
pipeline
:
commit
,
name:
'cc'
,
ref:
'cc'
,
status:
'pending'
@commit3
=
FactoryGirl
.
create
:commit_status
,
commit
:
commit
,
name:
'aa'
,
ref:
nil
,
status:
'success'
@commit3
=
FactoryGirl
.
create
:commit_status
,
pipeline
:
commit
,
name:
'aa'
,
ref:
nil
,
status:
'success'
@commit4
=
FactoryGirl
.
create
:commit_status
,
commit
:
commit
,
name:
'dd'
,
ref:
nil
,
status:
'failed'
@commit4
=
FactoryGirl
.
create
:commit_status
,
pipeline
:
commit
,
name:
'dd'
,
ref:
nil
,
status:
'failed'
@commit5
=
FactoryGirl
.
create
:commit_status
,
commit
:
commit
,
name:
'ee'
,
ref:
nil
,
status:
'canceled'
@commit5
=
FactoryGirl
.
create
:commit_status
,
pipeline
:
commit
,
name:
'ee'
,
ref:
nil
,
status:
'canceled'
end
end
it
'return statuses that are running or pending'
do
it
'return statuses that are running or pending'
do
...
@@ -172,10 +172,10 @@ describe CommitStatus, models: true do
...
@@ -172,10 +172,10 @@ describe CommitStatus, models: true do
describe
'#stages'
do
describe
'#stages'
do
before
do
before
do
FactoryGirl
.
create
:commit_status
,
commit
:
commit
,
stage:
'build'
,
stage_idx:
0
,
status:
'success'
FactoryGirl
.
create
:commit_status
,
pipeline
:
commit
,
stage:
'build'
,
stage_idx:
0
,
status:
'success'
FactoryGirl
.
create
:commit_status
,
commit
:
commit
,
stage:
'build'
,
stage_idx:
0
,
status:
'failed'
FactoryGirl
.
create
:commit_status
,
pipeline
:
commit
,
stage:
'build'
,
stage_idx:
0
,
status:
'failed'
FactoryGirl
.
create
:commit_status
,
commit
:
commit
,
stage:
'deploy'
,
stage_idx:
2
,
status:
'running'
FactoryGirl
.
create
:commit_status
,
pipeline
:
commit
,
stage:
'deploy'
,
stage_idx:
2
,
status:
'running'
FactoryGirl
.
create
:commit_status
,
commit
:
commit
,
stage:
'test'
,
stage_idx:
1
,
status:
'success'
FactoryGirl
.
create
:commit_status
,
pipeline
:
commit
,
stage:
'test'
,
stage_idx:
1
,
status:
'success'
end
end
context
'stages list'
do
context
'stages list'
do
...
...
spec/models/generic_commit_status_spec.rb
View file @
717fdd6d
...
@@ -2,7 +2,7 @@ require 'spec_helper'
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
GenericCommitStatus
,
models:
true
do
describe
GenericCommitStatus
,
models:
true
do
let
(
:commit
)
{
FactoryGirl
.
create
:ci_commit
}
let
(
:commit
)
{
FactoryGirl
.
create
:ci_commit
}
let
(
:generic_commit_status
)
{
FactoryGirl
.
create
:generic_commit_status
,
commit
:
commit
}
let
(
:generic_commit_status
)
{
FactoryGirl
.
create
:generic_commit_status
,
pipeline
:
commit
}
describe
:context
do
describe
:context
do
subject
{
generic_commit_status
.
context
}
subject
{
generic_commit_status
.
context
}
...
...
spec/requests/api/builds_spec.rb
View file @
717fdd6d
...
@@ -10,7 +10,7 @@ describe API::API, api: true do
...
@@ -10,7 +10,7 @@ describe API::API, api: true do
let!
(
:developer
)
{
create
(
:project_member
,
:developer
,
user:
user
,
project:
project
)
}
let!
(
:developer
)
{
create
(
:project_member
,
:developer
,
user:
user
,
project:
project
)
}
let!
(
:reporter
)
{
create
(
:project_member
,
:reporter
,
user:
user2
,
project:
project
)
}
let!
(
:reporter
)
{
create
(
:project_member
,
:reporter
,
user:
user2
,
project:
project
)
}
let
(
:commit
)
{
create
(
:ci_commit
,
project:
project
)}
let
(
:commit
)
{
create
(
:ci_commit
,
project:
project
)}
let
(
:build
)
{
create
(
:ci_build
,
commit
:
commit
)
}
let
(
:build
)
{
create
(
:ci_build
,
pipeline
:
commit
)
}
describe
'GET /projects/:id/builds '
do
describe
'GET /projects/:id/builds '
do
let
(
:query
)
{
''
}
let
(
:query
)
{
''
}
...
@@ -102,7 +102,7 @@ describe API::API, api: true do
...
@@ -102,7 +102,7 @@ describe API::API, api: true do
before
{
get
api
(
"/projects/
#{
project
.
id
}
/builds/
#{
build
.
id
}
/artifacts"
,
api_user
)
}
before
{
get
api
(
"/projects/
#{
project
.
id
}
/builds/
#{
build
.
id
}
/artifacts"
,
api_user
)
}
context
'build with artifacts'
do
context
'build with artifacts'
do
let
(
:build
)
{
create
(
:ci_build
,
:artifacts
,
commit
:
commit
)
}
let
(
:build
)
{
create
(
:ci_build
,
:artifacts
,
pipeline
:
commit
)
}
context
'authorized user'
do
context
'authorized user'
do
let
(
:download_headers
)
do
let
(
:download_headers
)
do
...
@@ -131,7 +131,7 @@ describe API::API, api: true do
...
@@ -131,7 +131,7 @@ describe API::API, api: true do
end
end
describe
'GET /projects/:id/builds/:build_id/trace'
do
describe
'GET /projects/:id/builds/:build_id/trace'
do
let
(
:build
)
{
create
(
:ci_build
,
:trace
,
commit
:
commit
)
}
let
(
:build
)
{
create
(
:ci_build
,
:trace
,
pipeline
:
commit
)
}
before
{
get
api
(
"/projects/
#{
project
.
id
}
/builds/
#{
build
.
id
}
/trace"
,
api_user
)
}
before
{
get
api
(
"/projects/
#{
project
.
id
}
/builds/
#{
build
.
id
}
/trace"
,
api_user
)
}
...
@@ -181,7 +181,7 @@ describe API::API, api: true do
...
@@ -181,7 +181,7 @@ describe API::API, api: true do
end
end
describe
'POST /projects/:id/builds/:build_id/retry'
do
describe
'POST /projects/:id/builds/:build_id/retry'
do
let
(
:build
)
{
create
(
:ci_build
,
:canceled
,
commit
:
commit
)
}
let
(
:build
)
{
create
(
:ci_build
,
:canceled
,
pipeline
:
commit
)
}
before
{
post
api
(
"/projects/
#{
project
.
id
}
/builds/
#{
build
.
id
}
/retry"
,
api_user
)
}
before
{
post
api
(
"/projects/
#{
project
.
id
}
/builds/
#{
build
.
id
}
/retry"
,
api_user
)
}
...
@@ -218,7 +218,7 @@ describe API::API, api: true do
...
@@ -218,7 +218,7 @@ describe API::API, api: true do
end
end
context
'build is erasable'
do
context
'build is erasable'
do
let
(
:build
)
{
create
(
:ci_build
,
:trace
,
:artifacts
,
:success
,
project:
project
,
commit
:
commit
)
}
let
(
:build
)
{
create
(
:ci_build
,
:trace
,
:artifacts
,
:success
,
project:
project
,
pipeline
:
commit
)
}
it
'should erase build content'
do
it
'should erase build content'
do
expect
(
response
.
status
).
to
eq
201
expect
(
response
.
status
).
to
eq
201
...
@@ -234,7 +234,7 @@ describe API::API, api: true do
...
@@ -234,7 +234,7 @@ describe API::API, api: true do
end
end
context
'build is not erasable'
do
context
'build is not erasable'
do
let
(
:build
)
{
create
(
:ci_build
,
:trace
,
project:
project
,
commit
:
commit
)
}
let
(
:build
)
{
create
(
:ci_build
,
:trace
,
project:
project
,
pipeline
:
commit
)
}
it
'should respond with forbidden'
do
it
'should respond with forbidden'
do
expect
(
response
.
status
).
to
eq
403
expect
(
response
.
status
).
to
eq
403
...
...
spec/requests/api/commit_statuses_spec.rb
View file @
717fdd6d
...
@@ -5,7 +5,7 @@ describe API::CommitStatuses, api: true do
...
@@ -5,7 +5,7 @@ describe API::CommitStatuses, api: true do
let!
(
:project
)
{
create
(
:project
)
}
let!
(
:project
)
{
create
(
:project
)
}
let
(
:commit
)
{
project
.
repository
.
commit
}
let
(
:commit
)
{
project
.
repository
.
commit
}
let
(
:commit_status
)
{
create
(
:commit_status
,
commit
:
ci_commit
)
}
let
(
:commit_status
)
{
create
(
:commit_status
,
pipeline
:
ci_commit
)
}
let
(
:guest
)
{
create_user
(
:guest
)
}
let
(
:guest
)
{
create_user
(
:guest
)
}
let
(
:reporter
)
{
create_user
(
:reporter
)
}
let
(
:reporter
)
{
create_user
(
:reporter
)
}
let
(
:developer
)
{
create_user
(
:developer
)
}
let
(
:developer
)
{
create_user
(
:developer
)
}
...
@@ -27,7 +27,7 @@ describe API::CommitStatuses, api: true do
...
@@ -27,7 +27,7 @@ describe API::CommitStatuses, api: true do
let
(
:statuses_id
)
{
json_response
.
map
{
|
status
|
status
[
'id'
]
}
}
let
(
:statuses_id
)
{
json_response
.
map
{
|
status
|
status
[
'id'
]
}
}
def
create_status
(
commit
,
opts
=
{})
def
create_status
(
commit
,
opts
=
{})
create
(
:commit_status
,
{
commit
:
commit
,
ref:
commit
.
ref
}.
merge
(
opts
))
create
(
:commit_status
,
{
pipeline
:
commit
,
ref:
commit
.
ref
}.
merge
(
opts
))
end
end
let!
(
:status1
)
{
create_status
(
master
,
status:
'running'
)
}
let!
(
:status1
)
{
create_status
(
master
,
status:
'running'
)
}
...
...
spec/requests/ci/api/builds_spec.rb
View file @
717fdd6d
...
@@ -39,7 +39,7 @@ describe Ci::API::API do
...
@@ -39,7 +39,7 @@ describe Ci::API::API do
it
"should return 404 error if no builds for specific runner"
do
it
"should return 404 error if no builds for specific runner"
do
commit
=
FactoryGirl
.
create
(
:ci_commit
,
project:
shared_project
)
commit
=
FactoryGirl
.
create
(
:ci_commit
,
project:
shared_project
)
FactoryGirl
.
create
(
:ci_build
,
commit
:
commit
,
status:
'pending'
)
FactoryGirl
.
create
(
:ci_build
,
pipeline
:
commit
,
status:
'pending'
)
post
ci_api
(
"/builds/register"
),
token:
runner
.
token
post
ci_api
(
"/builds/register"
),
token:
runner
.
token
...
@@ -48,7 +48,7 @@ describe Ci::API::API do
...
@@ -48,7 +48,7 @@ describe Ci::API::API do
it
"should return 404 error if no builds for shared runner"
do
it
"should return 404 error if no builds for shared runner"
do
commit
=
FactoryGirl
.
create
(
:ci_commit
,
project:
project
)
commit
=
FactoryGirl
.
create
(
:ci_commit
,
project:
project
)
FactoryGirl
.
create
(
:ci_build
,
commit
:
commit
,
status:
'pending'
)
FactoryGirl
.
create
(
:ci_build
,
pipeline
:
commit
,
status:
'pending'
)
post
ci_api
(
"/builds/register"
),
token:
shared_runner
.
token
post
ci_api
(
"/builds/register"
),
token:
shared_runner
.
token
...
@@ -85,7 +85,7 @@ describe Ci::API::API do
...
@@ -85,7 +85,7 @@ describe Ci::API::API do
trigger
=
FactoryGirl
.
create
(
:ci_trigger
,
project:
project
)
trigger
=
FactoryGirl
.
create
(
:ci_trigger
,
project:
project
)
commit
=
FactoryGirl
.
create
(
:ci_commit
,
project:
project
,
ref:
'master'
)
commit
=
FactoryGirl
.
create
(
:ci_commit
,
project:
project
,
ref:
'master'
)
trigger_request
=
FactoryGirl
.
create
(
:ci_trigger_request_with_variables
,
commit
:
commit
,
trigger:
trigger
)
trigger_request
=
FactoryGirl
.
create
(
:ci_trigger_request_with_variables
,
pipeline
:
commit
,
trigger:
trigger
)
commit
.
create_builds
(
nil
,
trigger_request
)
commit
.
create_builds
(
nil
,
trigger_request
)
project
.
variables
<<
Ci
::
Variable
.
new
(
key:
"SECRET_KEY"
,
value:
"secret_value"
)
project
.
variables
<<
Ci
::
Variable
.
new
(
key:
"SECRET_KEY"
,
value:
"secret_value"
)
...
@@ -132,7 +132,7 @@ describe Ci::API::API do
...
@@ -132,7 +132,7 @@ describe Ci::API::API do
context
'when build has no tags'
do
context
'when build has no tags'
do
before
do
before
do
commit
=
create
(
:ci_commit
,
project:
project
)
commit
=
create
(
:ci_commit
,
project:
project
)
create
(
:ci_build
,
commit
:
commit
,
tags:
[])
create
(
:ci_build
,
pipeline
:
commit
,
tags:
[])
end
end
context
'when runner is allowed to pick untagged builds'
do
context
'when runner is allowed to pick untagged builds'
do
...
@@ -164,7 +164,7 @@ describe Ci::API::API do
...
@@ -164,7 +164,7 @@ describe Ci::API::API do
describe
"PUT /builds/:id"
do
describe
"PUT /builds/:id"
do
let
(
:commit
)
{
create
(
:ci_commit
,
project:
project
)}
let
(
:commit
)
{
create
(
:ci_commit
,
project:
project
)}
let
(
:build
)
{
create
(
:ci_build
,
:trace
,
commit
:
commit
,
runner_id:
runner
.
id
)
}
let
(
:build
)
{
create
(
:ci_build
,
:trace
,
pipeline
:
commit
,
runner_id:
runner
.
id
)
}
before
do
before
do
build
.
run!
build
.
run!
...
@@ -238,7 +238,7 @@ describe Ci::API::API do
...
@@ -238,7 +238,7 @@ describe Ci::API::API do
let
(
:file_upload
)
{
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/banana_sample.gif'
,
'image/gif'
)
}
let
(
:file_upload
)
{
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/banana_sample.gif'
,
'image/gif'
)
}
let
(
:file_upload2
)
{
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/dk.png'
,
'image/gif'
)
}
let
(
:file_upload2
)
{
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/dk.png'
,
'image/gif'
)
}
let
(
:commit
)
{
create
(
:ci_commit
,
project:
project
)
}
let
(
:commit
)
{
create
(
:ci_commit
,
project:
project
)
}
let
(
:build
)
{
create
(
:ci_build
,
commit
:
commit
,
runner_id:
runner
.
id
)
}
let
(
:build
)
{
create
(
:ci_build
,
pipeline
:
commit
,
runner_id:
runner
.
id
)
}
let
(
:authorize_url
)
{
ci_api
(
"/builds/
#{
build
.
id
}
/artifacts/authorize"
)
}
let
(
:authorize_url
)
{
ci_api
(
"/builds/
#{
build
.
id
}
/artifacts/authorize"
)
}
let
(
:post_url
)
{
ci_api
(
"/builds/
#{
build
.
id
}
/artifacts"
)
}
let
(
:post_url
)
{
ci_api
(
"/builds/
#{
build
.
id
}
/artifacts"
)
}
let
(
:delete_url
)
{
ci_api
(
"/builds/
#{
build
.
id
}
/artifacts"
)
}
let
(
:delete_url
)
{
ci_api
(
"/builds/
#{
build
.
id
}
/artifacts"
)
}
...
...
spec/services/ci/image_for_build_service_spec.rb
View file @
717fdd6d
...
@@ -6,7 +6,7 @@ module Ci
...
@@ -6,7 +6,7 @@ module Ci
let
(
:project
)
{
FactoryGirl
.
create
(
:empty_project
)
}
let
(
:project
)
{
FactoryGirl
.
create
(
:empty_project
)
}
let
(
:commit_sha
)
{
'01234567890123456789'
}
let
(
:commit_sha
)
{
'01234567890123456789'
}
let
(
:commit
)
{
project
.
ensure_ci_commit
(
commit_sha
,
'master'
)
}
let
(
:commit
)
{
project
.
ensure_ci_commit
(
commit_sha
,
'master'
)
}
let
(
:build
)
{
FactoryGirl
.
create
(
:ci_build
,
commit
:
commit
)
}
let
(
:build
)
{
FactoryGirl
.
create
(
:ci_build
,
pipeline
:
commit
)
}
describe
:execute
do
describe
:execute
do
before
{
build
}
before
{
build
}
...
...
spec/services/ci/register_build_service_spec.rb
View file @
717fdd6d
...
@@ -5,7 +5,7 @@ module Ci
...
@@ -5,7 +5,7 @@ module Ci
let!
(
:service
)
{
RegisterBuildService
.
new
}
let!
(
:service
)
{
RegisterBuildService
.
new
}
let!
(
:project
)
{
FactoryGirl
.
create
:empty_project
,
shared_runners_enabled:
false
}
let!
(
:project
)
{
FactoryGirl
.
create
:empty_project
,
shared_runners_enabled:
false
}
let!
(
:commit
)
{
FactoryGirl
.
create
:ci_commit
,
project:
project
}
let!
(
:commit
)
{
FactoryGirl
.
create
:ci_commit
,
project:
project
}
let!
(
:pending_build
)
{
FactoryGirl
.
create
:ci_build
,
commit
:
commit
}
let!
(
:pending_build
)
{
FactoryGirl
.
create
:ci_build
,
pipeline
:
commit
}
let!
(
:shared_runner
)
{
FactoryGirl
.
create
(
:ci_runner
,
is_shared:
true
)
}
let!
(
:shared_runner
)
{
FactoryGirl
.
create
(
:ci_runner
,
is_shared:
true
)
}
let!
(
:specific_runner
)
{
FactoryGirl
.
create
(
:ci_runner
,
is_shared:
false
)
}
let!
(
:specific_runner
)
{
FactoryGirl
.
create
(
:ci_runner
,
is_shared:
false
)
}
...
...
spec/services/merge_requests/add_todo_when_build_fails_service_spec.rb
View file @
717fdd6d
...
@@ -23,7 +23,7 @@ describe MergeRequests::AddTodoWhenBuildFailsService do
...
@@ -23,7 +23,7 @@ describe MergeRequests::AddTodoWhenBuildFailsService do
describe
'#execute'
do
describe
'#execute'
do
context
'commit status with ref'
do
context
'commit status with ref'
do
let
(
:commit_status
)
{
create
(
:generic_commit_status
,
ref:
merge_request
.
source_branch
,
commit
:
ci_commit
)
}
let
(
:commit_status
)
{
create
(
:generic_commit_status
,
ref:
merge_request
.
source_branch
,
pipeline
:
ci_commit
)
}
it
'notifies the todo service'
do
it
'notifies the todo service'
do
expect
(
todo_service
).
to
receive
(
:merge_request_build_failed
).
with
(
merge_request
)
expect
(
todo_service
).
to
receive
(
:merge_request_build_failed
).
with
(
merge_request
)
...
@@ -52,7 +52,7 @@ describe MergeRequests::AddTodoWhenBuildFailsService do
...
@@ -52,7 +52,7 @@ describe MergeRequests::AddTodoWhenBuildFailsService do
describe
'#close'
do
describe
'#close'
do
context
'commit status with ref'
do
context
'commit status with ref'
do
let
(
:commit_status
)
{
create
(
:generic_commit_status
,
ref:
merge_request
.
source_branch
,
commit
:
ci_commit
)
}
let
(
:commit_status
)
{
create
(
:generic_commit_status
,
ref:
merge_request
.
source_branch
,
pipeline
:
ci_commit
)
}
it
'notifies the todo service'
do
it
'notifies the todo service'
do
expect
(
todo_service
).
to
receive
(
:merge_request_build_retried
).
with
(
merge_request
)
expect
(
todo_service
).
to
receive
(
:merge_request_build_retried
).
with
(
merge_request
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment