Browse Source

fix: Make unit test work in docker environment

Matthias Ladkau 9 months ago
parent
commit
2f7a4a2b46
5 changed files with 101 additions and 0 deletions
  1. 1 0
      fileinfo_test.go
  2. 8 0
      integration/rumble/dir_test.go
  3. 31 0
      term/file_test.go
  4. 37 0
      term/sync_test.go
  5. 24 0
      term/term_test.go

+ 1 - 0
fileinfo_test.go

@@ -46,6 +46,7 @@ func TestFileInfo(t *testing.T) {
 	fi = WrapFileInfo("./", fi).(*FileInfo)
 
 	if fi.String() != "foo.txt [3] -rw-rw---- (0001-01-01 00:00:00 +0000 UTC) - <nil>" &&
+		fi.String() != "foo.txt [3] -rw-r----- (0001-01-01 00:00:00 +0000 UTC) - <nil>" &&
 		fi.String() != "foo.txt [3] -rw-rw-rw- (0001-01-01 00:00:00 +0000 UTC) - <nil>" {
 		t.Error("Unexpected result:", fi)
 		return

+ 8 - 0
integration/rumble/dir_test.go

@@ -62,6 +62,14 @@ drwxrwx--- 4.0 KiB sub1
 
 /sub1
 -rwxrwx--- 17 B   test3 [f89782b1]
+`[1:] && res != `
+/
+drwxr-x--- 4.0 KiB sub1
+-rwxr-x---  10 B   test1 [73b8af47]
+-rwxr-x---  10 B   test2 [b0c1fadd]
+
+/sub1
+-rwxr-x--- 17 B   test3 [f89782b1]
 `[1:] {
 		t.Error("Unexpected result:", res, err)
 		return

+ 31 - 0
term/file_test.go

@@ -63,6 +63,18 @@ drwxrwx--- 4.0 KiB sub1
 -rwxrwx--- 17 B   test3
 `[1:] && res != `
 /
+drwxrwxrwx   0 B   backup
+drwxr-x--- 4.0 KiB sub1
+-rwxr-x---  10 B   test1
+-rwxr-x---  10 B   test2
+
+/backup
+-rwxr-x--- 10 B   test1
+
+/sub1
+-rwxr-x--- 17 B   test3
+`[1:] && res != `
+/
 drwxrwxrwx  0 B   backup
 drwxrwxrwx  0 B   sub1
 -rw-rw-rw- 10 B   test1
@@ -157,6 +169,10 @@ Sub dir test file
 -rw-r--r-- 10 B   testfile66
 `[1:] && res != `
 /backup
+-rwxr-x--- 10 B   test1
+-rw-r--r-- 10 B   testfile66
+`[1:] && res != `
+/backup
 -rw-rw-rw- 10 B   test1
 -rw-rw-rw- 10 B   testfile66
 `[1:]) {
@@ -197,6 +213,13 @@ testfile66
 -rw-r--r-- 10 B   testfile66
 drwxrwxrwx  0 B   tmp
 
+/backup/tmp
+`[1:] && res != `
+/backup
+-rwxr-x--- 10 B   test1
+-rw-r--r-- 10 B   testfile66
+drwxrwxrwx  0 B   tmp
+
 /backup/tmp
 `[1:] && res != `
 /backup
@@ -224,6 +247,14 @@ drwxrwxrwx  0 B   tmp
 -rw-r--r--  10 B   testfile66
 drwxr-xr-x 4.0 KiB tmp
 
+/backup/tmp
+-rw-r--r-- 10 B   foofile66
+`[1:] && res != `
+/backup
+-rwxr-x---  10 B   test1
+-rw-r--r--  10 B   testfile66
+drwxr-xr-x 4.0 KiB tmp
+
 /backup/tmp
 -rw-r--r-- 10 B   foofile66
 `[1:] && res != `

+ 37 - 0
term/sync_test.go

@@ -72,6 +72,21 @@ drwxrwx--- 4.0 KiB sub1
 drwxrwxrwx 0 B   1
 drwxrwxrwx 0 B   2
 
+/1
+drwxr-x--- 4.0 KiB sub1
+-rwxr-x---  10 B   test1
+-rwxr-x---  10 B   test2
+-rw-r-----  10 B   testfile66
+
+/1/sub1
+-rwxr-x--- 17 B   test3
+
+/2
+`[1:] && res != `
+/
+drwxrwxrwx 0 B   1
+drwxrwxrwx 0 B   2
+
 /1
 drwxrwxrwx 4.0 KiB sub1
 -rw-rw-rw-  10 B   test1
@@ -133,6 +148,28 @@ drwxr-xr-x 4.0 KiB sub1
 drwxrwxrwx 0 B   1
 drwxrwxrwx 0 B   2
 
+/1
+drwxr-x--- 4.0 KiB sub1
+-rwxr-x---  10 B   test1
+-rwxr-x---  10 B   test2
+-rw-r-----  10 B   testfile66
+
+/1/sub1
+-rwxr-x--- 17 B   test3
+
+/2
+drwxr-xr-x 4.0 KiB sub1
+-rw-r--r--  10 B   test1
+-rw-r--r--  10 B   test2
+-rw-r--r--  10 B   testfile66
+
+/2/sub1
+-rw-r--r-- 17 B   test3
+`[1:] && res != `
+/
+drwxrwxrwx 0 B   1
+drwxrwxrwx 0 B   2
+
 /1
 drwxrwxrwx 4.0 KiB sub1
 -rw-rw-rw-  10 B   test1

+ 24 - 0
term/term_test.go

@@ -182,6 +182,11 @@ drwxrwx--- 4.0 KiB sub1
 -rwxrwx---  10 B   test2
 `[1:] && res != `
 /
+drwxr-x--- 4.0 KiB sub1
+-rwxr-x---  10 B   test1
+-rwxr-x---  10 B   test2
+`[1:] && res != `
+/
 drwxrwxrwx  0 B   sub1
 -rw-rw-rw- 10 B   test1
 -rw-rw-rw- 10 B   test2
@@ -195,6 +200,9 @@ drwxrwxrwx  0 B   sub1
 -rwxrwx--- 17 B   test3
 `[1:] && res != `
 /sub1
+-rwxr-x--- 17 B   test3
+`[1:] && res != `
+/sub1
 -rw-rw-rw- 17 B   test3
 `[1:]) {
 		t.Error("Unexpected result: ", res, err)
@@ -213,6 +221,11 @@ drwxrwx--- 4.0 KiB sub1
 -rwxrwx---  10 B   test2 [b0c1fadd]
 `[1:] && res != `
 /
+drwxr-x--- 4.0 KiB sub1
+-rwxr-x---  10 B   test1 [73b8af47]
+-rwxr-x---  10 B   test2 [b0c1fadd]
+`[1:] && res != `
+/
 drwxrwxrwx  0 B   sub1
 -rw-rw-rw- 10 B   test1 [73b8af47]
 -rw-rw-rw- 10 B   test2 [b0c1fadd]
@@ -231,6 +244,14 @@ drwxrwx--- 4.0 KiB sub1
 -rwxrwx--- 17 B   test3
 `[1:] && res != `
 /
+drwxr-x--- 4.0 KiB sub1
+-rwxr-x---  10 B   test1
+-rwxr-x---  10 B   test2
+
+/sub1
+-rwxr-x--- 17 B   test3
+`[1:] && res != `
+/
 drwxrwxrwx  0 B   sub1
 -rw-rw-rw- 10 B   test1
 -rw-rw-rw- 10 B   test2
@@ -264,6 +285,9 @@ drwxrwxrwx  0 B   sub1
 -rwxrwx--- 17 B   test3 [f89782b1]
 `[1:] && res != `
 /sub1
+-rwxr-x--- 17 B   test3 [f89782b1]
+`[1:] && res != `
+/sub1
 -rw-rw-rw- 17 B   test3 [f89782b1]
 `[1:]) {
 		t.Error("Unexpected result: ", res, err)