mirror of
https://github.com/kemko/nomad.git
synced 2026-01-07 10:55:42 +03:00
Switch tests to mock_driver
This commit is contained in:
@@ -135,21 +135,12 @@ func TestAllocRunner_RetryArtifact(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAllocRunner_TerminalUpdate_Destroy(t *testing.T) {
|
||||
ctestutil.ExecCompatible(t)
|
||||
upd, ar := testAllocRunner(false)
|
||||
|
||||
// Shrink chroot
|
||||
ar.config.ChrootEnv = map[string]string{
|
||||
"/bin": "/bin",
|
||||
"/lib": "/lib",
|
||||
"/lib32": "/lib32",
|
||||
"/lib64": "/lib64",
|
||||
}
|
||||
|
||||
// Ensure task takes some time
|
||||
task := ar.alloc.Job.TaskGroups[0].Tasks[0]
|
||||
task.Config["command"] = "/bin/sleep"
|
||||
task.Config["args"] = []string{"10"}
|
||||
task.Driver = "mock_driver"
|
||||
task.Config["run_for"] = "10s"
|
||||
go ar.Run()
|
||||
|
||||
testutil.WaitForResult(func() (bool, error) {
|
||||
@@ -242,21 +233,12 @@ func TestAllocRunner_TerminalUpdate_Destroy(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAllocRunner_Destroy(t *testing.T) {
|
||||
ctestutil.ExecCompatible(t)
|
||||
upd, ar := testAllocRunner(false)
|
||||
|
||||
// Shrink chroot
|
||||
ar.config.ChrootEnv = map[string]string{
|
||||
"/bin": "/bin",
|
||||
"/lib": "/lib",
|
||||
"/lib32": "/lib32",
|
||||
"/lib64": "/lib64",
|
||||
}
|
||||
|
||||
// Ensure task takes some time
|
||||
task := ar.alloc.Job.TaskGroups[0].Tasks[0]
|
||||
task.Config["command"] = "/bin/sleep"
|
||||
task.Config["args"] = []string{"10"}
|
||||
task.Driver = "mock_driver"
|
||||
task.Config["run_for"] = "10s"
|
||||
go ar.Run()
|
||||
start := time.Now()
|
||||
|
||||
@@ -306,13 +288,12 @@ func TestAllocRunner_Destroy(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAllocRunner_Update(t *testing.T) {
|
||||
ctestutil.ExecCompatible(t)
|
||||
_, ar := testAllocRunner(false)
|
||||
|
||||
// Ensure task takes some time
|
||||
task := ar.alloc.Job.TaskGroups[0].Tasks[0]
|
||||
task.Config["command"] = "/bin/sleep"
|
||||
task.Config["args"] = []string{"10"}
|
||||
task.Driver = "mock_driver"
|
||||
task.Config["run_for"] = "10s"
|
||||
go ar.Run()
|
||||
defer ar.Destroy()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user