mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
6bb0d1816a
So other packages don't need to import the daemon package when they want to use this struct. Signed-off-by: David Calavera <david.calavera@gmail.com> Signed-off-by: Tibor Vass <tibor@docker.com>
36 lines
629 B
Go
36 lines
629 B
Go
package container
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/docker/docker/pkg/signal"
|
|
"github.com/docker/docker/runconfig"
|
|
)
|
|
|
|
func TestContainerStopSignal(t *testing.T) {
|
|
c := &Container{
|
|
CommonContainer: CommonContainer{
|
|
Config: &runconfig.Config{},
|
|
},
|
|
}
|
|
|
|
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{
|
|
Config: &runconfig.Config{StopSignal: "SIGKILL"},
|
|
},
|
|
}
|
|
s = c.StopSignal()
|
|
if s != 9 {
|
|
t.Fatalf("Expected 9, got %v", s)
|
|
}
|
|
}
|