summaryrefslogtreecommitdiff
path: root/daemon/graphdriver/devmapper/devmapper_test.go
Commit message (Collapse)AuthorAgeFilesLines
* Finish refactor of UID/GID usage to a new structCory Snider2022-03-141-1/+2
| | | | | | | | | | | | | | | | | | | | | | 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>
* Update to Go 1.17.0, and gofmt with Go 1.17Sebastiaan van Stijn2021-08-241-0/+1
| | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Merge pull request #42193 from lzhfromustc/3_23Brian Goff2021-07-281-1/+1
|\ | | | | discovery & test: Fix goroutine leaks by adding 1 buffer to channel
| * discovery & test: Fix goroutine leaks by adding 1 buffer to channellzhfromustc2021-03-241-1/+1
| | | | | | | | Signed-off-by: Ziheng Liu <lzhfromustc@gmail.com>
* | reformat "nolint" commentsSebastiaan van Stijn2021-06-101-1/+1
|/ | | | | | Unlike regular comments, nolint comments should not have a leading space. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* daemon/graphdriver: normalize comment formattingSebastiaan van Stijn2019-11-271-1/+1
| | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* devmapper: fix unit testKir Kolyshkin2019-10-071-2/+3
| | | | | | | | | | | | | | | | | | | | | | It has been pointed out that sometimes device mapper unit tests fail with the following diagnostics: > --- FAIL: TestDevmapperSetup (0.02s) > graphtest_unix.go:44: graphdriver: loopback attach failed > graphtest_unix.go:48: loopback attach failed The root cause is the absence of udev inside the container used for testing, which causes device nodes (/dev/loop*) to not be created. The test suite itself already has a workaround, but it only creates 8 devices (loop0 till loop7). It might very well be the case that the first few devices are already used by the system (on my laptop 15 devices are busy). The fix is to raise the number of devices being manually created. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
* unconvert: remove unnescessary conversionsSebastiaan van Stijn2019-09-181-1/+1
| | | | | Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com> Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Add canonical import commentDaniel Nephin2018-02-051-1/+1
| | | | Signed-off-by: Daniel Nephin <dnephin@docker.com>
* devmapper: add a test for mount leak workaroundAleksa Sarai2017-11-081-0/+53
| | | | | | | | | | | In order to avoid reverting our fix for mount leakage in devicemapper, add a test which checks that devicemapper's Get() and Put() cycle can survive having a command running in an rprivate mount propagation setup in-between. While this is quite rudimentary, it should be sufficient. We have to skip this test for pre-3.18 kernels. Signed-off-by: Aleksa Sarai <asarai@suse.de>
* Fix vfs unit test and port VFS to the new IDMappingsDaniel Nephin2017-06-071-1/+43
| | | | | | | | The test was failing because TarOptions was using a non-pointer for ChownOpts, which meant the check for nil was never true, and createTarFile was never using the hdr.UID/GID Signed-off-by: Daniel Nephin <dnephin@docker.com>
* use t.Fatal() to output the err message where the values used for formattingfate-grand-order2017-02-231-3/+3
| | | | | | text does not appear to contain a placeholder Signed-off-by: Helen Xie <chenjg@harmonycloud.cn>
* duplicated theJie Luo2016-12-211-1/+1
| | | | | | | | | | | | Signed-off-by: Jie Luo <luo612@zju.edu.cn> typo Signed-off-by: Jie Luo <luo612@zju.edu.cn> fix some typos Signed-off-by: Jie Luo <luo612@zju.edu.cn>
* devmapper: Drop devices lock before returning from functionVivek Goyal2015-10-191-0/+29
| | | | | | | | | | | | | cleanupDeleted() takes devices.Lock() but does not drop it if there are no deleted devices. Hence docker deadlocks if one is using deferred device deletion feature. (--storage-opt dm.use_deferred_deletion=true). Fix it. Drop the lock before returning. Also added a unit test case to make sure in future this can be easily detected if somebody changes the function. Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
* Add user namespace (mapping) support to the Docker enginePhil Estes2015-10-091-1/+1
| | | | | | | | | | | | Adds support for the daemon to handle user namespace maps as a per-daemon setting. Support for handling uid/gid mapping is added to the builder, archive/unarchive packages and functions, all graphdrivers (except Windows), and the test suite is updated to handle user namespace daemon rootgraph changes. Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
* Try to resize data and metadata loopback file when initiating devicemapperChun Chen2015-09-241-0/+39
| | | | Signed-off-by: Chun Chen <ramichen@tencent.com>
* daemon/graphdriver/devmapper/ fix lint errors/warningsSrini Brahmaroutu2015-07-291-4/+4
| | | | | Addresses #14756 Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
* Revert "Fix implicit DeviceMapper selection"David Calavera2015-07-071-0/+1
| | | | | | This reverts commit 0a376291b2213699f986a7bca1cc8c4f4ed00f8d. Signed-off-by: David Calavera <david.calavera@gmail.com>
* Fix implicit DeviceMapper selectionDavid Calavera2015-07-021-1/+0
| | | | | | | | | | DeviceMapper must be explicitly selected because the Docker binary might not be linked to the right devmapper library. With this change, Docker fails fast if the driver detection finds the devicemapper directory but the driver is not the default option. The option `override_udev_sync_check` doesn't make sense anymore, since the user must be explicit to select devicemapper, so it's being removed. Docker fails to use devicemapper only if Docker has been built statically unless the option was explicit. Signed-off-by: David Calavera <david.calavera@gmail.com>
* devmapper: storage-opt override for udev syncVincent Batts2015-04-101-0/+1
| | | | | | | | | | | | | | This provides an override for forcing the daemon to still attempt running the devicemapper driver even when udev sync is not supported. Intended to be a very clear impairment for those choosing to use it. If udev sync is false, there will still be an error in the daemon logs, even when the override is in place. The docs have an explicit WARNING. Including link to the docs for users that encounter this daemon error during an upgrade. Signed-off-by: Vincent Batts <vbatts@redhat.com>
* Mknod more loopbacks for devmapperMichael Crosby2014-11-211-0/+3
| | | | Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
* devmapper: include dm_deps information in debugVincent Batts2014-09-251-1/+2
| | | | Signed-off-by: Vincent Batts <vbatts@redhat.com>
* Replace "amd64" build tags with "cgo" as appropriate, and remove where ↵Tianon Gravi2014-08-061-1/+1
| | | | | | unnecessary Signed-off-by: Andrew Page <admwiggin@gmail.com>
* update go import path and libcontainerVictor Vieux2014-07-241-1/+1
| | | | Docker-DCO-1.1-Signed-off-by: Victor Vieux <vieux@docker.com> (github: vieux)
* devicemapper: Remove non-general testsAlexander Larsson2014-05-161-268/+18
| | | | | | | | | | | Now that we have the generic graphtest tests that actually tests the driver we can remove the old mock-using tests. Almost all of these tests were disabled anyway, and the four remaining ones didn't really test much while at the same time being really fragile and making the rest of the code more complex due to the mocking setup. Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
* Rename runtime/* to daemon/*Alexander Larsson2014-04-171-0/+287
Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)