Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client Telemetry: Adds Assertion message to the test #3218

Merged
merged 1 commit into from
May 24, 2022
Merged
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 @@ -172,12 +172,12 @@ private static void ResetSystemUsageMonitor(bool isTelemetryEnabled)
[TestCleanup]
public async Task Cleanup()
{
var isInitializedField = typeof(VmMetadataApiHandler).GetField("isInitialized",
FieldInfo isInitializedField = typeof(VmMetadataApiHandler).GetField("isInitialized",
BindingFlags.Static |
BindingFlags.NonPublic);
isInitializedField.SetValue(null, false);

var azMetadataField = typeof(VmMetadataApiHandler).GetField("azMetadata",
FieldInfo azMetadataField = typeof(VmMetadataApiHandler).GetField("azMetadata",
BindingFlags.Static |
BindingFlags.NonPublic);
azMetadataField.SetValue(null, null);
Expand Down Expand Up @@ -944,17 +944,17 @@ private static void AssertAccountLevelInformation(
}
}

Assert.AreEqual(1, machineId.Count);
Assert.AreEqual(1, machineId.Count, $"Multiple Machine Id has been generated i.e {JsonConvert.SerializeObject(machineId)}");

if(isAzureInstance.HasValue)
{
if (isAzureInstance.Value)
{
Assert.AreEqual("vmId:d0cb93eb-214b-4c2b-bd3d-cc93e90d9efd", machineId.ToList()[0]);
Assert.AreEqual("vmId:d0cb93eb-214b-4c2b-bd3d-cc93e90d9efd", machineId.First(), $"Generated Machine id is : {machineId.First()}");
}
else
{
Assert.AreNotEqual("vmId:d0cb93eb-214b-4c2b-bd3d-cc93e90d9efd", machineId.ToList()[0]);
Assert.AreNotEqual("vmId:d0cb93eb-214b-4c2b-bd3d-cc93e90d9efd", machineId.First(), $"Generated Machine id is : {machineId.First()}");
}
}

Expand Down