Skip to content

Commit

Permalink
Merge pull request #1924 from yongtang/25696-stop-signal
Browse files Browse the repository at this point in the history
Add `StopSignal` to `ContainerSpec` for `--stop-signal`
  • Loading branch information
yongtang authored Feb 16, 2017
2 parents 120fae7 + 2167d44 commit 6bc357e
Show file tree
Hide file tree
Showing 4 changed files with 176 additions and 109 deletions.
1 change: 1 addition & 0 deletions agent/exec/container/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ func (c *containerConfig) exposedPorts() map[nat.Port]struct{} {
func (c *containerConfig) config() *enginecontainer.Config {
config := &enginecontainer.Config{
Labels: c.labels(),
StopSignal: c.spec().StopSignal,
User: c.spec().User,
Hostname: c.spec().Hostname,
Env: c.spec().Env,
Expand Down
18 changes: 18 additions & 0 deletions agent/exec/container/container_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,21 @@ func TestExtraHosts(t *testing.T) {
t.Fatalf("expected %s, got %s", expected, actual)
}
}

func TestStopSignal(t *testing.T) {
c := containerConfig{
task: &api.Task{
Spec: api.TaskSpec{Runtime: &api.TaskSpec_Container{
Container: &api.ContainerSpec{
StopSignal: "SIGWINCH",
},
}},
},
}

expected := "SIGWINCH"
actual := c.config().StopSignal
if actual != expected {
t.Fatalf("expected %s, got %s", expected, actual)
}
}
Loading

0 comments on commit 6bc357e

Please sign in to comment.