test(gateway): reconcile Galaxy tests to the shared library (delete upstream-owned, rebind host-specific)

This commit is contained in:
Joseph Doherty
2026-06-25 12:12:03 -04:00
parent 80bf4acc4f
commit 719a57f444
21 changed files with 143 additions and 2264 deletions
@@ -1,10 +1,11 @@
using System.Globalization;
using Microsoft.Extensions.Options;
using ZB.MOM.WW.Auth.Abstractions.ApiKeys;
using ZB.MOM.WW.GalaxyRepository;
using ZB.MOM.WW.GalaxyRepository.Grpc;
using ZB.MOM.WW.MxGateway.Contracts.Proto;
using ZB.MOM.WW.MxGateway.Server.Configuration;
using ZB.MOM.WW.MxGateway.Server.Dashboard;
using ZB.MOM.WW.MxGateway.Server.Galaxy;
using ZB.MOM.WW.MxGateway.Server.Metrics;
using ZB.MOM.WW.MxGateway.Server.Security.Authentication;
using ZB.MOM.WW.MxGateway.Server.Security.Authorization;
@@ -215,6 +216,35 @@ public sealed class DashboardSnapshotServiceTests
[Fact]
public void GetSnapshot_ProjectsGalaxySummaryFromHierarchyCache()
{
// The shared-library cache entry no longer carries a precomputed dashboard summary;
// DashboardSnapshotService derives templates/categories from the entry's objects via
// DashboardGalaxyProjector. Seed objects that yield $Pump x2 / $Area x1 templates and
// categories UserDefined(10) x2 / Area(13) x1, matching the asserted summary.
GalaxyObject[] objects =
[
new GalaxyObject
{
GobjectId = 1,
BrowseName = "AreaA",
IsArea = true,
CategoryId = 13,
TemplateChain = { "$Area" },
},
new GalaxyObject
{
GobjectId = 2,
BrowseName = "Pump01",
CategoryId = 10,
TemplateChain = { "$Pump" },
},
new GalaxyObject
{
GobjectId = 3,
BrowseName = "Pump02",
CategoryId = 10,
TemplateChain = { "$Pump" },
},
];
GalaxyHierarchyCacheEntry entry = GalaxyHierarchyCacheEntry.Empty with
{
Status = GalaxyCacheStatus.Healthy,
@@ -222,27 +252,8 @@ public sealed class DashboardSnapshotServiceTests
LastQueriedAt = DateTimeOffset.Parse("2026-04-28T11:30:00Z", CultureInfo.InvariantCulture),
LastSuccessAt = DateTimeOffset.Parse("2026-04-28T11:30:00Z", CultureInfo.InvariantCulture),
LastDeployTime = DateTimeOffset.Parse("2026-04-28T09:00:00Z", CultureInfo.InvariantCulture),
DashboardSummary = new DashboardGalaxySummary(
DashboardGalaxyStatus.Healthy,
LastQueriedAt: DateTimeOffset.Parse("2026-04-28T11:30:00Z", CultureInfo.InvariantCulture),
LastSuccessAt: DateTimeOffset.Parse("2026-04-28T11:30:00Z", CultureInfo.InvariantCulture),
LastDeployTime: DateTimeOffset.Parse("2026-04-28T09:00:00Z", CultureInfo.InvariantCulture),
LastError: null,
ObjectCount: 3,
AreaCount: 1,
AttributeCount: 2,
HistorizedAttributeCount: 1,
AlarmAttributeCount: 1,
TopTemplates:
[
new DashboardGalaxyTemplateUsage("$Pump", 2),
new DashboardGalaxyTemplateUsage("$Area", 1),
],
ObjectCategories:
[
new DashboardGalaxyCategoryCount(10, "UserDefined", 2),
new DashboardGalaxyCategoryCount(13, "Area", 1),
]),
Objects = objects,
Index = GalaxyHierarchyIndex.Build(objects),
ObjectCount = 3,
AreaCount = 1,
AttributeCount = 2,