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
78 commits
Select commit Hold shift + click to select a range
6d8fbac
Configure log-format earlier, and small refactor
thaJeztah Nov 24, 2018
1bda75e
migrated container wait integration tests from integration-cli to int…
adshmh Jul 23, 2018
5cde2dd
[18.09] integration/internal: add new test options
AkihiroSuda Oct 10, 2018
7985bd8
integration/container: add a base test for C/R
avagin Dec 29, 2018
4ac5dba
Fix CheckpointList
avagin Dec 29, 2018
9fa7f6c
Temporarily disable TestCheckpoint
thaJeztah Apr 1, 2019
9f02d3b
integration: change network.CreateNoError signature to fix linting
thaJeztah Jun 6, 2019
c82cbe9
integration: change container.Create signature to fix linting
thaJeztah Jun 6, 2019
85c5aab
integration: change container.Run signature to fix linting
thaJeztah Jun 6, 2019
2eb2aaf
integration: change createAmbiguousNetworks signature to fix linting
thaJeztah Jun 6, 2019
e91e9c3
integration: change testGraphDriver signature to fix linting
thaJeztah Jun 6, 2019
4005149
integration: get tests to compile again
Jun 12, 2019
e9bd47a
Revert "integration: have container.Create call compile"
thaJeztah Oct 8, 2019
4aae081
Revert "Fixing integration test"
thaJeztah Oct 8, 2019
a5620fc
TestServiceWithDefaultAddressPoolInit
selansen Sep 13, 2018
93de6ed
Add TC to check dyanmic subnet for ingress network
Sep 20, 2019
8c60be3
integration-cli/build: don't panic
kolyshkin Dec 21, 2018
e42b14a
*: remove interfacer linter from CI
cyphar Mar 12, 2019
5c1aea7
integration-cli: don't build -test images if they already exist
cyphar Mar 12, 2019
6cc5e98
internal: test/env: switch to assert.TestingT
cyphar Mar 12, 2019
266674a
Integration: remove unneeded platform check for IPVLAN tests
thaJeztah Jun 28, 2019
989a8a6
Integration: IPVlan add missing import comment
thaJeztah Jun 28, 2019
4ecaa08
Integration: exclude IPVlan test-suite on Windows
thaJeztah Jul 11, 2019
bd195d0
Integration: remove redundant kernel version check for MACVlan
thaJeztah Jun 28, 2019
e5493c4
Integration: MACVlan add missing import comment and build-tag
thaJeztah Jun 28, 2019
3ca37e6
integration-cli: remove ExecSupport check
thaJeztah Jul 8, 2019
0a071f7
integration-cli: remove defaultSleepImage constant
thaJeztah Jul 8, 2019
9fc8134
integration-cli: remove unused requirements utils
thaJeztah Jul 8, 2019
4fb6f3f
Add containerd.WithTimeout(60*time.Second) to match old calls
Aug 22, 2018
cbd8227
Add (hidden) flags to set containerd namespaces
cpuguy83 Jul 11, 2019
34024ad
integration: fix cleanup of raft data
thaJeztah Jul 12, 2019
0f2b3f6
Optimize test daemon startup
cpuguy83 Apr 17, 2019
0ba4e3e
Add log entries for daemon startup/shutdown
cpuguy83 Apr 19, 2019
b773f3c
Improve select for daemon restart tests
crosbymichael Jul 2, 2019
81966d1
Don't log test initial test daemon ping failures
cpuguy83 Jul 12, 2019
7fb18ca
Fix Microsecond -> Milisecond.
cpuguy83 Jul 13, 2019
943bb6a
DockerSwarmSuite lock portIndex to work around race
thaJeztah Jul 13, 2019
bc63fef
Be more conservative for Windows in TestFrequency for Splunk
ddebroy Jul 17, 2019
743c961
Testing: create new daemon (only) if needed
thaJeztah Dec 24, 2018
72c8a91
integration: run build session tests on non-experimental
thaJeztah Jul 17, 2019
99725d6
integration-cli: increase healthcheck timeout
tonistiigi Jul 18, 2019
5905728
Retry service updates on out of sequence errors
dperny Jul 18, 2019
147c94d
integration-cli: remove redundant "testrequires"
thaJeztah Jul 19, 2019
48bfa1d
Add `FromClient` to test env execution
cpuguy83 Jul 24, 2019
03c4cf7
Better logging for swarm tests
cpuguy83 Jul 24, 2019
e1dc7f1
hack: Remove inContainer check, it wasn't useful
seemethere Jul 24, 2019
0de5218
Fix flaky TestServiceWithDefaultAddressPoolInit
Aug 5, 2019
8c69826
Move defer method to the top right after New is called
Aug 15, 2019
eed1ea0
Windows:Disable 2 restart test when Hyper-V
Feb 22, 2019
033474e
integration-cli/requirements: Skip windows specific isolation require…
Snorch Aug 7, 2019
baae46a
Dockerfile: update CRIU to v3.12
thaJeztah Aug 14, 2019
47c2af9
pkg/term: refactor TestEscapeProxyRead
thaJeztah Aug 27, 2019
81f3399
integration: windows.ps1: turn defender error into a warning
thaJeztah Aug 27, 2019
63c9022
LCOW: Log stderr on failures
Mar 8, 2018
fa1a38d
TestDispatch: refactor to use subtests again, and fix linting (struct…
thaJeztah Aug 27, 2019
27e9144
integration-cli: getContainerCount() fix trimming prefix
thaJeztah Aug 28, 2019
6e6c1ac
Fix docker inspect for dutimgVersion
StefanScherer Aug 30, 2019
b5a2940
integration-cli: fix some bashism's in Dockerfiles
thaJeztah Sep 2, 2019
d01572e
TestBuildSquashParent: fix non-standard comparisson
thaJeztah Sep 2, 2019
0f8e14d
hack/make/binary-daemon: fix some linting issues
thaJeztah Aug 31, 2019
49afe72
TestCase: use `icmd.RunCmd` instead `icmd.StartCmd`
tao12345666333 Sep 2, 2019
bec7a85
hack/ci/windows.ps1: explicitly set exit code to result of tests
thaJeztah Sep 2, 2019
5ed27d1
hack/ci/windows.ps1 print all environment variables to check how Jenk…
thaJeztah Sep 6, 2019
69ee162
integration-cli: update TestCreateWithWorkdir for Hyper-V isolation
thaJeztah Sep 4, 2019
65dc979
hack/ci/windows.ps1: add support for DOCKER_STORAGE_OPTS
thaJeztah Sep 4, 2019
2cf0f0a
hack/ci/windows.ps1: stop tailing logs after stopping the daemon
thaJeztah Sep 6, 2019
ef77905
Fix Service TTY test so signal handlers work
cpuguy83 Sep 9, 2019
9544f87
integration-cli: swarm.RestartNode(); don't load busybox again
thaJeztah Sep 9, 2019
9bc5695
integration-cli: add daemon.StartNodeWithBusybox function
thaJeztah Sep 9, 2019
6e1a428
Windows: skip flaky TestLogBlocking
thaJeztah Sep 9, 2019
d236d18
awslogs: fix flaky TestLogBlocking unit test
samuelkarp Sep 20, 2019
a6d21bd
Fix more signal handling issues in tests.
cpuguy83 Sep 9, 2019
d88eaeb
Disable TestPsListContainersFilterExited (Windows)
Sep 17, 2019
b739525
integration-cli: run goimports
Sep 19, 2019
5766d99
[18.09] change c.Skip() to testRequires()
thaJeztah Oct 8, 2019
c3bc5d2
hack/test/unit: fix custom TESTFLAGS not working
thaJeztah Sep 13, 2019
9826c3e
[18.09] TEMPORARILY DISABLE FLAKY TEST CHECK
thaJeztah Oct 23, 2019
d4a5e65
TESTING: SKIP TestSwarmVolumePlugin
thaJeztah Oct 24, 2019
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
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ RUN sed -ri "s/(httpredir|deb).debian.org/${APT_MIRROR:-deb.debian.org}/g" /etc/
FROM base AS criu
ARG DEBIAN_FRONTEND
# Install CRIU for checkpoint/restore support
ENV CRIU_VERSION 3.6
ENV CRIU_VERSION 3.12
# Install dependency packages specific to criu
RUN apt-get update && apt-get install -y --no-install-recommends \
libnet-dev \
Expand Down Expand Up @@ -251,6 +251,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
zip \
bzip2 \
xz-utils \
libprotobuf-c1 \
libnet1 \
libnl-3-200 \
&& rm -rf /var/lib/apt/lists/*

RUN pip3 install yamllint==1.16.0
Expand Down
80 changes: 38 additions & 42 deletions builder/dockerfile/evaluator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package dockerfile // import "github.com/docker/docker/builder/dockerfile"

import (
"os"
"runtime"
"testing"

"github.com/docker/docker/builder/remotecontext"
Expand All @@ -23,8 +24,11 @@ func init() {
reexec.Init()
}

func initDispatchTestCases() []dispatchTestCase {
dispatchTestCases := []dispatchTestCase{
func TestDispatch(t *testing.T) {
if runtime.GOOS != "windows" {
skip.If(t, os.Getuid() != 0, "skipping test that requires root")
}
testCases := []dispatchTestCase{
{
name: "ADD multiple files to file",
cmd: &instructions.AddCommand{SourcesAndDest: instructions.SourcesAndDest{
Expand Down Expand Up @@ -91,54 +95,46 @@ func initDispatchTestCases() []dispatchTestCase {
}},
expectedError: "source can't be a URL for COPY",
files: nil,
}}

return dispatchTestCases
}

func TestDispatch(t *testing.T) {
skip.If(t, os.Getuid() != 0, "skipping test that requires root")
testCases := initDispatchTestCases()

for _, testCase := range testCases {
executeTestCase(t, testCase)
},
}
}

func executeTestCase(t *testing.T, testCase dispatchTestCase) {
contextDir, cleanup := createTestTempDir(t, "", "builder-dockerfile-test")
defer cleanup()
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
contextDir, cleanup := createTestTempDir(t, "", "builder-dockerfile-test")
defer cleanup()

for filename, content := range testCase.files {
createTestTempFile(t, contextDir, filename, content, 0777)
}
for filename, content := range tc.files {
createTestTempFile(t, contextDir, filename, content, 0777)
}

tarStream, err := archive.Tar(contextDir, archive.Uncompressed)
tarStream, err := archive.Tar(contextDir, archive.Uncompressed)

if err != nil {
t.Fatalf("Error when creating tar stream: %s", err)
}
if err != nil {
t.Fatalf("Error when creating tar stream: %s", err)
}

defer func() {
if err = tarStream.Close(); err != nil {
t.Fatalf("Error when closing tar stream: %s", err)
}
}()
defer func() {
if err = tarStream.Close(); err != nil {
t.Fatalf("Error when closing tar stream: %s", err)
}
}()

context, err := remotecontext.FromArchive(tarStream)
context, err := remotecontext.FromArchive(tarStream)

if err != nil {
t.Fatalf("Error when creating tar context: %s", err)
}
if err != nil {
t.Fatalf("Error when creating tar context: %s", err)
}

defer func() {
if err = context.Close(); err != nil {
t.Fatalf("Error when closing tar context: %s", err)
}
}()
defer func() {
if err = context.Close(); err != nil {
t.Fatalf("Error when closing tar context: %s", err)
}
}()

b := newBuilderWithMockBackend()
sb := newDispatchRequest(b, '`', context, NewBuildArgs(make(map[string]*string)), newStagesBuildResults())
err = dispatch(sb, testCase.cmd)
assert.Check(t, is.ErrorContains(err, testCase.expectedError))
b := newBuilderWithMockBackend()
sb := newDispatchRequest(b, '`', context, NewBuildArgs(make(map[string]*string)), newStagesBuildResults())
err = dispatch(sb, tc.cmd)
assert.Check(t, is.ErrorContains(err, tc.expectedError))
})
}
}
9 changes: 7 additions & 2 deletions builder/dockerfile/internals_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ func TestDockerfileOutsideTheBuildContext(t *testing.T) {
defer cleanup()

expectedError := "Forbidden path outside the build context: ../../Dockerfile ()"
if runtime.GOOS == "windows" {
expectedError = "failed to resolve scoped path ../../Dockerfile ()"
}

readAndCheckDockerfile(t, "DockerfileOutsideTheBuildContext", contextDir, "../../Dockerfile", expectedError)
}
Expand All @@ -61,7 +64,9 @@ func TestNonExistingDockerfile(t *testing.T) {
}

func readAndCheckDockerfile(t *testing.T, testName, contextDir, dockerfilePath, expectedError string) {
skip.If(t, os.Getuid() != 0, "skipping test that requires root")
if runtime.GOOS != "windows" {
skip.If(t, os.Getuid() != 0, "skipping test that requires root")
}
tarStream, err := archive.Tar(contextDir, archive.Uncompressed)
assert.NilError(t, err)

Expand All @@ -80,7 +85,7 @@ func readAndCheckDockerfile(t *testing.T, testName, contextDir, dockerfilePath,
Source: tarStream,
}
_, _, err = remotecontext.Detect(config)
assert.Check(t, is.Error(err, expectedError))
assert.Check(t, is.ErrorContains(err, expectedError))
}

func TestCopyRunConfig(t *testing.T) {
Expand Down
9 changes: 9 additions & 0 deletions cmd/dockerd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ package main
import (
"runtime"

"github.com/docker/docker/daemon"
"github.com/docker/docker/daemon/config"
"github.com/docker/docker/opts"
"github.com/docker/docker/plugin/executor/containerd"
"github.com/docker/docker/registry"
"github.com/spf13/pflag"
)
Expand Down Expand Up @@ -80,6 +82,13 @@ func installCommonConfigFlags(conf *config.Config, flags *pflag.FlagSet) {

conf.MaxConcurrentDownloads = &maxConcurrentDownloads
conf.MaxConcurrentUploads = &maxConcurrentUploads

flags.StringVar(&conf.ContainerdNamespace, "containerd-namespace", daemon.ContainersNamespace, "Containerd namespace to use")
if err := flags.MarkHidden("containerd-namespace"); err != nil {
return
}
flags.StringVar(&conf.ContainerdPluginNamespace, "containerd-plugins-namespace", containerd.PluginNamespace, "Containerd namespace to use for plugins")
flags.MarkHidden("containerd-plugins-namespace")
}

func installRegistryServiceFlags(options *registry.ServiceOptions, flags *pflag.FlagSet) {
Expand Down
36 changes: 27 additions & 9 deletions cmd/dockerd/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ func (cli *DaemonCli) start(opts *daemonOptions) (err error) {
if cli.Config, err = loadDaemonCliConfig(opts); err != nil {
return err
}

if err := configureDaemonLogs(cli.Config); err != nil {
return err
}

logrus.Info("Starting up")

cli.configFile = &opts.configFile
cli.flags = opts.flags

Expand All @@ -94,12 +101,6 @@ func (cli *DaemonCli) start(opts *daemonOptions) (err error) {
logrus.Warn("Running experimental build")
}

logrus.SetFormatter(&logrus.TextFormatter{
TimestampFormat: jsonmessage.RFC3339NanoFixed,
DisableColors: cli.Config.RawLogs,
FullTimestamp: true,
})

system.InitLCOW(cli.Config.Experimental)

if err := setDefaultUmask(); err != nil {
Expand Down Expand Up @@ -249,6 +250,7 @@ func (cli *DaemonCli) start(opts *daemonOptions) (err error) {
return fmt.Errorf("Shutting down due to ServeAPI error: %v", errAPI)
}

logrus.Info("Daemon shutdown complete")
return nil
}

Expand Down Expand Up @@ -471,9 +473,6 @@ func loadDaemonCliConfig(opts *daemonOptions) (*config.Config, error) {
conf.TLS = true
}

// ensure that the log level is the one set after merging configurations
setLogLevel(conf.LogLevel)

return conf, nil
}

Expand Down Expand Up @@ -670,3 +669,22 @@ func systemContainerdRunning() bool {
_, err := os.Lstat(containerddefaults.DefaultAddress)
return err == nil
}

// configureDaemonLogs sets the logrus logging level and formatting
func configureDaemonLogs(conf *config.Config) error {
if conf.LogLevel != "" {
lvl, err := logrus.ParseLevel(conf.LogLevel)
if err != nil {
return fmt.Errorf("unable to parse logging level: %s", conf.LogLevel)
}
logrus.SetLevel(lvl)
} else {
logrus.SetLevel(logrus.InfoLevel)
}
logrus.SetFormatter(&logrus.TextFormatter{
TimestampFormat: jsonmessage.RFC3339NanoFixed,
DisableColors: conf.RawLogs,
FullTimestamp: true,
})
return nil
}
20 changes: 19 additions & 1 deletion cmd/dockerd/daemon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ func TestLoadDaemonCliConfigWithLogLevel(t *testing.T) {
assert.NilError(t, err)
assert.Assert(t, loadedConfig != nil)
assert.Check(t, is.Equal("warn", loadedConfig.LogLevel))
assert.Check(t, is.Equal(logrus.WarnLevel, logrus.GetLevel()))
}

func TestLoadDaemonConfigWithEmbeddedOptions(t *testing.T) {
Expand Down Expand Up @@ -180,3 +179,22 @@ func TestLoadDaemonConfigWithRegistryOptions(t *testing.T) {
assert.Check(t, is.Len(loadedConfig.Mirrors, 1))
assert.Check(t, is.Len(loadedConfig.InsecureRegistries, 1))
}

func TestConfigureDaemonLogs(t *testing.T) {
conf := &config.Config{}
err := configureDaemonLogs(conf)
assert.NilError(t, err)
assert.Check(t, is.Equal(logrus.InfoLevel, logrus.GetLevel()))

conf.LogLevel = "warn"
err = configureDaemonLogs(conf)
assert.NilError(t, err)
assert.Check(t, is.Equal(logrus.WarnLevel, logrus.GetLevel()))

conf.LogLevel = "foobar"
err = configureDaemonLogs(conf)
assert.Error(t, err, "unable to parse logging level: foobar")

// log level should not be changed after a failure
assert.Check(t, is.Equal(logrus.WarnLevel, logrus.GetLevel()))
}
7 changes: 7 additions & 0 deletions cmd/dockerd/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/docker/docker/cli"
"github.com/docker/docker/daemon/config"
"github.com/docker/docker/dockerversion"
"github.com/docker/docker/pkg/jsonmessage"
"github.com/docker/docker/pkg/reexec"
"github.com/docker/docker/pkg/term"
"github.com/moby/buildkit/util/apicaps"
Expand Down Expand Up @@ -54,6 +55,12 @@ func main() {
return
}

// initial log formatting; this setting is updated after the daemon configuration is loaded.
logrus.SetFormatter(&logrus.TextFormatter{
TimestampFormat: jsonmessage.RFC3339NanoFixed,
FullTimestamp: true,
})

// Set terminal emulation based on platform as required.
_, stdout, stderr := term.StdStreams()

Expand Down
16 changes: 0 additions & 16 deletions cmd/dockerd/options.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
package main

import (
"fmt"
"os"
"path/filepath"

cliconfig "github.com/docker/docker/cli/config"
"github.com/docker/docker/daemon/config"
"github.com/docker/docker/opts"
"github.com/docker/go-connections/tlsconfig"
"github.com/sirupsen/logrus"
"github.com/spf13/pflag"
)

Expand Down Expand Up @@ -106,17 +104,3 @@ func (o *daemonOptions) SetDefaultOptions(flags *pflag.FlagSet) {
}
}
}

// setLogLevel sets the logrus logging level
func setLogLevel(logLevel string) {
if logLevel != "" {
lvl, err := logrus.ParseLevel(logLevel)
if err != nil {
fmt.Fprintf(os.Stderr, "Unable to parse logging level: %s\n", logLevel)
os.Exit(1)
}
logrus.SetLevel(lvl)
} else {
logrus.SetLevel(logrus.InfoLevel)
}
}
11 changes: 1 addition & 10 deletions daemon/checkpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package daemon // import "github.com/docker/docker/daemon"

import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"os"
Expand Down Expand Up @@ -127,15 +126,7 @@ func (daemon *Daemon) CheckpointList(name string, config types.CheckpointListOpt
if !d.IsDir() {
continue
}
path := filepath.Join(checkpointDir, d.Name(), "config.json")
data, err := ioutil.ReadFile(path)
if err != nil {
return nil, err
}
var cpt types.Checkpoint
if err := json.Unmarshal(data, &cpt); err != nil {
return nil, err
}
cpt := types.Checkpoint{Name: d.Name()}
out = append(out, cpt)
}

Expand Down
3 changes: 3 additions & 0 deletions daemon/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,9 @@ type CommonConfig struct {
Features map[string]bool `json:"features,omitempty"`

Builder BuilderConfig `json:"builder,omitempty"`

ContainerdNamespace string `json:"containerd-namespace,omitempty"`
ContainerdPluginNamespace string `json:"containerd-plugin-namespace,omitempty"`
}

// IsValueSet returns true if a configuration value
Expand Down
2 changes: 1 addition & 1 deletion daemon/container_operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ func (daemon *Daemon) connectToNetwork(container *container.Container, idOrName
return nil
}

func updateJoinInfo(networkSettings *network.Settings, n libnetwork.Network, ep libnetwork.Endpoint) error { // nolint: interfacer
func updateJoinInfo(networkSettings *network.Settings, n libnetwork.Network, ep libnetwork.Endpoint) error {
if ep == nil {
return errors.New("invalid enppoint whhile building portmap info")
}
Expand Down
Loading