Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ public void GetMetadataForHeartBeatDoesNotChangeEventLevelWhenNoPlaceholderHaveB
metadata.ShouldContain("ModifiedPathsCount", 1);
metadata.ShouldContain("FilePlaceholderCount", 0);
metadata.ShouldContain(nameof(RepoMetadata.Instance.EnlistmentId), RepoMetadata.Instance.EnlistmentId);
metadata.ShouldContain("IsSendingAnonymousRequests", true);
}

mockPlaceholderDb.VerifyAll();
Expand Down Expand Up @@ -159,7 +160,7 @@ public void GetMetadataForHeartBeatDoesSetsEventLevelToInformationalWhenPlacehol
eventLevel.ShouldEqual(EventLevel.Informational);

// "ModifiedPathsCount" should be 1 because ".gitattributes" is always present
metadata.Count.ShouldEqual(8);
metadata.Count.ShouldEqual(9);
metadata.ContainsKey("FilePlaceholderCreation").ShouldBeTrue();
metadata.TryGetValue("FilePlaceholderCreation", out object fileNestedMetadata);
GVFSJsonOptions.Serialize(fileNestedMetadata).ShouldContain("\"ProcessName1\":\"GVFS.UnitTests.exe\"");
Expand All @@ -169,6 +170,7 @@ public void GetMetadataForHeartBeatDoesSetsEventLevelToInformationalWhenPlacehol
metadata.ShouldContain("FolderPlaceholderCount", 0);
metadata.ShouldContain(nameof(RepoMetadata.Instance.EnlistmentId), RepoMetadata.Instance.EnlistmentId);
metadata.ContainsKey("PhysicalDiskInfo").ShouldBeTrue();
metadata.ShouldContain("IsSendingAnonymousRequests", true);

// Create more placeholders
fileSystemCallbacks.OnPlaceholderFileCreated("test.txt", "2222233333444445555566666777778888899999", "GVFS.UnitTests.exe2");
Expand All @@ -182,7 +184,7 @@ public void GetMetadataForHeartBeatDoesSetsEventLevelToInformationalWhenPlacehol
eventLevel = writeToLogFile2 ? EventLevel.Informational : EventLevel.Verbose;
eventLevel.ShouldEqual(EventLevel.Informational);

metadata.Count.ShouldEqual(8);
metadata.Count.ShouldEqual(9);

// Only processes that have created placeholders since the last heartbeat should be named
metadata.ContainsKey("FilePlaceholderCreation").ShouldBeTrue();
Expand All @@ -202,6 +204,7 @@ public void GetMetadataForHeartBeatDoesSetsEventLevelToInformationalWhenPlacehol
metadata.ShouldContain("FolderPlaceholderCount", 1);
metadata.ShouldContain(nameof(RepoMetadata.Instance.EnlistmentId), RepoMetadata.Instance.EnlistmentId);
metadata.ContainsKey("PhysicalDiskInfo").ShouldBeTrue();
metadata.ShouldContain("IsSendingAnonymousRequests", true);
}

mockPlaceholderDb.VerifyAll();
Expand Down
6 changes: 6 additions & 0 deletions GVFS/GVFS.Virtualization/FileSystemCallbacks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,12 @@ public EventMetadata GetAndResetHeartBeatMetadata(out bool logToFile)
this.context.Enlistment.WorkingDirectoryBackingRoot,
sizeStatsOnly: true));

// True/false means "HttpRequestor is/isn't attaching an Authorization
// header to outgoing requests" (see HttpRequestor.cs), so a mount stuck
// reporting true for long stretches against a server that requires auth
// is the signature of the anonymous-auth-latch bug this field detects.
metadata.Add("IsSendingAnonymousRequests", this.context.Enlistment.Authentication.IsAnonymous);

return metadata;
}

Expand Down
Loading