makeTempRemote creates temporary folder and makes a filesystem if a local path is provided, it's ignored (the test will run under system temp)
(ctx context.Context, remote, subdir string)
| 620 | // makeTempRemote creates temporary folder and makes a filesystem |
| 621 | // if a local path is provided, it's ignored (the test will run under system temp) |
| 622 | func (b *bisyncTest) makeTempRemote(ctx context.Context, remote, subdir string) (f, parent fs.Fs, path, canon string) { |
| 623 | var err error |
| 624 | if isLocal(remote) { |
| 625 | if remote != "" && !strings.HasPrefix(remote, "local") && *fstest.RemoteName != "" { |
| 626 | b.t.Fatalf(`Missing ":" in remote %q. Use "local" to test with local filesystem.`, remote) |
| 627 | } |
| 628 | parent, err = cache.Get(ctx, b.tempDir) |
| 629 | checkError(b.t, err, "parsing local tempdir %s", b.tempDir) |
| 630 | |
| 631 | path = filepath.Join(b.tempDir, b.testCase) |
| 632 | path = filepath.Join(path, subdir) |
| 633 | } else { |
| 634 | last := remote[len(remote)-1] |
| 635 | if last != ':' && last != '/' { |
| 636 | remote += "/" |
| 637 | } |
| 638 | remote += b.randName |
| 639 | parent, err = cache.Get(ctx, remote) |
| 640 | checkError(b.t, err, "parsing remote %s", remote) |
| 641 | checkError(b.t, operations.Mkdir(ctx, parent, subdir), "Mkdir "+subdir) // ensure dir exists (storj seems to need this) |
| 642 | |
| 643 | path = remote + "/" + b.testCase |
| 644 | path += "/" + subdir |
| 645 | } |
| 646 | |
| 647 | f, err = cache.Get(ctx, path) |
| 648 | checkError(b.t, err, "parsing remote/subdir %s/%s", remote, subdir) |
| 649 | path = bilib.FsPath(f) // Make it canonical |
| 650 | canon = bilib.StripHexString(bilib.CanonicalPath(strings.TrimSuffix(strings.TrimSuffix(path, `\`+subdir+`\`), "/"+subdir+"/"))) + "_" // account for possible connection string |
| 651 | return |
| 652 | } |
| 653 | |
| 654 | func (b *bisyncTest) cleanupCase(ctx context.Context) { |
| 655 | _ = operations.Purge(ctx, b.fs1, "") |
no test coverage detected