本文整理汇总了Golang中github.com/docker/docker/pkg/log.Fataler类的典型用法代码示例。如果您正苦于以下问题:Golang Fataler类的具体用法?Golang Fataler怎么用?Golang Fataler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Fataler类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: getContainer
func getContainer(eng *engine.Engine, id string, t log.Fataler) *daemon.Container {
daemon := mkDaemonFromEngine(eng, t)
c := daemon.Get(id)
if c == nil {
t.Fatal(fmt.Errorf("No such container: %s", id))
}
return c
}
示例2: containerAttach
func containerAttach(eng *engine.Engine, id string, t log.Fataler) (io.WriteCloser, io.ReadCloser) {
c := getContainer(eng, id, t)
i, err := c.StdinPipe()
if err != nil {
t.Fatal(err)
}
o, err := c.StdoutPipe()
if err != nil {
t.Fatal(err)
}
return i, o
}
示例3: createNamedTestContainer
func createNamedTestContainer(eng *engine.Engine, config *runconfig.Config, f log.Fataler, name string) (shortId string) {
job := eng.Job("create", name)
if err := job.ImportEnv(config); err != nil {
f.Fatal(err)
}
var outputBuffer = bytes.NewBuffer(nil)
job.Stdout.Add(outputBuffer)
if err := job.Run(); err != nil {
f.Fatal(err)
}
return engine.Tail(outputBuffer, 1)
}
示例4: containerFileExists
func containerFileExists(eng *engine.Engine, id, dir string, t log.Fataler) bool {
c := getContainer(eng, id, t)
if err := c.Mount(); err != nil {
t.Fatal(err)
}
defer c.Unmount()
if _, err := os.Stat(path.Join(c.RootfsPath(), dir)); err != nil {
if os.IsNotExist(err) {
return false
}
t.Fatal(err)
}
return true
}
示例5: newTestEngine
func newTestEngine(t log.Fataler, autorestart bool, root string) *engine.Engine {
if root == "" {
if dir, err := newTestDirectory(unitTestStoreBase); err != nil {
t.Fatal(err)
} else {
root = dir
}
}
os.MkdirAll(root, 0700)
eng := engine.New()
eng.Logging = false
// Load default plugins
builtins.Register(eng)
// (This is manually copied and modified from main() until we have a more generic plugin system)
cfg := &daemon.Config{
Root: root,
AutoRestart: autorestart,
ExecDriver: "native",
// Either InterContainerCommunication or EnableIptables must be set,
// otherwise NewDaemon will fail because of conflicting settings.
InterContainerCommunication: true,
}
d, err := daemon.NewDaemon(cfg, eng)
if err != nil {
t.Fatal(err)
}
if err := d.Install(eng); err != nil {
t.Fatal(err)
}
return eng
}
示例6: startContainer
func startContainer(eng *engine.Engine, id string, t log.Fataler) {
job := eng.Job("start", id)
if err := job.Run(); err != nil {
t.Fatal(err)
}
}
示例7: assertHttpError
// assertHttpError expect the given response to have an error.
// Otherwise the it causes the test to fail.
func assertHttpError(r *httptest.ResponseRecorder, t log.Fataler) {
// Non-error http status are [200, 400)
if !(r.Code < http.StatusOK || r.Code >= http.StatusBadRequest) {
t.Fatal(fmt.Errorf("Unexpected http success code: %v", r.Code))
}
}
示例8: containerAssertNotExists
func containerAssertNotExists(eng *engine.Engine, id string, t log.Fataler) {
daemon := mkDaemonFromEngine(eng, t)
if c := daemon.Get(id); c != nil {
t.Fatal(fmt.Errorf("Container %s should not exist", id))
}
}
示例9: containerKill
func containerKill(eng *engine.Engine, id string, t log.Fataler) {
if err := eng.Job("kill", id).Run(); err != nil {
t.Fatal(err)
}
}