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
cedc0974
Commit
cedc0974
authored
May 07, 2018
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't always create a new import_state record from project factory
parent
53d04fa3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
51 deletions
+17
-51
spec/factories/projects.rb
spec/factories/projects.rb
+17
-51
No files found.
spec/factories/projects.rb
View file @
cedc0974
...
@@ -69,78 +69,44 @@ FactoryBot.define do
...
@@ -69,78 +69,44 @@ FactoryBot.define do
end
end
trait
:import_none
do
trait
:import_none
do
transient
do
import_status
:none
status
:none
end
before
(
:create
)
do
|
project
,
evaluator
|
project
.
create_import_state
(
:status
,
evaluator
.
status
)
end
end
end
trait
:import_scheduled
do
trait
:import_scheduled
do
transient
do
import_status
:scheduled
status
:scheduled
last_update_scheduled_at
Time
.
now
end
before
(
:create
)
do
|
project
,
evaluator
|
after
(
:create
)
do
|
project
,
_
|
project
.
create_import_state
(
status:
evaluator
.
status
,
project
.
import_state
&
.
update_attributes
(
last_update_scheduled_at:
Time
.
now
)
last_update_scheduled_at:
evaluator
.
last_update_scheduled_at
)
end
end
end
end
trait
:import_started
do
trait
:import_started
do
transient
do
import_status
:started
status
:started
last_update_started_at
Time
.
now
end
before
(
:create
)
do
|
project
,
evaluator
|
after
(
:create
)
do
|
project
,
_
|
project
.
create_import_state
(
status:
evaluator
.
status
,
project
.
import_state
&
.
update_attributes
(
last_update_started_at:
Time
.
now
)
last_update_started_at:
evaluator
.
last_update_started_at
)
end
end
end
end
trait
:import_finished
do
trait
:import_finished
do
transient
do
timestamp
=
Time
.
now
timestamp
=
Time
.
now
status
:finished
import_status
:finished
last_update_at
timestamp
mirror_last_update_at
timestamp
last_successful_update_at
timestamp
mirror_last_successful_update_at
timestamp
end
before
(
:create
)
do
|
project
,
evaluator
|
project
.
create_import_state
(
status:
evaluator
.
status
,
last_update_at:
evaluator
.
last_update_at
,
last_successful_update_at:
evaluator
.
last_successful_update_at
)
end
end
end
trait
:import_failed
do
trait
:import_failed
do
transient
do
import_status
:failed
status
:failed
mirror_last_update_at
{
Time
.
now
}
last_update_at
{
Time
.
now
}
end
before
(
:create
)
do
|
project
,
evaluator
|
project
.
create_import_state
(
status:
evaluator
.
status
,
last_update_at:
evaluator
.
last_update_at
)
end
end
end
trait
:import_hard_failed
do
trait
:import_hard_failed
do
transient
do
import_status
:failed
status
:failed
mirror_last_update_at
{
Time
.
now
-
1
.
minute
}
retry_count
Gitlab
::
Mirror
::
MAX_RETRY
+
1
last_update_at
Time
.
now
-
1
.
minute
end
before
(
:create
)
do
|
project
,
evaluator
|
after
(
:create
)
do
|
project
|
project
.
create_import_state
(
status:
evaluator
.
status
,
project
.
import_state
&
.
update_attributes
(
retry_count:
Gitlab
::
Mirror
::
MAX_RETRY
+
1
)
retry_count:
evaluator
.
retry_count
,
last_update_at:
evaluator
.
last_update_at
)
end
end
end
end
...
...
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