2018-02-07 23:25:50 +00: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"
|
2020-02-07 13:39:24 +00:00
|
|
|
"gotest.tools/v3/assert"
|
|
|
|
is "gotest.tools/v3/assert/cmp"
|
2018-02-07 23:25:50 +00: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 19:28:34 +00:00
|
|
|
assert.Check(t, is.ErrorContains(err, ""))
|
2018-02-07 23:25:50 +00:00
|
|
|
|
|
|
|
c.Dead = true
|
|
|
|
_, err = d.getInspectData(c)
|
2018-03-13 19:28:34 +00:00
|
|
|
assert.Check(t, err)
|
2018-02-07 23:25:50 +00:00
|
|
|
}
|