diff --git a/src/SecTester.Repeater/Bus/IRepeaterBus.cs b/src/SecTester.Repeater/Bus/IRepeaterBus.cs index cb8113b..53ddda1 100644 --- a/src/SecTester.Repeater/Bus/IRepeaterBus.cs +++ b/src/SecTester.Repeater/Bus/IRepeaterBus.cs @@ -11,5 +11,5 @@ public interface IRepeaterBus : IAsyncDisposable event Action UpgradeAvailable; Task Connect(); - Task Deploy(string? repeaterId, CancellationToken? cancellationToken = null); + Task Deploy(CancellationToken? cancellationToken = null); } diff --git a/src/SecTester.Repeater/Bus/SocketIoRepeaterBus.cs b/src/SecTester.Repeater/Bus/SocketIoRepeaterBus.cs index 7a4d167..d91dd59 100644 --- a/src/SecTester.Repeater/Bus/SocketIoRepeaterBus.cs +++ b/src/SecTester.Repeater/Bus/SocketIoRepeaterBus.cs @@ -90,7 +90,7 @@ public async ValueTask DisposeAsync() GC.SuppressFinalize(this); } - public async Task Deploy(string? repeaterId, CancellationToken? cancellationToken = null) + public async Task Deploy(CancellationToken? cancellationToken = null) { try { @@ -98,10 +98,8 @@ public async Task Deploy(string? repeaterId, CancellationToken? cancella _connection.On("deployed", response => tcs.TrySetResult(response.GetValue())); - var args = string.IsNullOrWhiteSpace(repeaterId) ? Array.Empty() : new object[] { new RepeaterInfo(repeaterId!) }; - await _connection - .EmitAsync("deploy", args) + .EmitAsync("deploy", Array.Empty()) .ConfigureAwait(false); using var _ = cancellationToken?.Register(() => tcs.TrySetCanceled()); diff --git a/src/SecTester.Repeater/Repeater.cs b/src/SecTester.Repeater/Repeater.cs index 8bcbd9e..f3fa84f 100644 --- a/src/SecTester.Repeater/Repeater.cs +++ b/src/SecTester.Repeater/Repeater.cs @@ -58,7 +58,7 @@ public async Task Start(CancellationToken cancellationToken = default) SubscribeToEvents(); await _bus.Connect().ConfigureAwait(false); - RepeaterId = await _bus.Deploy(RepeaterId, cancellationToken).ConfigureAwait(false); + RepeaterId = await _bus.Deploy(cancellationToken).ConfigureAwait(false); Status = RunningStatus.Running; } diff --git a/test/SecTester.Repeater.Tests/Bus/SocketIoRepeaterBusTests.cs b/test/SecTester.Repeater.Tests/Bus/SocketIoRepeaterBusTests.cs index a757883..7825366 100644 --- a/test/SecTester.Repeater.Tests/Bus/SocketIoRepeaterBusTests.cs +++ b/test/SecTester.Repeater.Tests/Bus/SocketIoRepeaterBusTests.cs @@ -161,20 +161,6 @@ public async Task Deploy_Success() await _connection.Received().EmitAsync("deploy", Arg.Is(x => x.Length == 0)); } - [Fact] - public async Task Deploy_GivenRepeaterId_Success() - { - // arrange - _socketIoMessage.GetValue().Returns(new RepeaterInfo(RepeaterId)); - _connection.On("deployed", Arg.Invoke(_socketIoMessage)); - - // act - await _sut.Deploy(RepeaterId); - - // assert - await _connection.Received().EmitAsync("deploy", Arg.Is(x => x.Length == 1 && ((x[0] as RepeaterInfo)!).RepeaterId == RepeaterId)); - } - [Fact] public async Task Deploy_NotReceivingRepeaterId_ThrowsError() { @@ -196,7 +182,7 @@ public async Task Deploy_GivenCancellationToken_ThrowsError() cancellationTokenSource.Cancel(); // act - var act = () => _sut.Deploy(null, cancellationTokenSource.Token); + var act = () => _sut.Deploy(cancellationTokenSource.Token); // assert await act.Should().ThrowAsync(); diff --git a/test/SecTester.Repeater.Tests/RepeaterTests.cs b/test/SecTester.Repeater.Tests/RepeaterTests.cs index cce68f4..6a2708e 100644 --- a/test/SecTester.Repeater.Tests/RepeaterTests.cs +++ b/test/SecTester.Repeater.Tests/RepeaterTests.cs @@ -40,7 +40,7 @@ public void Dispose() public async Task Start_DeploysItself() { // arrange - _bus.Deploy(Arg.Any(), Arg.Any()).Returns(Task.FromResult(Id)); + _bus.Deploy(Arg.Any()).Returns(Task.FromResult(Id)); // act await _sut.Start();