github.com/rawahars/moby@v24.0.4+incompatible/daemon/inspect_test.go (about) 1 package daemon // import "github.com/docker/docker/daemon" 2 3 import ( 4 "testing" 5 6 containertypes "github.com/docker/docker/api/types/container" 7 "github.com/docker/docker/container" 8 "github.com/docker/docker/daemon/config" 9 "gotest.tools/v3/assert" 10 is "gotest.tools/v3/assert/cmp" 11 ) 12 13 func TestGetInspectData(t *testing.T) { 14 c := &container.Container{ 15 ID: "inspect-me", 16 HostConfig: &containertypes.HostConfig{}, 17 State: container.NewState(), 18 ExecCommands: container.NewExecStore(), 19 } 20 21 d := &Daemon{ 22 linkIndex: newLinkIndex(), 23 configStore: &config.Config{}, 24 } 25 if d.UsesSnapshotter() { 26 t.Skip("does not apply to containerd snapshotters, which don't have RWLayer set") 27 } 28 _, err := d.getInspectData(c) 29 assert.Check(t, is.ErrorContains(err, "RWLayer of container inspect-me is unexpectedly nil")) 30 31 c.Dead = true 32 _, err = d.getInspectData(c) 33 assert.Check(t, err) 34 }