test: replace the operator's own tenant/device identities with synthetic values

Test code used the real test-tenant GUID, a real UPN, a real VM serial (and
its Intune-normalized form) and a real hostname as literals. None of the
assertions depended on the specific values; they are contoso/1111…/1234… now.
The one that stays is CertTenantBindingTests: its tenant GUID is stamped
inside device-cert-sample.pem and can only change together with the fixture.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Oliver Kieselbach
2026-09-02 00:13:59 +02:00
parent a5c42de28c
commit 1955efdae5
6 changed files with 10 additions and 10 deletions
@@ -644,7 +644,7 @@ namespace AutopilotMonitor.Agent.V2.Core.Tests.SignalAdapters
[Fact]
public void AutoUpdate_fires_once_with_previous_and_new_version_when_binary_version_changes_after_detection()
{
// gktatooine session 946ccbd6: realmjoin_detected read 4.21.4 from the MSI-shipped
// Observed on a test-tenant session: realmjoin_detected read 4.21.4 from the MSI-shipped
// binary; nine minutes later the tray AppUpdater swapped it for 4.21.18 and rewrote
// Uninstall\RealmJoin. The Detected read is the baseline; the re-read after the
// Uninstall-key change must surface exactly one auto-update event.
@@ -81,10 +81,10 @@ public class CloudPcDeviceValidatorTests
var body = $@"{{
""value"":[{{
""id"":""423a1fb4-6033-4b69-a31f-e7f3f54194dc"",
""displayName"":""GKT-CloudPC - Obi-Wan Kenobi"",
""displayName"":""CPC-Contoso - Obi-Wan Kenobi"",
""managedDeviceId"":""{DeviceId}"",
""managedDeviceName"":""CPC-cloud-AY5HT"",
""userPrincipalName"":""cloudadmin@gktatooine.net"",
""userPrincipalName"":""cloudadmin@contoso.com"",
""servicePlanName"":""Cloud PC Enterprise 2vCPU/4GB/128GB""
}}]
}}";
@@ -22,12 +22,12 @@ namespace AutopilotMonitor.Functions.Tests;
public class CorporateIdentifierValidatorTests
{
private const string TenantId = "11111111-1111-1111-1111-111111111111";
private const string Serial = "7801-5131-4473-3387-5637-4002-18";
private const string Serial = "1234-5678-9012-3456-7890-1234-56";
private const string MmsIdentifier = $"Microsoft Corporation,Virtual Machine,{Serial}";
// The form Intune actually stores (field-verified 2026-08-17 in the portal list):
// uppercased, spaces and dashes stripped per component.
private const string StoredIdentifier = "MICROSOFTCORPORATION,VIRTUALMACHINE,78015131447333875637400218";
private const string StoredSerial = "78015131447333875637400218";
private const string StoredIdentifier = "MICROSOFTCORPORATION,VIRTUALMACHINE,12345678901234567890123456";
private const string StoredSerial = "12345678901234567890123456";
private sealed class SequenceHandler : HttpMessageHandler
{
@@ -200,7 +200,7 @@ public class CorporateIdentifierValidatorTests
[Theory]
[InlineData("Microsoft Corporation", "MICROSOFTCORPORATION")]
[InlineData("Virtual Machine", "VIRTUALMACHINE")]
[InlineData("7801-5131-4473-3387-5637-4002-18", "78015131447333875637400218")]
[InlineData("1234-5678-9012-3456-7890-1234-56", "12345678901234567890123456")]
[InlineData("ThinkPad T14 Gen 3", "THINKPADT14GEN3")]
[InlineData("Serial.With.Periods", "SERIALWITHPERIODS")]
public void NormalizeComponent_matchesIntunePortalNormalization(string raw, string expected)
@@ -13,7 +13,7 @@ namespace AutopilotMonitor.Functions.Tests;
/// </summary>
public class IngestOnDemandDiagnosticsTests
{
private const string TenantId = "b54dc1af-5320-4f60-b5d4-821e0cf2a359";
private const string TenantId = "11111111-1111-1111-1111-111111111111";
private const string HostedBlob =
TenantId + "/AgentDiagnostics-8e4cc8ae-1111-2222-3333-444455556666-20260724170902-server-requested.zip";
@@ -21,7 +21,7 @@ public class SecurityValidatorTests
[InlineData("", false)]
[InlineData(" ", false)] // whitespace only
[InlineData("not-a-guid", false)]
[InlineData(@"DESKTOP-DIU8038\defaultuser0", false)] // regression: agent-as-defaultuser0 sent this as TenantId
[InlineData(@"DESKTOP-CONTOSO\defaultuser0", false)] // regression: agent-as-defaultuser0 sent this as TenantId
[InlineData("a1b2c3d4e5f67890abcdef1234567890", false)] // no dashes → not standard format
[InlineData("{a1b2c3d4-e5f6-7890-abcd-ef1234567890}", false)] // braced {…} not accepted
public void IsValidGuid_reflects_guid_format(string? input, bool expected)
@@ -11,7 +11,7 @@ namespace AutopilotMonitor.Functions.Tests;
/// </summary>
public class SessionAnnotationsPaginationTests
{
private const string Caller = "b54dc1af-5320-4f60-b5d4-821e0cf2a359";
private const string Caller = "11111111-1111-1111-1111-111111111111";
[Fact]
public void ParseQuery_reads_and_trims_q()