Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Nomad
Commits
da3eb69a
Commit
da3eb69a
authored
5 years ago
by
Jasmine Dahilig
Committed by
Mahmood Ali
5 years ago
Browse files
Options
Download
Email Patches
Plain Diff
fix linting errors
parent
ee92c98d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
client/allocrunner/task_hook_coordinator.go
+2
-2
client/allocrunner/task_hook_coordinator.go
client/allocrunner/task_hook_coordinator_test.go
+6
-6
client/allocrunner/task_hook_coordinator_test.go
nomad/mock/mock.go
+3
-3
nomad/mock/mock.go
with
11 additions
and
11 deletions
+11
-11
client/allocrunner/task_hook_coordinator.go
+
2
-
2
View file @
da3eb69a
...
...
@@ -78,7 +78,7 @@ func (c *taskHookCoordinator) taskStateUpdated(states map[string]*structs.TaskSt
return
}
for
task
,
_
:=
range
c
.
prestartTasksUntilRunning
{
for
task
:=
range
c
.
prestartTasksUntilRunning
{
st
:=
states
[
task
]
if
st
==
nil
||
st
.
StartedAt
.
IsZero
()
{
continue
...
...
@@ -87,7 +87,7 @@ func (c *taskHookCoordinator) taskStateUpdated(states map[string]*structs.TaskSt
delete
(
c
.
prestartTasksUntilRunning
,
task
)
}
for
task
,
_
:=
range
c
.
prestartTasksUntilCompleted
{
for
task
:=
range
c
.
prestartTasksUntilCompleted
{
st
:=
states
[
task
]
if
st
==
nil
||
!
st
.
Successful
()
{
continue
...
...
This diff is collapsed.
Click to expand it.
client/allocrunner/task_hook_coordinator_test.go
+
6
-
6
View file @
da3eb69a
...
...
@@ -69,17 +69,17 @@ func TestTaskHookCoordinator_MainRunsAfterPrestart(t *testing.T) {
require
.
Truef
(
t
,
isChannelClosed
(
sideCh
),
"%s channel was open, should be closed"
,
sideTaskName
)
states
:=
map
[
string
]
*
structs
.
TaskState
{
mainTaskName
:
&
structs
.
TaskState
{
mainTaskName
:
{
State
:
structs
.
TaskStatePending
,
Failed
:
false
,
},
initTaskName
:
&
structs
.
TaskState
{
initTaskName
:
{
State
:
structs
.
TaskStateDead
,
Failed
:
false
,
StartedAt
:
time
.
Now
(),
FinishedAt
:
time
.
Now
(),
},
sideTaskName
:
&
structs
.
TaskState
{
sideTaskName
:
{
State
:
structs
.
TaskStateRunning
,
Failed
:
false
,
StartedAt
:
time
.
Now
(),
...
...
@@ -116,17 +116,17 @@ func TestTaskHookCoordinator_MainRunsAfterManyInitTasks(t *testing.T) {
require
.
Truef
(
t
,
isChannelClosed
(
init2Ch
),
"%s channel was open, should be closed"
,
tasks
[
2
]
.
Name
)
states
:=
map
[
string
]
*
structs
.
TaskState
{
tasks
[
0
]
.
Name
:
&
structs
.
TaskState
{
tasks
[
0
]
.
Name
:
{
State
:
structs
.
TaskStatePending
,
Failed
:
false
,
},
tasks
[
1
]
.
Name
:
&
structs
.
TaskState
{
tasks
[
1
]
.
Name
:
{
State
:
structs
.
TaskStateDead
,
Failed
:
false
,
StartedAt
:
time
.
Now
(),
FinishedAt
:
time
.
Now
(),
},
tasks
[
2
]
.
Name
:
&
structs
.
TaskState
{
tasks
[
2
]
.
Name
:
{
State
:
structs
.
TaskStateDead
,
Failed
:
false
,
StartedAt
:
time
.
Now
(),
...
...
This diff is collapsed.
Click to expand it.
nomad/mock/mock.go
+
3
-
3
View file @
da3eb69a
...
...
@@ -272,7 +272,7 @@ func Job() *structs.Job {
func
LifecycleSideTask
(
resources
structs
.
Resources
,
i
int
)
*
structs
.
Task
{
return
&
structs
.
Task
{
Name
:
fmt
.
Sprintf
(
"side-%
s
"
,
i
),
Name
:
fmt
.
Sprintf
(
"side-%
d
"
,
i
),
Driver
:
"exec"
,
Config
:
map
[
string
]
interface
{}{
"command"
:
"/bin/date"
,
...
...
@@ -288,7 +288,7 @@ func LifecycleSideTask(resources structs.Resources, i int) *structs.Task {
func
LifecycleInitTask
(
resources
structs
.
Resources
,
i
int
)
*
structs
.
Task
{
return
&
structs
.
Task
{
Name
:
fmt
.
Sprintf
(
"init-%
s
"
,
i
),
Name
:
fmt
.
Sprintf
(
"init-%
d
"
,
i
),
Driver
:
"exec"
,
Config
:
map
[
string
]
interface
{}{
"command"
:
"/bin/date"
,
...
...
@@ -304,7 +304,7 @@ func LifecycleInitTask(resources structs.Resources, i int) *structs.Task {
func
LifecycleMainTask
(
resources
structs
.
Resources
,
i
int
)
*
structs
.
Task
{
return
&
structs
.
Task
{
Name
:
fmt
.
Sprintf
(
"main-%
s
"
,
i
),
Name
:
fmt
.
Sprintf
(
"main-%
d
"
,
i
),
Driver
:
"exec"
,
Config
:
map
[
string
]
interface
{}{
"command"
:
"/bin/date"
,
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
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
Menu
Projects
Groups
Snippets
Help