forked from microsoft/VFSForGit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPrefetchBlobsOffloadTests.cs
More file actions
83 lines (74 loc) · 3.16 KB
/
Copy pathPrefetchBlobsOffloadTests.cs
File metadata and controls
83 lines (74 loc) · 3.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
using GVFS.FunctionalTests.FileSystemRunners;
using GVFS.FunctionalTests.Should;
using GVFS.FunctionalTests.Tools;
using GVFS.Tests.Should;
using NUnit.Framework;
using System.IO;
namespace GVFS.FunctionalTests.Tests.EnlistmentPerFixture
{
[TestFixture]
public class PrefetchBlobsOffloadTests : TestsWithEnlistmentPerFixture
{
private FileSystemRunner fileSystem;
public PrefetchBlobsOffloadTests()
{
this.fileSystem = new SystemIORunner();
}
[TestCase, Order(1)]
public void PrefetchBlobsMountedUsesOffload()
{
// With the enlistment mounted, blob prefetch should succeed
// by offloading to the mount process (using its warm auth).
string output = this.Enlistment.Prefetch($"--files {Path.Combine("GVFS", "GVFS", "Program.cs")}");
output.ShouldContain("Matched blobs:");
output.ShouldContain("Downloaded:");
}
[TestCase, Order(2)]
public void PrefetchBlobsMountedReportsStats()
{
// Prefetch multiple files and verify stats are reported
string output = this.Enlistment.Prefetch(
$"--files {Path.Combine("GVFS", "GVFS", "Program.cs")};{Path.Combine("GVFS", "GVFS.FunctionalTests", "GVFS.FunctionalTests.csproj")}");
output.ShouldContain("Matched blobs:");
output.ShouldContain("Already cached:");
output.ShouldContain("Downloaded:");
}
[TestCase, Order(3)]
public void PrefetchBlobsUnmountedFallsBackToDirectAuth()
{
// Unmount, then blob prefetch should fall back to direct auth
// and still succeed. Use a file not prefetched by earlier tests
// so the noop cache doesn't short-circuit.
this.Enlistment.UnmountGVFS();
try
{
string output = this.Enlistment.Prefetch($"--files {Path.Combine("GVFS", "GVFS.Common", "GVFSEnlistment.cs")}");
output.ShouldContain("Matched blobs:");
output.ShouldContain("Downloaded:");
}
finally
{
this.Enlistment.MountGVFS();
}
}
[TestCase, Order(4)]
public void PrefetchBlobsMountedWithFolders()
{
// Prefetch a folder while mounted
string output = this.Enlistment.Prefetch("--folders GVFS/GVFS");
output.ShouldContain("Matched blobs:");
}
[TestCase, Order(5)]
public void PrefetchBlobsMountedAfterRemount()
{
// After unmount + remount, blob prefetch should work via
// the mount process again. Since this file was already
// prefetched in Order(1), the noop cache correctly detects
// there's nothing new to download.
this.Enlistment.UnmountGVFS();
this.Enlistment.MountGVFS();
string output = this.Enlistment.Prefetch($"--files {Path.Combine("GVFS", "GVFS", "Program.cs")}");
output.ShouldContain("Nothing new to prefetch.");
}
}
}