32d7fd7cc9
v2-ci / build (push) Failing after 48s
v2-ci / unit-tests (tests/Core/ZB.MOM.WW.OtOpcUa.Cluster.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.ControlPlane.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.Runtime.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.Security.Tests) (push) Has been skipped
v2-ci / integration (tests/Server/ZB.MOM.WW.OtOpcUa.Host.IntegrationTests) (push) Has been skipped
v2-ci / integration (tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.IntegrationTests) (push) Has been skipped
The driver/factory/seed use 'GalaxyMxGateway' (legacy 'Galaxy' was retired),
but the AdminUI editor router, GalaxyDriverPage, address picker, identity
dropdown, the Galaxy browser/probe, and DraftValidator still keyed on 'Galaxy'.
Result: the seeded GalaxyMxGateway driver couldn't be edited ('no editor
registered'), UI-created Galaxy drivers wrote a type with no factory, and a
SystemPlatform-bound GalaxyMxGateway driver failed publish validation.
Align all stragglers to GalaxyMxGateway (+ failing-test-first DraftValidator
coverage). ShouldStub's 'Galaxy' legacy safety-net left intact.
56 lines
2.7 KiB
C#
56 lines
2.7 KiB
C#
using Shouldly;
|
|
using Xunit;
|
|
|
|
namespace ZB.MOM.WW.OtOpcUa.Driver.Galaxy.Browser.Tests;
|
|
|
|
/// <summary>
|
|
/// Unit-only coverage of <see cref="GalaxyDriverBrowser"/>'s pre-connect validation.
|
|
/// These tests do not require a live mxaccessgw endpoint and are safe to run without
|
|
/// the gateway fixture — they exercise the JSON deserialization + validation paths
|
|
/// that run before <c>GalaxyRepositoryClient.Create</c> + <c>TestConnectionAsync</c>.
|
|
/// The factory's transport-construction path is covered by the integration suite
|
|
/// (Task 17) and manual smoke (Task 18) since both require a real gateway.
|
|
/// </summary>
|
|
[Trait("Category", "Unit")]
|
|
public sealed class GalaxyDriverBrowserTests
|
|
{
|
|
private readonly GalaxyDriverBrowser _sut = new();
|
|
|
|
/// <summary>The DriverType key must match the AdminUI's persisted "GalaxyMxGateway" value
|
|
/// so the factory wire-up picks the right browser implementation.</summary>
|
|
[Fact]
|
|
public void DriverType_is_GalaxyMxGateway() => _sut.DriverType.ShouldBe("GalaxyMxGateway");
|
|
|
|
/// <summary>An empty Gateway.Endpoint must fail fast with a clear, endpoint-mentioning
|
|
/// message rather than surfacing a downstream gRPC URI parse error.</summary>
|
|
[Fact]
|
|
public async Task OpenAsync_with_empty_endpoint_throws_InvalidOperationException()
|
|
{
|
|
var json = """{"Gateway":{"Endpoint":"","ApiKeySecretRef":"dev:k"},"MxAccess":{"ClientName":"X"},"Repository":{},"Reconnect":{}}""";
|
|
var ex = await Should.ThrowAsync<InvalidOperationException>(
|
|
() => _sut.OpenAsync(json, TestContext.Current.CancellationToken));
|
|
ex.Message.ShouldContain("Endpoint");
|
|
}
|
|
|
|
/// <summary>An empty MxAccess.ClientName must fail fast — refused so the gateway
|
|
/// side doesn't see anonymous browse sessions during triage.</summary>
|
|
[Fact]
|
|
public async Task OpenAsync_with_empty_clientName_throws_InvalidOperationException()
|
|
{
|
|
var json = """{"Gateway":{"Endpoint":"http://127.0.0.1:1","ApiKeySecretRef":"dev:k"},"MxAccess":{"ClientName":""},"Repository":{},"Reconnect":{}}""";
|
|
var ex = await Should.ThrowAsync<InvalidOperationException>(
|
|
() => _sut.OpenAsync(json, TestContext.Current.CancellationToken));
|
|
ex.Message.ShouldContain("ClientName");
|
|
}
|
|
|
|
/// <summary>A JSON literal that deserializes to null must fail fast with a
|
|
/// "deserialized to null" message — never a downstream NRE.</summary>
|
|
[Fact]
|
|
public async Task OpenAsync_with_null_json_throws_InvalidOperationException()
|
|
{
|
|
var ex = await Should.ThrowAsync<InvalidOperationException>(
|
|
() => _sut.OpenAsync("null", TestContext.Current.CancellationToken));
|
|
ex.Message.ShouldContain("null");
|
|
}
|
|
}
|