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
21f8e4ba
Commit
21f8e4ba
authored
Jun 21, 2021
by
Maxime Orefice
Committed by
Grzegorz Bizon
Jun 21, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add factory for CI::PendingBuild and CI::RunningBuild
parent
e67f5869
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
28 additions
and
16 deletions
+28
-16
spec/factories/ci/pending_builds.rb
spec/factories/ci/pending_builds.rb
+9
-0
spec/factories/ci/running_builds.rb
spec/factories/ci/running_builds.rb
+10
-0
spec/models/ci/build_spec.rb
spec/models/ci/build_spec.rb
+3
-3
spec/models/ci/pending_build_spec.rb
spec/models/ci/pending_build_spec.rb
+1
-1
spec/models/ci/running_build_spec.rb
spec/models/ci/running_build_spec.rb
+1
-4
spec/services/ci/update_build_queue_service_spec.rb
spec/services/ci/update_build_queue_service_spec.rb
+4
-8
No files found.
spec/factories/ci/pending_builds.rb
0 → 100644
View file @
21f8e4ba
# frozen_string_literal: true
FactoryBot
.
define
do
factory
:ci_pending_build
,
class:
'Ci::PendingBuild'
do
build
factory: :ci_build
project
protected
{
build
.
protected
}
end
end
spec/factories/ci/running_builds.rb
0 → 100644
View file @
21f8e4ba
# frozen_string_literal: true
FactoryBot
.
define
do
factory
:ci_running_build
,
class:
'Ci::RunningBuild'
do
build
factory: :ci_build
project
runner
factory: :ci_runner
runner_type
{
runner
.
runner_type
}
end
end
spec/models/ci/build_spec.rb
View file @
21f8e4ba
...
...
@@ -384,7 +384,7 @@ RSpec.describe Ci::Build do
context
'when there is a queuing entry already present'
do
before
do
::
Ci
::
PendingBuild
.
create!
(
build:
build
,
project:
build
.
project
)
create
(
:ci_pending_build
,
build:
build
,
project:
build
.
project
)
end
it
'does not raise an error'
do
...
...
@@ -396,7 +396,7 @@ RSpec.describe Ci::Build do
context
'when both failure scenario happen at the same time'
do
before
do
::
Ci
::
Build
.
find
(
build
.
id
).
update_column
(
:lock_version
,
100
)
::
Ci
::
PendingBuild
.
create!
(
build:
build
,
project:
build
.
project
)
create
(
:ci_pending_build
,
build:
build
,
project:
build
.
project
)
end
it
'raises stale object error exception'
do
...
...
@@ -478,7 +478,7 @@ RSpec.describe Ci::Build do
let
(
:build
)
{
create
(
:ci_build
,
:pending
)
}
before
do
::
Ci
::
PendingBuild
.
create!
(
build:
build
,
project:
build
.
project
)
create
(
:ci_pending_build
,
build:
build
,
project:
build
.
project
)
::
Ci
::
Build
.
find
(
build
.
id
).
update_column
(
:lock_version
,
100
)
end
...
...
spec/models/ci/pending_build_spec.rb
View file @
21f8e4ba
...
...
@@ -20,7 +20,7 @@ RSpec.describe Ci::PendingBuild do
context
'when another queuing entry exists for given build'
do
before
do
described_class
.
create!
(
build:
build
,
project:
project
,
protected:
false
)
create
(
:ci_pending_build
,
build:
build
,
project:
project
)
end
it
'returns a build id as a result'
do
...
...
spec/models/ci/running_build_spec.rb
View file @
21f8e4ba
...
...
@@ -21,10 +21,7 @@ RSpec.describe Ci::RunningBuild do
context
'when another queuing entry exists for given build'
do
before
do
described_class
.
create!
(
build:
build
,
project:
project
,
runner:
runner
,
runner_type:
runner
.
runner_type
)
create
(
:ci_running_build
,
build:
build
,
project:
project
,
runner:
runner
)
end
it
'returns a build id as a result'
do
...
...
spec/services/ci/update_build_queue_service_spec.rb
View file @
21f8e4ba
...
...
@@ -45,7 +45,7 @@ RSpec.describe Ci::UpdateBuildQueueService do
context
'when duplicate entry exists'
do
before
do
::
Ci
::
PendingBuild
.
create!
(
build:
build
,
project:
project
)
create
(
:ci_pending_build
,
build:
build
,
project:
build
.
project
)
end
it
'does nothing and returns build id'
do
...
...
@@ -66,7 +66,7 @@ RSpec.describe Ci::UpdateBuildQueueService do
context
'when pending build exists'
do
before
do
Ci
::
PendingBuild
.
create!
(
build:
build
,
project:
project
)
create
(
:ci_pending_build
,
build:
build
,
project:
build
.
project
)
end
it
'removes pending build in a transaction'
do
...
...
@@ -146,9 +146,7 @@ RSpec.describe Ci::UpdateBuildQueueService do
context
'when duplicate entry exists'
do
before
do
::
Ci
::
RunningBuild
.
create!
(
build:
build
,
project:
project
,
runner:
runner
,
runner_type:
runner
.
runner_type
)
create
(
:ci_running_build
,
build:
build
,
project:
project
,
runner:
runner
)
end
it
'does nothing and returns build id'
do
...
...
@@ -169,9 +167,7 @@ RSpec.describe Ci::UpdateBuildQueueService do
context
'when shared runner build tracking entry exists'
do
before
do
Ci
::
RunningBuild
.
create!
(
build:
build
,
project:
project
,
runner:
runner
,
runner_type:
runner
.
runner_type
)
create
(
:ci_running_build
,
build:
build
,
project:
project
,
runner:
runner
)
end
it
'removes shared runner build'
do
...
...
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