TestGC tests the garbage collecion features of the mount manager, ensuring that mounts are properly cleaned up when no longer needed.
(t *testing.T)
| 150 | // TestGC tests the garbage collecion features of the mount manager, |
| 151 | // ensuring that mounts are properly cleaned up when no longer needed. |
| 152 | func TestGC(t *testing.T) { |
| 153 | type gcrun struct { |
| 154 | a []mount.Mount |
| 155 | o []mount.ActivateOpt |
| 156 | d []string |
| 157 | all []string |
| 158 | active []string |
| 159 | brefs map[string][]string |
| 160 | remove []string |
| 161 | gcErr bool |
| 162 | } |
| 163 | |
| 164 | for _, tc := range []struct { |
| 165 | name string |
| 166 | gcruns []gcrun |
| 167 | }{ |
| 168 | { |
| 169 | name: "Simple", |
| 170 | gcruns: []gcrun{ |
| 171 | { |
| 172 | a: []mount.Mount{ |
| 173 | { |
| 174 | Type: "noop", |
| 175 | }, |
| 176 | }, |
| 177 | all: []string{"0-0"}, |
| 178 | remove: []string{}, |
| 179 | }, |
| 180 | { |
| 181 | all: []string{"0-0"}, |
| 182 | remove: []string{"0-0"}, |
| 183 | }, |
| 184 | {}, |
| 185 | }, |
| 186 | }, |
| 187 | { |
| 188 | name: "UnmountError", |
| 189 | gcruns: []gcrun{ |
| 190 | { |
| 191 | a: []mount.Mount{ |
| 192 | { |
| 193 | Type: "error", |
| 194 | }, |
| 195 | }, |
| 196 | all: []string{"0-0"}, |
| 197 | remove: []string{}, |
| 198 | }, |
| 199 | { |
| 200 | all: []string{"0-0"}, |
| 201 | remove: []string{"0-0"}, |
| 202 | gcErr: true, // Expect an error on garbage collection due to unmount error |
| 203 | }, |
| 204 | {}, // Run again without error to bring mount count back to zero |
| 205 | }, |
| 206 | }, |
| 207 | { |
| 208 | name: "ActiveBrefs", |
| 209 | gcruns: []gcrun{ |
nothing calls this directly
no test coverage detected
searching dependent graphs…