Browse Source

Fix Unit Tests.

release/3.x.x
Christian 4 years ago
parent
commit
f9c3014e52
2 changed files with 6 additions and 5 deletions
  1. +1
    -1
      Source/MQTTnet/Server/MqttClientConnection.cs
  2. +5
    -4
      Tests/MQTTnet.Core.Tests/Server_Tests.cs

+ 1
- 1
Source/MQTTnet/Server/MqttClientConnection.cs View File

@@ -104,7 +104,7 @@ namespace MQTTnet.Server
}
catch (Exception exception)
{
_logger.Error(exception, "Client '{0}': Error while sending DISCONNECT packet after takeover.", ClientId);
_logger.Warning(exception, "Client '{0}': Error while sending DISCONNECT packet after takeover.", ClientId);
}
}



+ 5
- 4
Tests/MQTTnet.Core.Tests/Server_Tests.cs View File

@@ -304,7 +304,7 @@ namespace MQTTnet.Tests
await c2.PublishAsync(messageBuilder.Build()).ConfigureAwait(false);
}

SpinWait.SpinUntil(() => receivedMessagesCount == 500, 5000);
SpinWait.SpinUntil(() => receivedMessagesCount == 500, TimeSpan.FromSeconds(15));

Assert.AreEqual(500, receivedMessagesCount);
}
@@ -445,7 +445,7 @@ namespace MQTTnet.Tests
await c1.PublishAsync(message).ConfigureAwait(false);
}

SpinWait.SpinUntil(() => receivedMessagesCount == 1000, TimeSpan.FromSeconds(10));
SpinWait.SpinUntil(() => receivedMessagesCount == 1000, TimeSpan.FromSeconds(15));
Assert.AreEqual(1000, receivedMessagesCount);
}
@@ -953,7 +953,8 @@ namespace MQTTnet.Tests

byte[] receivedBody = null;

await testEnvironment.StartServerAsync(new MqttServerOptionsBuilder());
await testEnvironment.StartServerAsync();

var client1 = await testEnvironment.ConnectClientAsync();
client1.UseApplicationMessageReceivedHandler(c =>
{
@@ -965,7 +966,7 @@ namespace MQTTnet.Tests
var client2 = await testEnvironment.ConnectClientAsync();
await client2.PublishAsync("string", longBody);

await Task.Delay(500);
await Task.Delay(TimeSpan.FromSeconds(5));

Assert.IsTrue(longBody.SequenceEqual(receivedBody ?? new byte[0]));
}


Loading…
Cancel
Save