Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Assets/Tests/Editor/CompilationLockFileServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public void SetUp()
[TearDown]
public void TearDown()
{
_service.DeleteLockFile();
_stateStore.Delete();
}

Expand Down
10 changes: 5 additions & 5 deletions Assets/Tests/Editor/DomainReloadDetectionServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,20 @@ public void SetUp()
_stateStore = CreateTestStateStore();
_domainReloadDetectionService = new DomainReloadDetectionFileService(_editorSettingsService, _stateStore);
UnityCliLoopEditorDomainReloadStateProvider.SetDomainReloadInProgressFromMainThread(false);
_domainReloadDetectionService.DeleteLockFile();
}

[TearDown]
public void TearDown()
{
_editorSettingsService.SaveSettings(_originalSettings);
UnityCliLoopEditorDomainReloadStateProvider.SetDomainReloadInProgressFromMainThread(false);
_domainReloadDetectionService.DeleteLockFile();
_stateStore.Delete();
}

[Test]
public void RollbackDomainReloadStart_ClearsTemporaryFlagsProviderStateAndLockFile()
public void RollbackDomainReloadStart_ClearsTemporaryFlagsProviderStateAndPublishesFailureState()
{
// Verifies rollback clears transient reload state and records a failed readiness phase.
const string correlationId = "test-correlation";
UnityCliLoopEditorDomainReloadStateProvider provider = new();

Expand All @@ -52,7 +51,6 @@ public void RollbackDomainReloadStart_ClearsTemporaryFlagsProviderStateAndLockFi
Assert.That(startedSettings.showReconnectingUI, Is.True);
Assert.That(startedSettings.showPostCompileReconnectingUI, Is.True);
Assert.That(provider.IsDomainReloadInProgress(), Is.True);
Assert.That(_domainReloadDetectionService.IsLockFilePresent(), Is.True);

_domainReloadDetectionService.RollbackDomainReloadStart(correlationId);

Expand All @@ -64,7 +62,9 @@ public void RollbackDomainReloadStart_ClearsTemporaryFlagsProviderStateAndLockFi
Assert.That(rolledBackSettings.showReconnectingUI, Is.False);
Assert.That(rolledBackSettings.showPostCompileReconnectingUI, Is.False);
Assert.That(provider.IsDomainReloadInProgress(), Is.False);
Assert.That(_domainReloadDetectionService.IsLockFilePresent(), Is.False);
ServerReadinessState state = _stateStore.Read();
Assert.That(state.Phase, Is.EqualTo("failed"));
Assert.That(state.LastError, Is.Not.Empty);
}

private static UnityCliLoopEditorSettingsData CloneSettings(UnityCliLoopEditorSettingsData settings)
Expand Down
5 changes: 1 addition & 4 deletions Assets/Tests/Editor/DomainReloadRecoveryUseCaseTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ public void TearDown()
showPostCompileReconnectingUI = false
});

// Clean up lock file created by ExecuteBeforeDomainReload
_domainReloadDetectionService.DeleteLockFile();
_stateStore.Delete();
}

Expand Down Expand Up @@ -118,7 +116,6 @@ public void CompleteDomainReload_WhenServerWasNotRunning_ShouldPublishStoppedSta

ServerReadinessState state = _stateStore.Read();
Assert.That(state.Phase, Is.EqualTo("stopped"));
Assert.That(_domainReloadDetectionService.IsLockFilePresent(), Is.False);
}

[Test]
Expand Down Expand Up @@ -188,7 +185,7 @@ private sealed class TestServerInstance : IUnityCliLoopServerInstance

public string Endpoint => "test";

public void StartServer(bool clearServerStartingLockWhenReady = true)
public void StartServer()
{
IsRunning = true;
}
Expand Down
1 change: 0 additions & 1 deletion Assets/Tests/Editor/GetLogsUseCaseTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ namespace io.github.hatayama.UnityCliLoop.Tests.Editor
/// <summary>
/// Unit tests for GetLogsUseCase
/// Related classes: GetLogsUseCase, LogRetrievalService, LogFilteringService
/// Design reference: @Packages/docs/ARCHITECTURE_Unity.md - UseCase + Tool Pattern (DDD Integration)
/// Test philosophy: Following Kent Beck's TDD and t-wada's testing principles
/// </summary>
[TestFixture]
Expand Down
24 changes: 0 additions & 24 deletions Assets/Tests/Editor/ServerLifecycleContractTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,6 @@ namespace io.github.hatayama.UnityCliLoop.Tests.Editor
/// </summary>
public class ServerLifecycleContractTests
{
[Test]
// Verifies that the default startup request releases the startup lock after readiness.
public void ReleaseStartupLockWhenReady_ClearsStartupLock_WhenServerReportsReady()
{
ServerInitializationRequest request =
ServerInitializationRequest.ReleaseStartupLockWhenReady();

Assert.That(request.StartupLockReleasePolicy, Is.EqualTo(ServerStartupLockReleasePolicy.ReleaseWhenReady));
Assert.That(request.ClearStartupLockWhenReady, Is.True);
}

[Test]
// Verifies that explicit-release startup requests preserve the startup lock for another owner.
public void PreserveStartupLockUntilExplicitRelease_KeepsStartupLock_ForExplicitRelease()
{
ServerInitializationRequest request =
ServerInitializationRequest.PreserveStartupLockUntilExplicitRelease();

Assert.That(
request.StartupLockReleasePolicy,
Is.EqualTo(ServerStartupLockReleasePolicy.PreserveUntilExplicitRelease));
Assert.That(request.ClearStartupLockWhenReady, Is.False);
}

[Test]
// Verifies that a successful initialization result carries the application-owned server handle.
public void RunningInitializationResult_CarriesServerInstanceAndSuccess()
Expand Down
106 changes: 0 additions & 106 deletions Assets/Tests/Editor/ServerStartingLockServiceTests.cs

This file was deleted.

11 changes: 0 additions & 11 deletions Assets/Tests/Editor/ServerStartingLockServiceTests.cs.meta

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ private sealed class TestServerInstance : IUnityCliLoopServerInstance

public string Endpoint => "test";

public void StartServer(bool clearServerStartingLockWhenReady = true)
public void StartServer()
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,10 @@
namespace io.github.hatayama.UnityCliLoop.Tests.Editor
{
/// <summary>
/// Test fixture that verifies Unity CLI Loop Server Controller Startup Lock behavior.
/// Test fixture that verifies Unity CLI Loop Server Controller recovery behavior.
/// </summary>
public class UnityCliLoopServerControllerStartupLockTests
public class UnityCliLoopServerControllerRecoveryTests
{
[Test]
public void CreateOptionalServerStartingLock_WhenLockCreationSucceeds_ShouldReturnOwnershipToken()
{
// Tests that optional startup locks return the ownership token when creation succeeds.
UnityCliLoopServerControllerService service = CreateControllerService();

string token = service.CreateOptionalServerStartingLock(() => "token-123");

Assert.That(token, Is.EqualTo("token-123"));
}

[Test]
public void CreateOptionalServerStartingLock_WhenLockCreationFails_ShouldContinueWithoutThrowing()
{
// Tests that optional startup locks do not fail server startup when creation fails.
UnityCliLoopServerControllerService service = CreateControllerService();

string token = service.CreateOptionalServerStartingLock(() => null);

Assert.That(token, Is.Null);
}

[Test]
public void ScheduleStartupRecovery_WhenCalled_ExposesRecoveryTaskBeforeDeferredActionRuns()
{
Expand Down Expand Up @@ -106,40 +84,6 @@ public async Task ScheduleStartupRecovery_WhenRecoveryIsAsync_KeepsTaskIncomplet
Assert.That(service.RecoveryTask, Is.Null);
}

[Test]
public async Task StartRecoveryIfNeededAsync_WhenStartupLockExists_ShouldReleaseLockAfterWarmup()
{
// Tests that recovery keeps the startup lock until post-bind warmup has completed.
TestServerInstanceFactory serverInstanceFactory = new();
UnityCliLoopServerLifecycleRegistryService lifecycleRegistry =
new UnityCliLoopServerLifecycleRegistryService();
UnityCliLoopEditorSettingsService editorSettingsService =
UnityCliLoopEditorSettingsTestFactory.CreateService();
ServerReadinessStateStore stateStore = CreateTestStateStore();
UnityCliLoopServerControllerService service = new(
serverInstanceFactory,
lifecycleRegistry,
new DomainReloadDetectionFileService(editorSettingsService, stateStore),
editorSettingsService,
stateStore,
new TestReadinessProbe());
string claimedLockPath = null;
ServerStartingLockService.OnOwnedLockFileClaimedForDeletionForTests = path => claimedLockPath = path;

try
{
await service.StartRecoveryIfNeededAsync(isAfterCompile: true, CancellationToken.None);

Assert.That(serverInstanceFactory.LastCreated.ClearServerStartingLockWhenReady, Is.False);
Assert.That(claimedLockPath, Is.Not.Null);
}
finally
{
ServerStartingLockService.OnOwnedLockFileClaimedForDeletionForTests = null;
ServerStartingLockService.DeleteLockFile();
}
}

[Test]
public async Task StartRecoveryIfNeededAsync_WhenReadinessSucceeds_ShouldPublishReadyState()
{
Expand Down Expand Up @@ -270,13 +214,10 @@ private sealed class TestServerInstance : IUnityCliLoopServerInstance
{
public bool IsRunning { get; private set; }

public bool? ClearServerStartingLockWhenReady { get; private set; }

public string Endpoint => "test";

public void StartServer(bool clearServerStartingLockWhenReady = true)
public void StartServer()
{
ClearServerStartingLockWhenReady = clearServerStartingLockWhenReady;
IsRunning = true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ public void OnBeforeAssemblyReload_ShouldClearStartupProtectionBeforeRecovery()
finally
{
editorSettingsService.SaveSettings(originalSettings);
new DomainReloadDetectionFileService(editorSettingsService).DeleteLockFile();
service.ClearStartupProtection();
}
}
Expand Down Expand Up @@ -139,7 +138,7 @@ private sealed class TestServerInstance : IUnityCliLoopServerInstance

public string Endpoint => "test";

public void StartServer(bool clearServerStartingLockWhenReady = true)
public void StartServer()
{
}

Expand Down
Loading
Loading