CI / Build and test (push) Successful in 8m14s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 7s
Release / Build, test and publish (push) Successful in 13m19s
CI / PostgreSQL 16 integration (push) Successful in 4m49s
CI / PostgreSQL 17 integration (push) Successful in 5m28s
CI / Docker image (push) Successful in 53s
Release / Server image (push) Failing after 10s
The owner renamed the product and moved the repository to the self-hosted Gitea (https://gitea.encke-hake.ts.net/BalboSoft/Chronos) for more control, and asked for Actions and a first automatic release with the server package and the Windows exe (docs/requests/2026-10-23-chronos-gitea.md). - Chronos everywhere: a byte-exact rename of contents and paths, then a per-language review of the forms the old name's ending had dictated. - Gitea instead of GitHub: the update check, licence, issue and support links read ChronosReleasesUrl; the update check takes the highest stable version, offers a pre-release build its final release and reports a repository it cannot see as a failed check. EULA, security policy and Gitea issue forms live at the repository root. - Gitea Actions for the Linux act_runner (.gitea/workflows): CI, release, nightly image and performance gates in the .NET SDK container with git checkout and the system SQLite. The release cross-compiles the Windows programs, checks their icon, version and DPI manifest, packs installers and zips, publishes the Gitea release and pushes the server image (REGISTRY_TOKEN). Windows-only tests run in an opt-in job on a Windows runner (WINDOWS_RUNNER). - New Chronos.Tools commands: zip, gitea-release, postgres-ci (replaces the docker-exec script, which Gitea's service containers do not allow; the throw-away server runs without durability) and pe-check. - Timed tests take their budget from TestTiming (CHRONOS_TEST_TIME_FACTOR, 3 on the shared runner; the weekly performance gates keep theirs). BREAKING CHANGE: programs, settings, data folders, file types, environment variables and the Docker image use the new name; nothing is migrated from Titano, which never had a release. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
99 lines
4.0 KiB
C#
99 lines
4.0 KiB
C#
using System.Text.RegularExpressions;
|
|
using Chronos.Core.Windows.Devices;
|
|
using Chronos.Testing;
|
|
|
|
namespace Chronos.Core.Windows.Tests.Devices;
|
|
|
|
public sealed class VolumeTests
|
|
{
|
|
[Test]
|
|
[WindowsOnly]
|
|
public void ListingIncludesTheSystemDriveWithItsSerial()
|
|
{
|
|
var systemRoot = Path.GetPathRoot(Environment.SystemDirectory)!;
|
|
var volumes = VolumeInfo.ListLocal();
|
|
var system = volumes.FirstOrDefault(v => string.Equals(v.RootPath, systemRoot, StringComparison.OrdinalIgnoreCase));
|
|
if (system is null) Assert.Fail($"{systemRoot} missing from [{string.Join(", ", volumes.Select(v => v.RootPath))}]");
|
|
Assert.NotEqual(0u, system!.SerialNumber);
|
|
Assert.Greater(system.TotalBytes, 0);
|
|
Assert.InRange(system.FreeBytes, 0, system.TotalBytes);
|
|
Assert.Equal(VolumeDriveType.Fixed, system.DriveType);
|
|
Assert.False(string.IsNullOrEmpty(system.FileSystem));
|
|
Assert.True(Regex.IsMatch(system.Identity, "^[0-9A-F]{8}-.*-[0-9]+$"), system.Identity);
|
|
}
|
|
|
|
[Test]
|
|
[WindowsOnly]
|
|
public void MissingDriveLetterReadsAsNull()
|
|
{
|
|
var used = DriveInfo.GetDrives().Select(d => char.ToUpperInvariant(d.Name[0])).ToHashSet();
|
|
var free = Enumerable.Range('D', 23).Select(c => (char)c).Where(c => !used.Contains(c)).ToArray();
|
|
if (free.Length == 0) TestContext.Skip("Every drive letter is in use.");
|
|
Assert.Null(VolumeInfo.TryRead($"{free[^1]}:\\"));
|
|
}
|
|
|
|
[Test]
|
|
[WindowsOnly]
|
|
public void RootsAreNormalised()
|
|
{
|
|
Assert.Equal(@"E:\", VolumeInfo.NormalizeRoot("e:"));
|
|
Assert.Equal(@"E:\", VolumeInfo.NormalizeRoot(@"E:\"));
|
|
Assert.Equal(@"E:\", VolumeInfo.NormalizeRoot(@"e:\DCIM\100CANON"));
|
|
}
|
|
|
|
[Test]
|
|
public void IdentityFollowsTheBriefFormat()
|
|
{
|
|
var card = new VolumeInfo(@"E:\", "EOS_DIGITAL", "exFAT", 0x3F2A9C11, 127_865_454_592, 1_000, VolumeDriveType.Removable, true);
|
|
Assert.Equal("3F2A9C11-EOS_DIGITAL-127865454592", card.Identity);
|
|
Assert.Equal('E', card.DriveLetter);
|
|
Assert.Equal("0000000A--1024", (card with { SerialNumber = 10, Label = "", TotalBytes = 1024 }).Identity);
|
|
}
|
|
|
|
[Test]
|
|
public void CandidatesAreRemovableOrCameraVolumes()
|
|
{
|
|
var card = new VolumeInfo(@"E:\", "", "exFAT", 1, 1, 1, VolumeDriveType.Removable, false);
|
|
Assert.True(RemovableVolumeWatcher.IsCandidate(card));
|
|
Assert.False(RemovableVolumeWatcher.IsCandidate(card with { DriveType = VolumeDriveType.Fixed }));
|
|
Assert.True(RemovableVolumeWatcher.IsCandidate(card with { DriveType = VolumeDriveType.Fixed, HasDcim = true }));
|
|
Assert.False(RemovableVolumeWatcher.IsCandidate(card with { DriveType = VolumeDriveType.Remote, HasDcim = true }));
|
|
}
|
|
|
|
[Test]
|
|
[WindowsOnly]
|
|
[Timeout(30_000)]
|
|
public void WatcherStartsAndStops()
|
|
{
|
|
using var watcher = new RemovableVolumeWatcher();
|
|
watcher.Start();
|
|
Assert.True(watcher.Volumes.All(RemovableVolumeWatcher.IsCandidate));
|
|
Assert.Throws<InvalidOperationException>(watcher.Start);
|
|
watcher.Dispose();
|
|
Assert.Throws<ObjectDisposedException>(watcher.Start);
|
|
}
|
|
|
|
[Test]
|
|
[WindowsOnly]
|
|
public void EjectRefusesTheSystemDrive()
|
|
{
|
|
var letter = Path.GetPathRoot(Environment.SystemDirectory)![0];
|
|
Assert.Equal(EjectResult.NotRemovable, VolumeEjector.Eject(letter));
|
|
}
|
|
|
|
[Test]
|
|
public void EjectRejectsNonLetters() => Assert.Throws<ArgumentOutOfRangeException>(() => VolumeEjector.Eject('1'));
|
|
|
|
[Test]
|
|
public void FormatDialogNeedsAnOwnerWindow() => Assert.Throws<ArgumentException>(() => FormatDialog.Show(0, 'E'));
|
|
|
|
[Test]
|
|
[WindowsOnly]
|
|
public void FormatDialogRefusesTheSystemDrive()
|
|
{
|
|
var letter = Path.GetPathRoot(Environment.SystemDirectory)![0];
|
|
// The guard runs before the dialog, so any non-null owner handle exercises it without showing UI.
|
|
Assert.Throws<InvalidOperationException>(() => FormatDialog.Show(1, letter));
|
|
}
|
|
}
|