summaryrefslogtreecommitdiff
path: root/integration/plugin
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #45507 from corhere/cleanup-reexec-initsSebastiaan van Stijn2023-05-102-9/+0
|\ | | | | [chore] clean up reexec.Init() calls
| * [chore] clean up reexec.Init() callsCory Snider2023-05-092-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that most uses of reexec have been replaced with non-reexec solutions, most of the reexec.Init() calls peppered throughout the test suites are unnecessary. Furthermore, most of the reexec.Init() calls in test code neglects to check the return value to determine whether to exit, which would result in the reexec'ed subprocesses proceeding to run the tests, which would reexec another subprocess which would proceed to run the tests, recursively. (That would explain why every reexec callback used to unconditionally call os.Exit() instead of returning...) Remove unneeded reexec.Init() calls from test and example code which no longer needs it, and fix the reexec.Init() calls which are not inert to exit after a reexec callback is invoked. Signed-off-by: Cory Snider <csnider@mirantis.com>
* | fixing consistent aliases for OCI spec importsJeyanthinath Muthuram2023-05-081-2/+2
|/ | | | Signed-off-by: Jeyanthinath Muthuram <jeyanthinath10@gmail.com>
* api/types/container: create type for changes endpointSebastiaan van Stijn2023-05-031-2/+2
| | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* integration/plugin: fix duplicate importSebastiaan van Stijn2023-03-141-4/+3
| | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* integration/plugin: remove deprecated overlay2.override_kernel_checkSebastiaan van Stijn2022-10-101-1/+1
| | | | | | It's no longer used since e226aea280efdc18f887e853b5eefd763b602937 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* integration: fix empty-lines (revive)Sebastiaan van Stijn2022-09-281-1/+0
| | | | | | | | | | | | | | | | | | integration/config/config_test.go:106:31: empty-lines: extra empty line at the end of a block (revive) integration/secret/secret_test.go:106:31: empty-lines: extra empty line at the end of a block (revive) integration/network/service_test.go:58:50: empty-lines: extra empty line at the end of a block (revive) integration/network/service_test.go:401:58: empty-lines: extra empty line at the end of a block (revive) integration/system/event_test.go:30:38: empty-lines: extra empty line at the end of a block (revive) integration/plugin/logging/read_test.go:19:41: empty-lines: extra empty line at the end of a block (revive) integration/service/list_test.go:30:48: empty-lines: extra empty line at the end of a block (revive) integration/service/create_test.go:400:46: empty-lines: extra empty line at the start of a block (revive) integration/container/logs_test.go:156:42: empty-lines: extra empty line at the end of a block (revive) integration/container/daemon_linux_test.go:135:44: empty-lines: extra empty line at the end of a block (revive) integration/container/restart_test.go:160:62: empty-lines: extra empty line at the end of a block (revive) integration/container/wait_test.go:181:47: empty-lines: extra empty line at the end of a block (revive) integration/container/restart_test.go:116:30: empty-lines: extra empty line at the end of a block (revive) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* chore(integration): delete outdated TODO commentCory Snider2022-09-231-1/+0
| | | | | | | | | The TODO comment was in regards to allowing graphdriver plugins to provide their own ContainerFS implementations. The ContainerFS interface has been removed from Moby, so there is no longer anything which needs to be figured out. Signed-off-by: Cory Snider <csnider@mirantis.com>
* pkg/containerfs: alias ContainerFS to stringCory Snider2022-09-231-1/+1
| | | | | | Drop the constructor and redundant string() type-casts. Signed-off-by: Cory Snider <csnider@mirantis.com>
* pkg/containerfs: simplify ContainerFS typeCory Snider2022-09-231-1/+1
| | | | | | Iterate towards dropping the type entirely. Signed-off-by: Cory Snider <csnider@mirantis.com>
* linting: gosec: fix or suppress G112, G114 in test codeSebastiaan van Stijn2022-09-044-8/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Updating test-code only; set ReadHeaderTimeout for some, or suppress the linter error for others. contrib/httpserver/server.go:11:12: G114: Use of net/http serve function that has no support for setting timeouts (gosec) log.Panic(http.ListenAndServe(":80", nil)) ^ integration/plugin/logging/cmd/close_on_start/main.go:42:12: G112: Potential Slowloris Attack because ReadHeaderTimeout is not configured in the http.Server (gosec) server := http.Server{ Addr: l.Addr().String(), Handler: mux, } integration/plugin/logging/cmd/discard/main.go:17:12: G112: Potential Slowloris Attack because ReadHeaderTimeout is not configured in the http.Server (gosec) server := http.Server{ Addr: l.Addr().String(), Handler: mux, } integration/plugin/logging/cmd/dummy/main.go:14:12: G112: Potential Slowloris Attack because ReadHeaderTimeout is not configured in the http.Server (gosec) server := http.Server{ Addr: l.Addr().String(), Handler: http.NewServeMux(), } integration/plugin/volumes/cmd/dummy/main.go:14:12: G112: Potential Slowloris Attack because ReadHeaderTimeout is not configured in the http.Server (gosec) server := http.Server{ Addr: l.Addr().String(), Handler: http.NewServeMux(), } testutil/fixtures/plugin/basic/basic.go:25:12: G112: Potential Slowloris Attack because ReadHeaderTimeout is not configured in the http.Server (gosec) server := http.Server{ Addr: l.Addr().String(), Handler: http.NewServeMux(), } volume/testutils/testutils.go:170:5: G114: Use of net/http serve function that has no support for setting timeouts (gosec) go http.Serve(l, mux) ^ Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* api: add types/volume.ListOptions for a more consistent APISebastiaan van Stijn2022-08-031-1/+1
| | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* testutil, integration: use types/registry.AuthConfigSebastiaan van Stijn2022-07-291-1/+2
| | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* api: rename volume.VolumeCreateBody to volume.CreateOptionsSebastiaan van Stijn2022-04-281-3/+3
| | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* imports: remove "volumetypes" aliases for api/types/volumeSebastiaan van Stijn2022-04-281-4/+4
| | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* api/server/httputils: add ReadJSON() utilitySebastiaan van Stijn2022-04-111-17/+47
| | | | | | | | | | | | | | | | | | | | | Implement a ReadJSON() utility to help reduce some code-duplication, and to make sure we handle JSON requests consistently (e.g. always check for the content-type). Differences compared to current handling: - prevent possible panic if request.Body is nil ("should never happen") - always require Content-Type to be "application/json" - be stricter about additional content after JSON (previously ignored) - but, allow the body to be empty (an empty body is not invalid); update TestContainerInvalidJSON accordingly, which was testing the wrong expectation. - close body after reading (some code did this) We should consider to add a "max body size" on this function, similar to https://github.com/moby/moby/blob/7b9275c0da707b030e62c96b679a976f31f929d3/api/server/middleware/debug.go#L27-L40 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Finish refactor of UID/GID usage to a new structCory Snider2022-03-141-2/+3
| | | | | | | | | | | | | | | | | | | | | | Finish the refactor which was partially completed with commit 34536c498d56, passing around IdentityMapping structs instead of pairs of []IDMap slices. Existing code which uses []IDMap relies on zero-valued fields to be valid, empty mappings. So in order to successfully finish the refactoring without introducing bugs, their replacement therefore also needs to have a useful zero value which represents an empty mapping. Change IdentityMapping to be a pass-by-value type so that there are no nil pointers to worry about. The functionality provided by the deprecated NewIDMappingsFromMaps function is required by unit tests to to construct arbitrary IdentityMapping values. And the daemon will always need to access the mappings to pass them to the Linux kernel. Accommodate these use cases by exporting the struct fields instead. BuildKit currently depends on the UIDs and GIDs methods so we cannot get rid of them yet. Signed-off-by: Cory Snider <csnider@mirantis.com>
* vendor: github.com/opencontainers/image-spec v1.0.2Sebastiaan van Stijn2021-11-181-5/+1
| | | | | | | | | - Bring mediaType out of reserved status - specs-go: adding mediaType to the index and manifest structures full diff: https://github.com/opencontainers/image-spec/compare/v1.0.1...v1.0.2 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* refactor: move from io/ioutil to io and os packageEng Zer Jun2021-08-277-27/+22
| | | | | | | | The io/ioutil package has been deprecated in Go 1.16. This commit replaces the existing io/ioutil functions with their new definitions in io and os packages. Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* Update to Go 1.17.0, and gofmt with Go 1.17Sebastiaan van Stijn2021-08-244-0/+4
| | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* integration: copy loop variable into parallel test closuresRoman Volosatovs2021-07-221-0/+1
| | | | | | | | | | Discovered a few instances, where loop variable is incorrectly used within a test closure, which is marked as parallel. Few of these were actually loops over singleton slices, therefore the issue might not have surfaced there (yet), but it is good to fix there as well, as this is an incorrect pattern used across different tests. Signed-off-by: Roman Volosatovs <roman.volosatovs@docker.com>
* gosimple: S1039: unnecessary use of fmt.SprintfSebastiaan van Stijn2021-06-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | pkg/devicemapper/devmapper.go:383:28: S1039: unnecessary use of fmt.Sprintf (gosimple) if err := task.setMessage(fmt.Sprintf("@cancel_deferred_remove")); err != nil { ^ integration/plugin/graphdriver/external_test.go:321:18: S1039: unnecessary use of fmt.Sprintf (gosimple) http.Error(w, fmt.Sprintf("missing id"), 409) ^ integration-cli/docker_api_stats_test.go:70:31: S1039: unnecessary use of fmt.Sprintf (gosimple) _, body, err := request.Get(fmt.Sprintf("/info")) ^ integration-cli/docker_cli_build_test.go:4547:19: S1039: unnecessary use of fmt.Sprintf (gosimple) "--build-arg", fmt.Sprintf("FOO1=fromcmd"), ^ integration-cli/docker_cli_build_test.go:4548:19: S1039: unnecessary use of fmt.Sprintf (gosimple) "--build-arg", fmt.Sprintf("FOO2="), ^ integration-cli/docker_cli_build_test.go:4549:19: S1039: unnecessary use of fmt.Sprintf (gosimple) "--build-arg", fmt.Sprintf("FOO3"), // set in env ^ integration-cli/docker_cli_build_test.go:4668:32: S1039: unnecessary use of fmt.Sprintf (gosimple) cli.WithFlags("--build-arg", fmt.Sprintf("tag=latest"))) ^ integration-cli/docker_cli_build_test.go:4690:32: S1039: unnecessary use of fmt.Sprintf (gosimple) cli.WithFlags("--build-arg", fmt.Sprintf("baz=abc"))) ^ pkg/jsonmessage/jsonmessage_test.go:255:4: S1039: unnecessary use of fmt.Sprintf (gosimple) fmt.Sprintf("ID: status\n"), ^ Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* integration: ensurePlugin: disable go modules when building pluginSebastiaan van Stijn2021-05-182-2/+2
| | | | | | | | === RUN TestServicePlugin plugin_test.go:42: assertion failed: error is not nil: error building basic plugin bin: no required module provides package github.com/docker/docker/testutil/fixtures/plugin/basic: go.mod file not found in current directory or any parent directory; see 'go help modules' : exit status 1 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Use docker media type for plugin layersBrian Goff2021-04-051-0/+63
| | | | | | | | This was changed as part of a refactor to use containerd dist code. The problem is the OCI media types are not compatible with older versions of Docker. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* Add shim config for custom runtimes for pluginsBrian Goff2021-01-141-0/+66
| | | | | | | This fixes a panic when an admin specifies a custom default runtime, when a plugin is started the shim config is nil. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* fix integration test case TestExternalGraphDriver failed in mips archlimeidan2020-09-151-2/+2
| | | | Signed-off-by: limeidan <limeidan@loongson.cn>
* Merge pull request #41360 from lzhfromustc/GL_5Brian Goff2020-09-121-1/+1
|\ | | | | Builder: Add 1 buffer to two channels to avoid blocking goroutine
| * Test: Add buffer to two channels to avoid blocking goroutinelzhfromustc2020-08-271-1/+1
| | | | | | | | Signed-off-by: Ziheng Liu <lzhfromustc@gmail.com>
* | replace pkg/locker with github.com/moby/lockerSebastiaan van Stijn2020-09-102-2/+2
|/ | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Merge pull request #40725 from cpuguy83/check_img_platformTibor Vass2020-05-211-0/+1
|\ | | | | Accept platform spec on container create
| * Accept platform spec on container createBrian Goff2020-03-201-0/+1
| | | | | | | | | | | | | | | | | | This enables image lookup when creating a container to fail when the reference exists but it is for the wrong platform. This prevents trying to run an image for the wrong platform, as can be the case with, for example binfmt_misc+qemu. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* | Merge pull request #40595 from sfzhu93/GL_2_25Sebastiaan van Stijn2020-05-081-1/+1
|\ \ | | | | | | [integration] add buffer to prevent goroutine leak
| * | test: add buffer to prevent goroutine leakZiheng Liu2020-02-271-1/+1
| | | | | | | | | | | | Signed-off-by: Ziheng Liu <lzhfromustc@gmail.com>
* | | Use containerd dist libs for plugin pull/pullBrian Goff2020-04-022-0/+125
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This removes the use of the old distribution code in the plugin packages and replaces it with containerd libraries for plugin pushes and pulls. Additionally it uses a content store from containerd which seems like it's compatible with the old "basicBlobStore" in the plugin package. This is being used locally isntead of through the containerd client for now. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* | | test-integration: support more rootless testsAkihiro Suda2020-03-163-0/+3
| |/ |/| | | | | Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
* | Always execute tests and skip in tests themselvesSam Whited2020-02-212-8/+6
| | | | | | | | | | | | See issue #40193 Signed-off-by: Sam Whited <sam@samwhited.com>
* | Support configuration of log cacher.Brian Goff2020-02-192-31/+49
| | | | | | | | | | | | | | | | | | | | Configuration over the API per container is intentionally left out for the time being, but is supported to configure the default from the daemon config. Signed-off-by: Brian Goff <cpuguy83@gmail.com> (cherry picked from commit cbecf48bc352e680a5390a7ca9cff53098cd16d7) Signed-off-by: Madhu Venugopal <madhu@docker.com>
* | Support reads for all log drivers.Brian Goff2020-02-195-0/+184
|/ | | | | | | | | This supplements any log driver which does not support reads with a custom read implementation that uses a local file cache. Signed-off-by: Brian Goff <cpuguy83@gmail.com> (cherry picked from commit d675e2bf2b75865915c7a4552e00802feeb0847f) Signed-off-by: Madhu Venugopal <madhu@docker.com>
* bump gotest.tools v3.0.1 for compatibility with Go 1.14Sebastiaan van Stijn2020-02-119-18/+18
| | | | | | full diff: https://github.com/gotestyourself/gotest.tools/compare/v2.3.0...v3.0.1 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Check for OS Type and skip within the testvikrambirsingh2019-11-071-3/+0
| | | | | | | | | Premature check for OS type means that the test will never even get to run on other OS types. This will cause it to be always flagged as a failure on such OS types. Signed-off-by: vikrambirsingh <vikrambir.singh@docker.com>
* integration: use constants for http methodsSebastiaan van Stijn2019-10-131-2/+2
| | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* testutil: update WithExperimental signature to be a daemon.OptionSebastiaan van Stijn2019-09-302-3/+3
| | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* TestGraphdriverPluginV2: SA5001: should check returned error before ↵Sebastiaan van Stijn2019-09-181-1/+1
| | | | | | | | | | deferring (staticcheck) ``` integration/plugin/graphdriver/external_test.go:427:2: SA5001: should check returned error before deferring responseReader.Close() (staticcheck) ``` Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* integration: remove unused constants and fields (unused)Sebastiaan van Stijn2019-09-181-2/+0
| | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* testutil: make testing packages publicSam Whited2019-09-1113-15/+15
| | | | | | | | | | | | | | | | This was done with something along the lines of: ``` mv internal/test testutil pushd testutil/; grep -IRl "package test" | xargs -I '{}' sed -i -e 's|package test|package testutil|g' {}; popd mv internal/testutil/*.go testutil/ && rm -rf internal/ grep -IRl "github.com\/docker\/docker\/internal\/test" | xargs -I '{}' sed -i -e 's|github.com/docker/docker/internal/test|github.com/docker/docker/test|g' {} goimports . ``` I also modified the basic plugin path in testutil/fixtures/plugin. Signed-off-by: Sam Whited <sam@samwhited.com>
* Improvements to the test runnersBrian Goff2019-07-315-5/+0
| | | | | | | | | | | | | 1. Use `go list` to get list of integration dirs to build. This means we do not need to have a valid `.go` in every subdirectory and also filters out other dirs like "bundles" which may have been created. 2. Add option to specify custom flags for integration and integration-cli. This is needed so both suites can be run AND set custom flags... since the cli suite does not support standard go flags. 3. Add options to skip an entire integration suite. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* integration: change testGraphDriver signature to fix lintingSebastiaan van Stijn2019-06-071-4/+3
| | | | | | Line 441: warning: context.Context should be the first parameter of a function (golint) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* integration: change container.Run signature to fix lintingSebastiaan van Stijn2019-06-074-8/+8
| | | | | | Line 59: warning: context.Context should be the first parameter of a function (golint) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Use assert.NilError() instead of assert.Assert()Sebastiaan van Stijn2019-01-213-16/+16
| | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Replace t.Fatal(err) with assert.NilError(t, err)Yong Tang2019-01-151-6/+3
| | | | | | So that they are consistent with integration tests style Signed-off-by: Yong Tang <yong.tang.github@outlook.com>