Revert "Merge pull request #16228 from duglin/ContextualizeEvents"

Although having a request ID available throughout the codebase is very
valuable, the impact of requiring a Context as an argument to every
function in the codepath of an API request, is too significant and was
not properly understood at the time of the review.

Furthermore, mixing API-layer code with non-API-layer code makes the
latter usable only by API-layer code (one that has a notion of Context).

This reverts commit de41640435, reversing
changes made to 7daeecd42d.

Signed-off-by: Tibor Vass <tibor@docker.com>

Conflicts:
	api/server/container.go
	builder/internals.go
	daemon/container_unix.go
	daemon/create.go
This commit is contained in:
Tibor Vass
2015-09-29 13:51:40 -04:00
parent 79c31f4b13
commit b08f071e18
68 changed files with 564 additions and 736 deletions

View File

@@ -8,7 +8,6 @@ import (
"path/filepath"
"testing"
"github.com/docker/docker/context"
"github.com/docker/docker/pkg/graphdb"
"github.com/docker/docker/pkg/stringid"
"github.com/docker/docker/pkg/truncindex"
@@ -93,34 +92,32 @@ func TestGet(t *testing.T) {
containerGraphDB: graph,
}
ctx := context.Background()
if container, _ := daemon.Get(ctx, "3cdbd1aa394fd68559fd1441d6eff2ab7c1e6363582c82febfaa8045df3bd8de"); container != c2 {
if container, _ := daemon.Get("3cdbd1aa394fd68559fd1441d6eff2ab7c1e6363582c82febfaa8045df3bd8de"); container != c2 {
t.Fatal("Should explicitly match full container IDs")
}
if container, _ := daemon.Get(ctx, "75fb0b8009"); container != c4 {
if container, _ := daemon.Get("75fb0b8009"); container != c4 {
t.Fatal("Should match a partial ID")
}
if container, _ := daemon.Get(ctx, "drunk_hawking"); container != c2 {
if container, _ := daemon.Get("drunk_hawking"); container != c2 {
t.Fatal("Should match a full name")
}
// c3.Name is a partial match for both c3.ID and c2.ID
if c, _ := daemon.Get(ctx, "3cdbd1aa"); c != c3 {
if c, _ := daemon.Get("3cdbd1aa"); c != c3 {
t.Fatal("Should match a full name even though it collides with another container's ID")
}
if container, _ := daemon.Get(ctx, "d22d69a2b896"); container != c5 {
if container, _ := daemon.Get("d22d69a2b896"); container != c5 {
t.Fatal("Should match a container where the provided prefix is an exact match to the it's name, and is also a prefix for it's ID")
}
if _, err := daemon.Get(ctx, "3cdbd1"); err == nil {
if _, err := daemon.Get("3cdbd1"); err == nil {
t.Fatal("Should return an error when provided a prefix that partially matches multiple container ID's")
}
if _, err := daemon.Get(ctx, "nothing"); err == nil {
if _, err := daemon.Get("nothing"); err == nil {
t.Fatal("Should return an error when provided a prefix that is neither a name or a partial match to an ID")
}
@@ -489,15 +486,13 @@ func TestRemoveLocalVolumesFollowingSymlinks(t *testing.T) {
t.Fatalf("Expected 1 volume mounted, was 0\n")
}
ctx := context.Background()
m := c.MountPoints["/vol1"]
_, err = daemon.VolumeCreate(ctx, m.Name, m.Driver, nil)
_, err = daemon.VolumeCreate(m.Name, m.Driver, nil)
if err != nil {
t.Fatal(err)
}
if err := daemon.VolumeRm(ctx, m.Name); err != nil {
if err := daemon.VolumeRm(m.Name); err != nil {
t.Fatal(err)
}