Allow using a local Docker image, e.g., for tests
This commit is contained in:

committed by
Sebastian Serth

parent
15b9117382
commit
7454e577e4
@ -2,6 +2,7 @@ package nomad
|
||||
|
||||
import (
|
||||
nomadApi "github.com/hashicorp/nomad/api"
|
||||
"github.com/openHPI/poseidon/internal/config"
|
||||
"github.com/openHPI/poseidon/pkg/dto"
|
||||
"github.com/openHPI/poseidon/tests/helpers"
|
||||
"github.com/stretchr/testify/assert"
|
||||
@ -96,6 +97,27 @@ func TestFindOrCreateTask(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestSetForcePullFlag(t *testing.T) {
|
||||
_, job := helpers.CreateTemplateJob()
|
||||
taskGroup := FindAndValidateDefaultTaskGroup(job)
|
||||
task := FindAndValidateDefaultTask(taskGroup)
|
||||
|
||||
t.Run("Ignoring passed value if DisableForcePull", func(t *testing.T) {
|
||||
config.Config.Nomad.DisableForcePull = true
|
||||
SetForcePullFlag(job, true)
|
||||
assert.Equal(t, false, task.Config["force_pull"])
|
||||
})
|
||||
|
||||
t.Run("Using passed value if not DisableForcePull", func(t *testing.T) {
|
||||
config.Config.Nomad.DisableForcePull = false
|
||||
SetForcePullFlag(job, true)
|
||||
assert.Equal(t, true, task.Config["force_pull"])
|
||||
|
||||
SetForcePullFlag(job, false)
|
||||
assert.Equal(t, false, task.Config["force_pull"])
|
||||
})
|
||||
}
|
||||
|
||||
func TestIsEnvironmentTemplateID(t *testing.T) {
|
||||
assert.True(t, IsEnvironmentTemplateID("template-42"))
|
||||
assert.False(t, IsEnvironmentTemplateID("template-42-100"))
|
||||
|
Reference in New Issue
Block a user