fix linting errors

This commit is contained in:
Jasmine Dahilig
2020-01-28 18:03:26 -08:00
committed by Mahmood Ali
parent ee92c98d4e
commit da3eb69a2f
3 changed files with 11 additions and 11 deletions

View File

@@ -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

View File

@@ -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(),

View File

@@ -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",