Add ignore socket test

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
This commit is contained in:
Derek McGowan
2018-03-22 13:17:33 -07:00
parent 2ec3382d2d
commit 9b111bdc39
4 changed files with 31 additions and 1 deletions

View File

@@ -2,6 +2,7 @@ package fstest
import (
"io/ioutil"
"net"
"os"
"path/filepath"
"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
func Apply(appliers ...Applier) Applier {
return applyFn(func(root string) error {

View File

@@ -74,6 +74,7 @@ var (
Symlink("libnothing.so", "/usr/local/lib/libnothing.so.2"),
CreateDir("/home", 0755),
CreateDir("/home/derek", 0700),
CreateDir("/var/run/socket", 0700),
)
// basicTest covers basic operations