Files
Alby96andClaude Opus 5.5 255e149087
CI / Build and test (push) Successful in 9m36s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 9s
Release / Build, test and publish (push) Successful in 14m4s
CI / PostgreSQL 16 integration (push) Successful in 8m26s
CI / PostgreSQL 17 integration (push) Successful in 8m43s
CI / Docker image (push) Successful in 50s
Release / Server image (push) Successful in 1m23s
fix: owner review 3 phase 1: server ports for clients, screenshot baselines (#16)
Clients could not reach a server in a container whose ports are published as other host ports: the panel showed the container's ports, the template had no public HTTP port, and a bare host meant port 443. Public ports become panel settings, the panel shows the client address, both clients default to 8443, and an address that answers as another service is named as not a Chronos server (its certificate never offered for trust). The screenshot baselines are captured on the development PC and committed; measured values are fixed while the capture runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
2026-11-04 12:33:22 +01:00

42 lines
1.7 KiB
C#

using Chronos.Testing;
using Chronos.Uploader.Server;
namespace Chronos.App.Tests.Uploader;
public sealed class ServerAddressTests
{
[Theory]
[Case("nas.local:8443", "https://nas.local:8443/")]
[Case("https://nas.local:8443", "https://nas.local:8443/")]
[Case(" http://192.168.1.20:8080/chronos ", "http://192.168.1.20:8080/chronos/")]
[Case("https://nas.local/?x=1#y", "https://nas.local/")]
// Owner review 3: no scheme and no port is Chronos's HTTPS port, as the placeholder shows.
[Case("192.168.30.23", "https://192.168.30.23:8443/")]
[Case("nas.local", "https://nas.local:8443/")]
[Case("nas.local/chronos", "https://nas.local:8443/chronos/")]
[Case("192.168.30.23:8444", "https://192.168.30.23:8444/")]
[Case("nas.local:443", "https://nas.local/")]
[Case("https://chronos.example.com", "https://chronos.example.com/")]
[Case("http://nas.local", "http://nas.local/")]
[Case("fd00::5", "https://[fd00::5]:8443/")]
[Case("[fd00::5]", "https://[fd00::5]:8443/")]
[Case("[fd00::5]:9443", "https://[fd00::5]:9443/")]
[Case("https://[fd00::5]", "https://[fd00::5]/")]
public void ServerAddressesBecomeApiBases(string typed, string expected)
{
Assert.True(ServerAddress.TryParse(typed, out var uri));
Assert.Equal(expected, uri.ToString());
}
[Theory]
[Case("")]
[Case(" ")]
[Case("ftp://nas.local")]
[Case("https://")]
// A zone index cannot reach the request: refused rather than dropped.
[Case("fe80::1%12")]
[Case("[fe80::1%12]:8443")]
[Case("https://[fe80::1%2512]")]
public void InvalidServerAddressesAreRejected(string typed) => Assert.False(ServerAddress.TryParse(typed, out _));
}