mirror of
https://github.com/kemko/nomad.git
synced 2026-01-05 01:45:44 +03:00
Merge branch 'master' into f-grpc-executor
* master: (71 commits) Fix output of 'nomad deployment fail' with no arg Always create a running allocation when testing task state tests: ensure exec tests pass valid task resources (#4992) some changes for more idiomatic code fix iops related tests fixed bug in loop delay gofmt improved code for readability client: updateAlloc release lock after read fixup! device attributes in `nomad node status -verbose` drivers/exec: support device binds and mounts fix iops bug and increase test matrix coverage tests: tag image explicitly changelog ci: install lxc-templates explicitly tests: skip checking rdma cgroup ci: use Ubuntu 16.04 (Xenial) in TravisCI client: update driver info on new fingerprint drivers/docker: enforce volumes.enabled (#4983) client: Style: use fluent style for building loggers ...
This commit is contained in:
@@ -338,6 +338,8 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *cstru
|
||||
TaskDir: cfg.TaskDir().Dir,
|
||||
StdoutPath: cfg.StdoutPath,
|
||||
StderrPath: cfg.StderrPath,
|
||||
Mounts: cfg.Mounts,
|
||||
Devices: cfg.Devices,
|
||||
}
|
||||
|
||||
ps, err := exec.Launch(execCmd)
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package java
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
dtestutil "github.com/hashicorp/nomad/plugins/drivers/testutils"
|
||||
@@ -107,7 +107,7 @@ func TestJavaDriver_Jar_Stop_Wait(t *testing.T) {
|
||||
|
||||
task := basicTask(t, "demo-app", map[string]interface{}{
|
||||
"jar_path": "demoapp.jar",
|
||||
"args": []string{"20"},
|
||||
"args": []string{"600"},
|
||||
"jvm_options": []string{"-Xmx64m", "-Xms32m"},
|
||||
})
|
||||
|
||||
@@ -122,40 +122,36 @@ func TestJavaDriver_Jar_Stop_Wait(t *testing.T) {
|
||||
ch, err := harness.WaitTask(context.Background(), handle.Config.ID)
|
||||
require.NoError(err)
|
||||
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
result := <-ch
|
||||
require.Equal(2, result.Signal)
|
||||
}()
|
||||
|
||||
require.NoError(harness.WaitUntilStarted(task.ID, 1*time.Second))
|
||||
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
err := harness.StopTask(task.ID, 2*time.Second, "SIGINT")
|
||||
require.NoError(err)
|
||||
}()
|
||||
|
||||
waitCh := make(chan struct{})
|
||||
go func() {
|
||||
defer close(waitCh)
|
||||
wg.Wait()
|
||||
harness.StopTask(task.ID, 2*time.Second, "SIGINT")
|
||||
}()
|
||||
|
||||
select {
|
||||
case <-waitCh:
|
||||
status, err := harness.InspectTask(task.ID)
|
||||
require.NoError(err)
|
||||
require.Equal(drivers.TaskStateExited, status.State)
|
||||
case <-time.After(5 * time.Second):
|
||||
case result := <-ch:
|
||||
require.False(result.Successful())
|
||||
case <-time.After(10 * time.Second):
|
||||
require.Fail("timeout waiting for task to shutdown")
|
||||
}
|
||||
|
||||
// Ensure that the task is marked as dead, but account
|
||||
// for WaitTask() closing channel before internal state is updated
|
||||
testutil.WaitForResult(func() (bool, error) {
|
||||
status, err := harness.InspectTask(task.ID)
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("inspecting task failed: %v", err)
|
||||
}
|
||||
if status.State != drivers.TaskStateExited {
|
||||
return false, fmt.Errorf("task hasn't exited yet; status: %v", status.State)
|
||||
}
|
||||
|
||||
return true, nil
|
||||
}, func(err error) {
|
||||
require.NoError(err)
|
||||
})
|
||||
|
||||
require.NoError(harness.DestroyTask(task.ID, true))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user