Add ignore socket test
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
This commit is contained in:
parent
2ec3382d2d
commit
9b111bdc39
@ -1022,6 +1022,22 @@ func TestDiffTar(t *testing.T) {
|
|||||||
fstest.CreateDir("/d3/", 0755),
|
fstest.CreateDir("/d3/", 0755),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "IgnoreSockets",
|
||||||
|
validators: []tarEntryValidator{
|
||||||
|
fileEntry("f2", []byte("content"), 0644),
|
||||||
|
// There should be _no_ socket here, despite the fstest.CreateSocket below
|
||||||
|
fileEntry("f3", []byte("content"), 0644),
|
||||||
|
},
|
||||||
|
a: fstest.Apply(
|
||||||
|
fstest.CreateFile("/f1", []byte("content"), 0644),
|
||||||
|
),
|
||||||
|
b: fstest.Apply(
|
||||||
|
fstest.CreateFile("/f2", []byte("content"), 0644),
|
||||||
|
fstest.CreateSocket("/s0", 0644),
|
||||||
|
fstest.CreateFile("/f3", []byte("content"), 0644),
|
||||||
|
),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, at := range tests {
|
for _, at := range tests {
|
||||||
|
@ -4,7 +4,7 @@ github.com/containerd/cgroups fe281dd265766145e943a034aa41086474ea6130
|
|||||||
github.com/containerd/typeurl f6943554a7e7e88b3c14aad190bf05932da84788
|
github.com/containerd/typeurl f6943554a7e7e88b3c14aad190bf05932da84788
|
||||||
github.com/containerd/fifo 3d5202aec260678c48179c56f40e6f38a095738c
|
github.com/containerd/fifo 3d5202aec260678c48179c56f40e6f38a095738c
|
||||||
github.com/containerd/btrfs 2e1aa0ddf94f91fa282b6ed87c23bf0d64911244
|
github.com/containerd/btrfs 2e1aa0ddf94f91fa282b6ed87c23bf0d64911244
|
||||||
github.com/containerd/continuity d8fb8589b0e8e85b8c8bbaa8840226d0dfeb7371
|
github.com/containerd/continuity 3e8f2ea4b190484acb976a5b378d373429639a1a
|
||||||
github.com/coreos/go-systemd 48702e0da86bd25e76cfef347e2adeb434a0d0a6
|
github.com/coreos/go-systemd 48702e0da86bd25e76cfef347e2adeb434a0d0a6
|
||||||
github.com/docker/go-metrics 4ea375f7759c82740c893fc030bc37088d2ec098
|
github.com/docker/go-metrics 4ea375f7759c82740c893fc030bc37088d2ec098
|
||||||
github.com/docker/go-events 9461782956ad83b30282bf90e31fa6a70c255ba9
|
github.com/docker/go-events 9461782956ad83b30282bf90e31fa6a70c255ba9
|
||||||
|
13
vendor/github.com/containerd/continuity/fs/fstest/file.go
generated
vendored
13
vendor/github.com/containerd/continuity/fs/fstest/file.go
generated
vendored
@ -2,6 +2,7 @@ package fstest
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"time"
|
"time"
|
||||||
@ -107,6 +108,18 @@ func Link(oldname, newname string) Applier {
|
|||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
func CreateSocket(name string, perm os.FileMode) Applier {
|
||||||
|
return applyFn(func(root string) error {
|
||||||
|
fullPath := filepath.Join(root, name)
|
||||||
|
ln, err := net.Listen("unix", fullPath)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer ln.Close()
|
||||||
|
return os.Chmod(fullPath, perm)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// Apply returns a new applier from the given appliers
|
// Apply returns a new applier from the given appliers
|
||||||
func Apply(appliers ...Applier) Applier {
|
func Apply(appliers ...Applier) Applier {
|
||||||
return applyFn(func(root string) error {
|
return applyFn(func(root string) error {
|
||||||
|
1
vendor/github.com/containerd/continuity/fs/fstest/testsuite.go
generated
vendored
1
vendor/github.com/containerd/continuity/fs/fstest/testsuite.go
generated
vendored
@ -74,6 +74,7 @@ var (
|
|||||||
Symlink("libnothing.so", "/usr/local/lib/libnothing.so.2"),
|
Symlink("libnothing.so", "/usr/local/lib/libnothing.so.2"),
|
||||||
CreateDir("/home", 0755),
|
CreateDir("/home", 0755),
|
||||||
CreateDir("/home/derek", 0700),
|
CreateDir("/home/derek", 0700),
|
||||||
|
CreateDir("/var/run/socket", 0700),
|
||||||
)
|
)
|
||||||
|
|
||||||
// basicTest covers basic operations
|
// basicTest covers basic operations
|
||||||
|
Loading…
Reference in New Issue
Block a user