2015-11-12 14:55:17 -05:00
|
|
|
package container
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/docker/docker/pkg/signal"
|
2016-01-04 19:05:26 -05:00
|
|
|
"github.com/docker/engine-api/types/container"
|
2015-11-12 14:55:17 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestContainerStopSignal(t *testing.T) {
|
|
|
|
c := &Container{
|
|
|
|
CommonContainer: CommonContainer{
|
2015-12-18 13:36:17 -05:00
|
|
|
Config: &container.Config{},
|
2015-11-12 14:55:17 -05:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
def, err := signal.ParseSignal(signal.DefaultStopSignal)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
s := c.StopSignal()
|
|
|
|
if s != int(def) {
|
|
|
|
t.Fatalf("Expected %v, got %v", def, s)
|
|
|
|
}
|
|
|
|
|
|
|
|
c = &Container{
|
|
|
|
CommonContainer: CommonContainer{
|
2015-12-18 13:36:17 -05:00
|
|
|
Config: &container.Config{StopSignal: "SIGKILL"},
|
2015-11-12 14:55:17 -05:00
|
|
|
},
|
|
|
|
}
|
|
|
|
s = c.StopSignal()
|
|
|
|
if s != 9 {
|
|
|
|
t.Fatalf("Expected 9, got %v", s)
|
|
|
|
}
|
|
|
|
}
|