github.com/lmars/docker@v1.6.0-rc2/utils/utils_daemon_test.go (about)

     1  package utils
     2  
     3  import (
     4  	"os"
     5  	"path"
     6  	"testing"
     7  )
     8  
     9  func TestIsFileOwner(t *testing.T) {
    10  	var err error
    11  	var file *os.File
    12  
    13  	if file, err = os.Create(path.Join(os.TempDir(), "testIsFileOwner")); err != nil {
    14  		t.Fatalf("failed to create file: %s", err)
    15  	}
    16  	file.Close()
    17  
    18  	if ok := IsFileOwner(path.Join(os.TempDir(), "testIsFileOwner")); !ok {
    19  		t.Fatalf("User should be owner of file")
    20  	}
    21  
    22  	if err = os.Remove(path.Join(os.TempDir(), "testIsFileOwner")); err != nil {
    23  		t.Fatalf("failed to remove file: %s", err)
    24  	}
    25  
    26  }