Skip to content
This repository was archived by the owner on Oct 13, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
1331808
Migrate volumes tests in integration-cli to api tests
yongtang Feb 12, 2018
15237fd
Migrate several docker rm tests to api tests
yongtang Feb 12, 2018
7aa342f
Update docker-py
yongtang Feb 23, 2018
fd75fd2
Clean the teardown process of network test
arm64b Feb 23, 2018
811b93a
Move containerIsStopped/containerIsInState to integration/internal/co…
yongtang Feb 22, 2018
89f42b5
Migrate some config secret tests to api test
yongtang Feb 22, 2018
b2ff741
Fix empty LogPath with non-blocking logging mode
braintreeps Feb 10, 2018
bae8ccd
Clean-up after container unit test
mnussbaum Feb 27, 2018
e4022bf
Migrate config inspect test to api test
yongtang Feb 26, 2018
8b54bcc
Migrate events tests to api tests
yongtang Feb 22, 2018
0fd259a
Remove docker_cli_secret_inspect_test.go
yongtang Feb 28, 2018
53a10ae
Enhancement of replacing ContainerCreate with helper funcs in tests
yongtang Feb 28, 2018
d4444e3
Fix "expected" and "actual" being reversed
thaJeztah Mar 1, 2018
e695ffe
Migrate export tests to api tests
yongtang Mar 1, 2018
1f529b2
Fixes some integration/container test to run on remote daemon
vdemeester Mar 2, 2018
618f290
Improvement in integration tests
yongtang Mar 2, 2018
6fbd783
Migrate docker rm tests to api tests
yongtang Mar 2, 2018
b3929fa
Remove unnecessary container.WithName in kill test
yongtang Mar 3, 2018
04ebff9
Address `expected` vs `actual` in integration tests
yongtang Mar 5, 2018
e945f93
Adds a unit test for plugin request timeout
cpuguy83 Mar 5, 2018
df6211f
Remove duplicate TestServiceUpdatePort
thaJeztah Mar 6, 2018
ae56939
Remove unnecessary diff tests
dnephin Mar 9, 2018
c25858e
TestLinksEtcHostsContentMatch: use container.Exec()
kolyshkin Mar 13, 2018
a354096
Add some tests to the volume store
cpuguy83 Mar 13, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/engine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ RUN set -x \
&& rm -rf "$GOPATH"

# Get the "docker-py" source so we can run their integration tests
ENV DOCKER_PY_COMMIT 5e28dcaace5f7b70cbe44c313b7a3b288fa38916
ENV DOCKER_PY_COMMIT 8b246db271a85d6541dc458838627e89c683e42f
# To run integration tests docker-pycreds is required.
RUN git clone https://github.com/docker/docker-py.git /docker-py \
&& cd /docker-py \
Expand Down
2 changes: 1 addition & 1 deletion components/engine/Dockerfile.aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ RUN set -x \
&& rm -rf "$GOPATH"

# Get the "docker-py" source so we can run their integration tests
ENV DOCKER_PY_COMMIT 5e28dcaace5f7b70cbe44c313b7a3b288fa38916
ENV DOCKER_PY_COMMIT 8b246db271a85d6541dc458838627e89c683e42f
# To run integration tests docker-pycreds is required.
RUN git clone https://github.com/docker/docker-py.git /docker-py \
&& cd /docker-py \
Expand Down
2 changes: 1 addition & 1 deletion components/engine/Dockerfile.armhf
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ RUN set -x \
&& rm -rf "$GOPATH"

# Get the "docker-py" source so we can run their integration tests
ENV DOCKER_PY_COMMIT 5e28dcaace5f7b70cbe44c313b7a3b288fa38916
ENV DOCKER_PY_COMMIT 8b246db271a85d6541dc458838627e89c683e42f
# To run integration tests docker-pycreds is required.
RUN git clone https://github.com/docker/docker-py.git /docker-py \
&& cd /docker-py \
Expand Down
2 changes: 1 addition & 1 deletion components/engine/Dockerfile.ppc64le
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ RUN set -x \
&& rm -rf "$GOPATH"

# Get the "docker-py" source so we can run their integration tests
ENV DOCKER_PY_COMMIT 5e28dcaace5f7b70cbe44c313b7a3b288fa38916
ENV DOCKER_PY_COMMIT 8b246db271a85d6541dc458838627e89c683e42f
# To run integration tests docker-pycreds is required.
RUN git clone https://github.com/docker/docker-py.git /docker-py \
&& cd /docker-py \
Expand Down
2 changes: 1 addition & 1 deletion components/engine/Dockerfile.s390x
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ RUN set -x \
&& rm -rf "$GOPATH"

# Get the "docker-py" source so we can run their integration tests
ENV DOCKER_PY_COMMIT 5e28dcaace5f7b70cbe44c313b7a3b288fa38916
ENV DOCKER_PY_COMMIT 8b246db271a85d6541dc458838627e89c683e42f
# To run integration tests docker-pycreds is required.
RUN git clone https://github.com/docker/docker-py.git /docker-py \
&& cd /docker-py \
Expand Down
9 changes: 3 additions & 6 deletions components/engine/container/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import (
"github.com/docker/docker/runconfig"
"github.com/docker/docker/volume"
"github.com/docker/go-connections/nat"
"github.com/docker/go-units"
units "github.com/docker/go-units"
"github.com/docker/libnetwork"
"github.com/docker/libnetwork/netlabel"
"github.com/docker/libnetwork/options"
Expand Down Expand Up @@ -391,6 +391,8 @@ func (container *Container) StartLogger() (logger.Logger, error) {
if err != nil {
return nil, err
}

container.LogPath = info.LogPath
}

l, err := initDriver(info)
Expand Down Expand Up @@ -974,11 +976,6 @@ func (container *Container) startLogging() error {
copier.Run()
container.LogDriver = l

// set LogPath field only for json-file logdriver
if jl, ok := l.(*jsonfilelog.JSONFileLogger); ok {
container.LogPath = jl.LogPath()
}

return nil
}

Expand Down
58 changes: 58 additions & 0 deletions components/engine/container/container_unit_test.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
package container // import "github.com/docker/docker/container"

import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"testing"

"github.com/docker/docker/api/types/container"
swarmtypes "github.com/docker/docker/api/types/swarm"
"github.com/docker/docker/daemon/logger/jsonfilelog"
"github.com/docker/docker/pkg/signal"
"github.com/stretchr/testify/require"
)

func TestContainerStopSignal(t *testing.T) {
Expand Down Expand Up @@ -66,3 +71,56 @@ func TestContainerSecretReferenceDestTarget(t *testing.T) {
t.Fatalf("expected secret dest %q; received %q", expected, d)
}
}

func TestContainerLogPathSetForJSONFileLogger(t *testing.T) {
containerRoot, err := ioutil.TempDir("", "TestContainerLogPathSetForJSONFileLogger")
require.NoError(t, err)
defer os.RemoveAll(containerRoot)

c := &Container{
Config: &container.Config{},
HostConfig: &container.HostConfig{
LogConfig: container.LogConfig{
Type: jsonfilelog.Name,
},
},
ID: "TestContainerLogPathSetForJSONFileLogger",
Root: containerRoot,
}

logger, err := c.StartLogger()
require.NoError(t, err)
defer logger.Close()

expectedLogPath, err := filepath.Abs(filepath.Join(containerRoot, fmt.Sprintf("%s-json.log", c.ID)))
require.NoError(t, err)
require.Equal(t, c.LogPath, expectedLogPath)
}

func TestContainerLogPathSetForRingLogger(t *testing.T) {
containerRoot, err := ioutil.TempDir("", "TestContainerLogPathSetForRingLogger")
require.NoError(t, err)
defer os.RemoveAll(containerRoot)

c := &Container{
Config: &container.Config{},
HostConfig: &container.HostConfig{
LogConfig: container.LogConfig{
Type: jsonfilelog.Name,
Config: map[string]string{
"mode": string(container.LogModeNonBlock),
},
},
},
ID: "TestContainerLogPathSetForRingLogger",
Root: containerRoot,
}

logger, err := c.StartLogger()
require.NoError(t, err)
defer logger.Close()

expectedLogPath, err := filepath.Abs(filepath.Join(containerRoot, fmt.Sprintf("%s-json.log", c.ID)))
require.NoError(t, err)
require.Equal(t, c.LogPath, expectedLogPath)
}
5 changes: 0 additions & 5 deletions components/engine/daemon/logger/jsonfilelog/jsonfilelog.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,6 @@ func ValidateLogOpt(cfg map[string]string) error {
return nil
}

// LogPath returns the location the given json logger logs to.
func (l *JSONFileLogger) LogPath() string {
return l.writer.LogPath()
}

// Close closes underlying file and signals all readers to stop.
func (l *JSONFileLogger) Close() error {
l.mu.Lock()
Expand Down
7 changes: 0 additions & 7 deletions components/engine/daemon/logger/loggerutils/logfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,6 @@ func rotate(name string, maxFiles int) error {
return nil
}

// LogPath returns the location the given writer logs to.
func (w *LogFile) LogPath() string {
w.mu.Lock()
defer w.mu.Unlock()
return w.f.Name()
}

// MaxFiles return maximum number of files
func (w *LogFile) MaxFiles() int {
return w.maxFiles
Expand Down
2 changes: 1 addition & 1 deletion components/engine/integration-cli/check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ type DockerSuite struct {
}

func (s *DockerSuite) OnTimeout(c *check.C) {
if !testEnv.IsLocalDaemon() {
if testEnv.IsRemoteDaemon() {
return
}
path := filepath.Join(os.Getenv("DEST"), "docker.pid")
Expand Down
74 changes: 0 additions & 74 deletions components/engine/integration-cli/docker_api_events_test.go

This file was deleted.

103 changes: 0 additions & 103 deletions components/engine/integration-cli/docker_api_volumes_test.go

This file was deleted.

Loading