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"
|
2020-02-07 08:39:24 -05:00
|
|
|
"gotest.tools/v3/assert"
|
|
|
|
is "gotest.tools/v3/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(),
|
2022-05-10 15:59:00 -04:00
|
|
|
ExecCommands: container.NewExecStore(),
|
2018-02-07 18:25:50 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
}
|