pidfile_test.go 356 B

12345678910111213141516171819
  1. package pidfile // import "github.com/docker/docker/pkg/pidfile"
  2. import (
  3. "path/filepath"
  4. "testing"
  5. )
  6. func TestWrite(t *testing.T) {
  7. path := filepath.Join(t.TempDir(), "testfile")
  8. err := Write(path)
  9. if err != nil {
  10. t.Fatal("Could not create test file", err)
  11. }
  12. err = Write(path)
  13. if err == nil {
  14. t.Fatal("Test file creation not blocked")
  15. }
  16. }