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
62 changes: 62 additions & 0 deletions .github/workflows/mqtt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: mqtt

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

env:
config: Release
disable_test_parallelization: true

jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup .NET 8
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.x

- name: Setup .NET 9
uses: actions/setup-dotnet@v1
with:
dotnet-version: 9.0.x

- name: Setup .NET 10
uses: actions/setup-dotnet@v1
with:
dotnet-version: 10.0.x

- name: Start PostgreSQL
run: docker compose up -d postgresql

- name: Wait for PostgreSQL
run: |
echo "Waiting for PostgreSQL to be ready..."
for i in {1..30}; do
if nc -z localhost 5433 > /dev/null 2>&1; then
echo "PostgreSQL is ready"
break
fi
echo "Attempt $i: PostgreSQL not ready yet, waiting..."
sleep 2
done

- name: Build
run: dotnet build src/Transports/MQTT/Wolverine.MQTT.Tests/Wolverine.MQTT.Tests.csproj --configuration ${{ env.config }} --framework net10.0

- name: Test
run: dotnet test src/Transports/MQTT/Wolverine.MQTT.Tests/Wolverine.MQTT.Tests.csproj --configuration ${{ env.config }} --framework net10.0 --no-build --logger "GitHubActions;summary.includePassedTests=true;summary.includeSkippedTests=true"

- name: Stop containers
if: always()
run: docker compose down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="GitHubActionsTestLogger" Version="2.4.1" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
Expand Down
3 changes: 3 additions & 0 deletions src/Transports/MQTT/Wolverine.MQTT.Tests/ack_smoke_tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

namespace Wolverine.MQTT.Tests;

[Collection("acceptance")]
public class ack_smoke_tests : IAsyncLifetime
{
private readonly ITestOutputHelper _output;
Expand Down Expand Up @@ -72,6 +73,8 @@ public async Task DisposeAsync()
{
await _sender.StopAsync();
await _receiver.StopAsync();
await Broker.StopAsync();
await Broker.DisposeAsync();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

namespace Wolverine.MQTT.Tests;

[Collection("acceptance")]
public class broadcast_to_topic_async : IAsyncLifetime
{
private readonly ITestOutputHelper _output;
Expand Down Expand Up @@ -64,6 +65,7 @@ public async Task broadcast()
public async Task DisposeAsync()
{
await Broker.StopAsync();
await Broker.DisposeAsync();
await _sender.StopAsync();
await _receiver.StopAsync();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

namespace Wolverine.MQTT.Tests;

[Collection("acceptance")]
public class broadcast_to_topic_by_user_logic: IAsyncLifetime
{
private readonly ITestOutputHelper _output;
Expand Down Expand Up @@ -58,7 +59,7 @@
[Fact]
public async Task route_by_derived_topics_1()
{
var session = await _sender

Check failure on line 62 in src/Transports/MQTT/Wolverine.MQTT.Tests/broadcast_to_topic_by_user_logic.cs

View workflow job for this annotation

GitHub Actions / test

Wolverine.MQTT.Tests.broadcast_to_topic_by_user_logic.route_by_derived_topics_1

System.TimeoutException : This TrackedSession timed out before all activity completed. Activity detected: ---------------------------------------------------------------------------------------------------------------------------------------------------------- | Service (Node Id) | Message Id | Message Type | Time (ms) | Event | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | sender (d98f5f70-3b85-43be-b8cd-3839189393e3) | 08de66b6-28bf-068f-7ced-8dc083910000 | Wolverine.MQTT.Tests.ColorMessage | 0| Sent | ---------------------------------------------------------------------------------------------------------------------------------------------------------- Conditions: Wait for message of type Wolverine.MQTT.Tests.ColorMessage to be received at node 2e528e37-0e29-42a3-b637-28b6e7cf41ee (False)
.TrackActivity()
.AlsoTrack(_receiver)
.WaitForMessageToBeReceivedAt<ColorMessage>(_receiver)
Expand Down Expand Up @@ -86,6 +87,7 @@
public async Task DisposeAsync()
{
await Broker.StopAsync();
await Broker.DisposeAsync();
await _sender.StopAsync();
await _receiver.StopAsync();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

namespace Wolverine.MQTT.Tests;

[Collection("acceptance")]
public class broadcast_to_topic_rules : IAsyncLifetime
{
private readonly ITestOutputHelper _output;
Expand Down Expand Up @@ -88,6 +89,7 @@ public async Task route_by_derived_topics_2()
public async Task DisposeAsync()
{
await Broker.StopAsync();
await Broker.DisposeAsync();
await _sender.StopAsync();
await _receiver.StopAsync();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,10 @@ await ReceiverIs(opts =>

public LocalMqttBroker Broker { get; private set; }

public async Task DisposeAsync()
public new async Task DisposeAsync()
{
await Broker.StopAsync();
await Broker.DisposeAsync();
await DisposeAsync();
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/Transports/MQTT/Wolverine.MQTT.Tests/connectivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace Wolverine.MQTT.Tests;

[Collection("acceptance")]
public class connectivity
{
private readonly ITestOutputHelper _output;
Expand Down Expand Up @@ -55,7 +56,7 @@ public async Task can_connect_to_a_local_broker()
await managedClient.EnqueueAsync(topic: "Step", payload: "3");


await Task.Delay(1.Minutes());
await Task.Delay(3.Seconds());

// var transport = new MqttTransport();
// transport.Configuration = builder =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,10 @@ await ReceiverIs(opts =>

public LocalMqttBroker Broker { get; private set; }

public async Task DisposeAsync()
public new async Task DisposeAsync()
{
await Broker.StopAsync();
await Broker.DisposeAsync();
await DisposeAsync();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

namespace Wolverine.MQTT.Tests;

[Collection("acceptance")]
public class listen_with_topic_wildcards : IAsyncLifetime
{
private readonly ITestOutputHelper _output;
Expand Down Expand Up @@ -67,6 +68,7 @@ public async Task broadcast()
public async Task DisposeAsync()
{
await Broker.StopAsync();
await Broker.DisposeAsync();
await _sender.StopAsync();
await _receiver.StopAsync();
}
Expand Down
Loading