moby/utils/utils_daemon_test.go
Rik Nijessen 1ec2eac50d Make utils_daemon and volumes cross-platform compileable.
Signed-off-by: Rik Nijessen <riknijessen@gmail.com>
2015-03-16 11:46:07 +01:00

26 lines
520 B
Go

package utils
import (
"os"
"path"
"testing"
)
func TestIsFileOwner(t *testing.T) {
var err error
var file *os.File
if file, err = os.Create(path.Join(os.TempDir(), "testIsFileOwner")); err != nil {
t.Fatalf("failed to create file: %s", err)
}
file.Close()
if ok := IsFileOwner(path.Join(os.TempDir(), "testIsFileOwner")); !ok {
t.Fatalf("User should be owner of file")
}
if err = os.Remove(path.Join(os.TempDir(), "testIsFileOwner")); err != nil {
t.Fatalf("failed to remove file: %s", err)
}
}