Skip to content

Commit

Permalink
add test for kill signal in required signals
Browse files Browse the repository at this point in the history
update changelog
  • Loading branch information
chelseakomlo committed Dec 7, 2017
1 parent f09e3ec commit 7d8dda8
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ __BACKWARDS INCOMPATIBILITIES:__
IMPROVEMENTS:
* core: Allow operators to reload TLS certificate and key files via SIGHUP
[GH-3479]
* core: allow configurable stop signals for a task, when drivers support
sending stop signals. [GH-1755]
* core: Allow agents to be run in `rpc_upgrade_mode` when migrating a cluster
to TLS rather than changing `heartbeat_grace`
* api: Allocations now track and return modify time in addition to create time
Expand All @@ -30,7 +32,6 @@ IMPROVEMENTS:
* driver/docker: Adds support for `ulimit` and `sysctl` options [GH-3568]
* driver/docker: Adds support for StopTimeout (set to the same value as
kill_timeout [GH-3601]
* driver/exec: allow controlling the stop signal in exec/raw_exec [GH-1755]
* driver/rkt: Add support for passing through user [GH-3612]
* driver/qemu: Support graceful shutdowns on unix platforms [GH-3411]
* template: Updated to consul template 0.19.4 [GH-3543]
Expand Down
4 changes: 3 additions & 1 deletion nomad/structs/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -3228,7 +3228,9 @@ type Task struct {
ShutdownDelay time.Duration

// The kill signal to use for the task. This is an optional specification,
// and if not set, the driver will default to SIGINT

// KillSignal is the kill signal to use for the task. This is an optional
// specification and defaults to SIGINT
KillSignal string
}

Expand Down
24 changes: 24 additions & 0 deletions nomad/structs/structs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,26 @@ func TestJob_RequiredSignals(t *testing.T) {
},
}

j2 := &Job{
TaskGroups: []*TaskGroup{
{
Name: "foo",
Tasks: []*Task{
{
Name: "t1",
KillSignal: "SIGQUIT",
},
},
},
},
}

e2 := map[string]map[string][]string{
"foo": {
"t1": {"SIGQUIT"},
},
}

cases := []struct {
Job *Job
Expected map[string]map[string][]string
Expand All @@ -818,6 +838,10 @@ func TestJob_RequiredSignals(t *testing.T) {
Job: j1,
Expected: e1,
},
{
Job: j2,
Expected: e2,
},
}

for i, c := range cases {
Expand Down

0 comments on commit 7d8dda8

Please sign in to comment.