diff options
author | Sebastiaan van Stijn <github@gone.nl> | 2023-04-13 00:28:39 +0200 |
---|---|---|
committer | Sebastiaan van Stijn <github@gone.nl> | 2023-04-18 15:02:41 +0200 |
commit | a82c4344479979ba18fe028d1674a1bca93ead57 (patch) | |
tree | 25e797aedcbff2a8186c83bb7af2cac17c69b8ee /daemon/oci_linux_test.go | |
parent | 20a1d23b39e5769420038e510b142d410bca6662 (diff) | |
download | docker-a82c4344479979ba18fe028d1674a1bca93ead57.tar.gz |
daemon: setupFakeDaemon(): add fakeImageService
To prevent a panic happening when running tests:
=== FAIL: daemon TestTmpfsDevShmNoDupMount (0.01s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x120 pc=0x261a373]
goroutine 134 [running]:
testing.tRunner.func1.2({0x28baf20, 0x3ea8000})
/usr/local/go/src/testing/testing.go:1526 +0x24e
testing.tRunner.func1()
/usr/local/go/src/testing/testing.go:1529 +0x39f
panic({0x28baf20, 0x3ea8000})
/usr/local/go/src/runtime/panic.go:884 +0x213
github.com/docker/docker/daemon.(*Daemon).createSpec(0xc0006e0000, {0x2ea5588, 0xc00012a008}, 0xc0003b5900)
/go/src/github.com/docker/docker/daemon/oci_linux.go:1060 +0xf33
github.com/docker/docker/daemon.TestTmpfsDevShmNoDupMount(0xc000b781a0?)
/go/src/github.com/docker/docker/daemon/oci_linux_test.go:77 +0x20a
testing.tRunner(0xc000b78340, 0x2c74210)
/usr/local/go/src/testing/testing.go:1576 +0x10b
created by testing.(*T).Run
/usr/local/go/src/testing/testing.go:1629 +0x3ea
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Diffstat (limited to 'daemon/oci_linux_test.go')
-rw-r--r-- | daemon/oci_linux_test.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/daemon/oci_linux_test.go b/daemon/oci_linux_test.go index 63464acc45..e08f557674 100644 --- a/daemon/oci_linux_test.go +++ b/daemon/oci_linux_test.go @@ -33,6 +33,7 @@ func setupFakeDaemon(t *testing.T, c *container.Container) *Daemon { configStore: &config.Config{}, linkIndex: newLinkIndex(), netController: netController, + imageService: &fakeImageService{}, } c.Root = root @@ -51,6 +52,14 @@ func setupFakeDaemon(t *testing.T, c *container.Container) *Daemon { return d } +type fakeImageService struct { + ImageService +} + +func (i *fakeImageService) StorageDriver() string { + return "overlay" +} + func cleanupFakeContainer(c *container.Container) { _ = os.RemoveAll(c.Root) } |