summaryrefslogtreecommitdiff
path: root/integration_tests/helpers.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2016-02-07 10:55:13 +0100
committerJakob Unterwurzacher2016-02-07 10:55:13 +0100
commit3a4922b5d747d54c9cb62833c9d69acb96b072f6 (patch)
tree39eea52028ea5a60f1e0cce47be79a88f0a8169e /integration_tests/helpers.go
parente111e20649cfacd7b02dd454d75db879aa2ca53c (diff)
Add tests for long name creation and renaming (currently failing, obviously)
Diffstat (limited to 'integration_tests/helpers.go')
-rw-r--r--integration_tests/helpers.go36
1 files changed, 36 insertions, 0 deletions
diff --git a/integration_tests/helpers.go b/integration_tests/helpers.go
index e5458c9..4adce97 100644
--- a/integration_tests/helpers.go
+++ b/integration_tests/helpers.go
@@ -1,6 +1,7 @@
package integration_tests
import (
+ "path/filepath"
"crypto/md5"
"encoding/hex"
"fmt"
@@ -176,3 +177,38 @@ func testRename(t *testing.T, plainDir string) {
}
syscall.Unlink(file2)
}
+
+// verifyExistence - check in 3 ways that "path" exists:
+// stat, open, readdir
+func verifyExistence(path string) bool {
+
+ // Check that file can be stated
+ _, err := os.Stat(path)
+ if err != nil {
+ //t.Log(err)
+ return false
+ }
+
+ // Check that file can be opened
+ fd, err := os.Open(path)
+ if err != nil {
+ //t.Log(err)
+ return false
+ }
+ fd.Close()
+
+ // Check that file shows up in directory listing
+ dir := filepath.Dir(path)
+ name := filepath.Base(path)
+ fi, err := ioutil.ReadDir(dir)
+ if err != nil {
+ //t.Log(err)
+ return false
+ }
+ for _, i := range(fi) {
+ if i.Name() == name {
+ return true
+ }
+ }
+ return false
+}