2014-10-23 07:27:06 +08:00
|
|
|
package libcontainer
|
|
|
|
|
|
|
|
import "testing"
|
|
|
|
|
|
|
|
func TestErrorCode(t *testing.T) {
|
|
|
|
codes := map[ErrorCode]string{
|
2016-09-22 20:15:54 +08:00
|
|
|
IdInUse: "Id already in use",
|
|
|
|
InvalidIdFormat: "Invalid format",
|
|
|
|
ContainerPaused: "Container paused",
|
|
|
|
ConfigInvalid: "Invalid configuration",
|
|
|
|
SystemError: "System error",
|
|
|
|
ContainerNotExists: "Container does not exist",
|
|
|
|
ContainerNotStopped: "Container is not stopped",
|
|
|
|
ContainerNotRunning: "Container is not running",
|
|
|
|
ConsoleExists: "Console exists for process",
|
|
|
|
ContainerNotPaused: "Container is not paused",
|
|
|
|
NoProcessOps: "No process operations",
|
2014-10-23 07:27:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
for code, expected := range codes {
|
|
|
|
if actual := code.String(); actual != expected {
|
|
|
|
t.Fatalf("expected string %q but received %q", expected, actual)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|