@@ -38,3 +38,62 @@ func TestMounts(t *testing.T) {
38
38
}
39
39
})
40
40
}
41
+
42
+ func TestPathInfo (t * testing.T ) {
43
+ t .Run ("Success" , func (t * testing.T ) {
44
+ // Get slice of mounted file systems.
45
+ result , err := PathInfo ("/photoprism/originals" )
46
+
47
+ // No warnings or errors are expected.
48
+ assert .NoError (t , err )
49
+
50
+ // Check result for plausibility.
51
+ assert .NotEmpty (t , result .Device )
52
+ assert .Equal (t , "local" , result .DeviceType )
53
+ assert .Equal (t , "/photoprism" , result .Mountpoint )
54
+ assert .NotEmpty (t , result .Fstype )
55
+ assert .NotEmpty (t , result .Opts )
56
+ assert .NotEmpty (t , result .Total )
57
+ assert .NotEmpty (t , result .Used )
58
+ assert .NotEmpty (t , result .Free )
59
+ assert .NotEmpty (t , result .Inodes )
60
+ assert .NotEmpty (t , result .InodesFree )
61
+ assert .NotEmpty (t , result .InodesUsed )
62
+ assert .NotEmpty (t , result .Blocks )
63
+ assert .NotEmpty (t , result .BlockSize )
64
+ assert .NotEmpty (t , result .Metadata )
65
+ })
66
+ }
67
+
68
+ func TestFindByPath (t * testing.T ) {
69
+ t .Run ("Success" , func (t * testing.T ) {
70
+ // Get slice of mounted file systems.
71
+ results , warnings , err := FindByPath ("/photoprism/originals" )
72
+
73
+ // No warnings or errors are expected.
74
+ assert .NoError (t , err )
75
+ assert .Empty (t , warnings )
76
+
77
+ // At least one mount returned?
78
+ if len (results ) < 1 {
79
+ t .Error ("at least one result expected" )
80
+ } else {
81
+ // If so, check the first mount for plausibility.
82
+ result := results [0 ]
83
+ assert .NotEmpty (t , result .Device )
84
+ assert .Equal (t , "local" , result .DeviceType )
85
+ assert .Equal (t , "/photoprism" , result .Mountpoint )
86
+ assert .NotEmpty (t , result .Fstype )
87
+ assert .NotEmpty (t , result .Opts )
88
+ assert .NotEmpty (t , result .Total )
89
+ assert .NotEmpty (t , result .Used )
90
+ assert .NotEmpty (t , result .Free )
91
+ assert .NotEmpty (t , result .Inodes )
92
+ assert .NotEmpty (t , result .InodesFree )
93
+ assert .NotEmpty (t , result .InodesUsed )
94
+ assert .NotEmpty (t , result .Blocks )
95
+ assert .NotEmpty (t , result .BlockSize )
96
+ assert .NotEmpty (t , result .Metadata )
97
+ }
98
+ })
99
+ }
0 commit comments