(t *testing.T, f fs.Fs, lastRemote string)
| 1259 | } |
| 1260 | |
| 1261 | func (r *run) completeAllBackgroundUploads(t *testing.T, f fs.Fs, lastRemote string) { |
| 1262 | var state cache.BackgroundUploadState |
| 1263 | var err error |
| 1264 | |
| 1265 | maxDuration := time.Minute * 5 |
| 1266 | if r.wrappedIsExternal { |
| 1267 | maxDuration = time.Minute * 15 |
| 1268 | } |
| 1269 | cfs, err := r.getCacheFs(f) |
| 1270 | require.NoError(t, err) |
| 1271 | buCh := cfs.GetBackgroundUploadChannel() |
| 1272 | require.NotNil(t, buCh) |
| 1273 | |
| 1274 | for { |
| 1275 | select { |
| 1276 | case state = <-buCh: |
| 1277 | checkRemote := state.Remote |
| 1278 | if r.rootIsCrypt { |
| 1279 | cryptFs := f.(*crypt.Fs) |
| 1280 | checkRemote, err = cryptFs.DecryptFileName(checkRemote) |
| 1281 | require.NoError(t, err) |
| 1282 | } |
| 1283 | if checkRemote == lastRemote && cache.BackgroundUploadCompleted == state.Status { |
| 1284 | require.NoError(t, state.Error) |
| 1285 | return |
| 1286 | } |
| 1287 | case <-time.After(maxDuration): |
| 1288 | t.Fatalf("Timed out waiting to complete the background upload %v", lastRemote) |
| 1289 | return |
| 1290 | } |
| 1291 | } |
| 1292 | } |
| 1293 | |
| 1294 | func (r *run) retryBlock(block func() error, maxRetries int, rate time.Duration) error { |
| 1295 | var err error |
no test coverage detected