2018-02-07 18:25:50 -05:00
|
|
|
package daemon // import "github.com/docker/docker/daemon"
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
containertypes "github.com/docker/docker/api/types/container"
|
|
|
|
"github.com/docker/docker/container"
|
|
|
|
"github.com/docker/docker/daemon/config"
|
|
|
|
"github.com/docker/docker/daemon/exec"
|
2018-03-13 15:28:34 -04:00
|
|
|
"github.com/gotestyourself/gotestyourself/assert"
|
|
|
|
is "github.com/gotestyourself/gotestyourself/assert/cmp"
|
2018-02-07 18:25:50 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestGetInspectData(t *testing.T) {
|
|
|
|
c := &container.Container{
|
|
|
|
ID: "inspect-me",
|
|
|
|
HostConfig: &containertypes.HostConfig{},
|
|
|
|
State: container.NewState(),
|
|
|
|
ExecCommands: exec.NewStore(),
|
|
|
|
}
|
|
|
|
|
|
|
|
d := &Daemon{
|
|
|
|
linkIndex: newLinkIndex(),
|
|
|
|
configStore: &config.Config{},
|
|
|
|
}
|
|
|
|
|
|
|
|
_, err := d.getInspectData(c)
|
2018-03-13 15:28:34 -04:00
|
|
|
assert.Check(t, is.ErrorContains(err, ""))
|
2018-02-07 18:25:50 -05:00
|
|
|
|
|
|
|
c.Dead = true
|
|
|
|
_, err = d.getInspectData(c)
|
2018-03-13 15:28:34 -04:00
|
|
|
assert.Check(t, err)
|
2018-02-07 18:25:50 -05:00
|
|
|
}
|