mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
4bafaa00aa
The containerd client is very chatty at the best of times. Because the libcontained API is stateless and references containers and processes by string ID for every method call, the implementation is essentially forced to use the containerd client in a way which amplifies the number of redundant RPCs invoked to perform any operation. The libcontainerd remote implementation has to reload the containerd container, task and/or process metadata for nearly every operation. This in turn amplifies the number of context switches between dockerd and containerd to perform any container operation or handle a containerd event, increasing the load on the system which could otherwise be allocated to workloads. Overhaul the libcontainerd interface to reduce the impedance mismatch with the containerd client so that the containerd client can be used more efficiently. Split the API out into container, task and process interfaces which the consumer is expected to retain so that libcontainerd can retain state---especially the analogous containerd client objects---without having to manage any state-store inside the libcontainerd client. Signed-off-by: Cory Snider <csnider@mirantis.com>
32 lines
742 B
Go
32 lines
742 B
Go
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"
|
|
"gotest.tools/v3/assert"
|
|
is "gotest.tools/v3/assert/cmp"
|
|
)
|
|
|
|
func TestGetInspectData(t *testing.T) {
|
|
c := &container.Container{
|
|
ID: "inspect-me",
|
|
HostConfig: &containertypes.HostConfig{},
|
|
State: container.NewState(),
|
|
ExecCommands: container.NewExecStore(),
|
|
}
|
|
|
|
d := &Daemon{
|
|
linkIndex: newLinkIndex(),
|
|
configStore: &config.Config{},
|
|
}
|
|
|
|
_, err := d.getInspectData(c)
|
|
assert.Check(t, is.ErrorContains(err, ""))
|
|
|
|
c.Dead = true
|
|
_, err = d.getInspectData(c)
|
|
assert.Check(t, err)
|
|
}
|