open-nomad/client/allocrunner/task_hook_coordinator_test.go
2020-03-21 17:52:38 -04:00

27 lines
529 B
Go

package allocrunner
import (
"testing"
"github.com/hashicorp/nomad/helper/testlog"
"github.com/hashicorp/nomad/nomad/mock"
"github.com/stretchr/testify/require"
)
func TestTaskHookCoordinator_OnlyMainApp(t *testing.T) {
alloc := mock.Alloc()
tasks := alloc.Job.TaskGroups[0].Tasks
logger := testlog.HCLogger(t)
coord := newTaskHookCoordinator(logger, tasks)
ch := coord.startConditionForTask(tasks[0])
select {
case _, ok := <-ch:
require.False(t, ok)
default:
require.Fail(t, "channel wasn't closed")
}
}