MCPcopy
hub / github.com/rclone/rclone / saveTestListings

Method saveTestListings

cmd/bisync/bisync_test.go:1234–1261  ·  view source on GitHub ↗

saveTestListings creates a copy of test artifacts with given prefix including listings (.lst*), queues (.que) and filters (.flt, .flt.md5)

(prefix string, keepSource bool)

Source from the content-addressed store, hash-verified

1232// saveTestListings creates a copy of test artifacts with given prefix
1233// including listings (.lst*), queues (.que) and filters (.flt, .flt.md5)
1234func (b *bisyncTest) saveTestListings(prefix string, keepSource bool) (err error) {
1235 count := 0
1236 for _, srcFile := range b.listDir(b.workDir) {
1237 switch fileType(srcFile) {
1238 case "listing", "queue", "filters":
1239 // fall thru
1240 default:
1241 continue
1242 }
1243 count++
1244 dstFile := fmt.Sprintf("%s.%s.sav", prefix, b.toGolden(srcFile))
1245 src := filepath.Join(b.workDir, srcFile)
1246 dst := filepath.Join(b.workDir, dstFile)
1247 if err = bilib.CopyFile(src, dst); err != nil {
1248 return
1249 }
1250 if keepSource {
1251 continue
1252 }
1253 if err = os.Remove(src); err != nil {
1254 return
1255 }
1256 }
1257 if count == 0 {
1258 err = errors.New("listings not found")
1259 }
1260 return
1261}
1262
1263func (b *bisyncTest) copyFile(ctx context.Context, src, dst, asName string) (err error) {
1264 fs.Debugf(nil, "copyFile %q to %q as %q", src, dst, asName)

Callers 1

runTestStepMethod · 0.95

Calls 6

listDirMethod · 0.95
toGoldenMethod · 0.95
CopyFileFunction · 0.92
fileTypeFunction · 0.85
JoinMethod · 0.80
RemoveMethod · 0.65

Tested by

no test coverage detected