Because mount.parseInfoFile is only available on Linux
Docker-DCO-1.1-Signed-off-by: Kato Kazuyoshi <kato.kazuyoshi@gmail.com> (github: kzys)
| ... | ... |
@@ -108,3 +108,21 @@ func TestMountReadonly(t *testing.T) {
|
| 108 | 108 |
t.Fatal("Should not be able to open a ro file as rw")
|
| 109 | 109 |
} |
| 110 | 110 |
} |
| 111 |
+ |
|
| 112 |
+func TestGetMounts(t *testing.T) {
|
|
| 113 |
+ mounts, err := GetMounts() |
|
| 114 |
+ if err != nil {
|
|
| 115 |
+ t.Fatal(err) |
|
| 116 |
+ } |
|
| 117 |
+ |
|
| 118 |
+ root := false |
|
| 119 |
+ for _, entry := range mounts {
|
|
| 120 |
+ if entry.Mountpoint == "/" {
|
|
| 121 |
+ root = true |
|
| 122 |
+ } |
|
| 123 |
+ } |
|
| 124 |
+ |
|
| 125 |
+ if !root {
|
|
| 126 |
+ t.Fatal("/ should be mounted at least")
|
|
| 127 |
+ } |
|
| 128 |
+} |