You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by bl...@apache.org on 2022/04/07 13:48:52 UTC

[pulsar-dotpulsar] branch master updated: Add the message sink to see why it's failing with GitHub actions

This is an automated email from the ASF dual-hosted git repository.

blankensteiner pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-dotpulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 57b4669  Add the message sink to see why it's failing with GitHub actions
57b4669 is described below

commit 57b46697a56702b2074976674c61e753f34fb57e
Author: Daniel Blankensteiner <db...@vmail.dk>
AuthorDate: Thu Apr 7 15:48:42 2022 +0200

    Add the message sink to see why it's failing with GitHub actions
---
 .github/workflows/ci-unit.yaml               |  2 +-
 tests/DotPulsar.Tests/DotPulsar.Tests.csproj |  6 ++++++
 tests/DotPulsar.Tests/IntegrationFixture.cs  | 11 +++++++++--
 tests/DotPulsar.Tests/xunit.runner.json      |  4 ++++
 4 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/ci-unit.yaml b/.github/workflows/ci-unit.yaml
index 107f178..bb8ec54 100644
--- a/.github/workflows/ci-unit.yaml
+++ b/.github/workflows/ci-unit.yaml
@@ -35,7 +35,7 @@ jobs:
         uses: actions/checkout@main
 
       - name: Setup dotnet
-        uses: actions/setup-dotnet@v1
+        uses: actions/setup-dotnet@v2
         with:
           dotnet-version: '6.0.x'
 
diff --git a/tests/DotPulsar.Tests/DotPulsar.Tests.csproj b/tests/DotPulsar.Tests/DotPulsar.Tests.csproj
index 3cbead2..8caf66a 100644
--- a/tests/DotPulsar.Tests/DotPulsar.Tests.csproj
+++ b/tests/DotPulsar.Tests/DotPulsar.Tests.csproj
@@ -25,4 +25,10 @@
     <ProjectReference Include="..\..\src\DotPulsar\DotPulsar.csproj" />
   </ItemGroup>
 
+  <ItemGroup>
+    <None Update="xunit.runner.json">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+  </ItemGroup>
+
 </Project>
diff --git a/tests/DotPulsar.Tests/IntegrationFixture.cs b/tests/DotPulsar.Tests/IntegrationFixture.cs
index 54399fa..d9a2ad7 100644
--- a/tests/DotPulsar.Tests/IntegrationFixture.cs
+++ b/tests/DotPulsar.Tests/IntegrationFixture.cs
@@ -21,6 +21,8 @@ using System;
 using System.Threading;
 using System.Threading.Tasks;
 using Xunit;
+using Xunit.Abstractions;
+using Xunit.Sdk;
 
 public class IntegrationFixture : IAsyncLifetime
 {
@@ -29,10 +31,13 @@ public class IntegrationFixture : IAsyncLifetime
     private const string UserName = "test-user";
     private const int Port = 6650;
 
+    private readonly IMessageSink _messageSink;
     private readonly IContainerService _cluster;
 
-    public IntegrationFixture()
+    public IntegrationFixture(IMessageSink messageSink)
     {
+        _messageSink = messageSink;
+
         var environmentVariables = new[]
         {
             $"PULSAR_PREFIX_tokenSecretKey=file://{SecretKeyPath}",
@@ -63,7 +68,7 @@ public class IntegrationFixture : IAsyncLifetime
             .Command("/bin/bash -c", arguments)
             .Build();
 
-        ServiceUrl = new Uri("pulsar:://localhost:6650");
+        ServiceUrl = new Uri("pulsar://localhost:6650");
     }
 
     public Uri ServiceUrl { get; private set; }
@@ -76,9 +81,11 @@ public class IntegrationFixture : IAsyncLifetime
 
     public Task InitializeAsync()
     {
+        _cluster.StateChange += (sender, args) => _messageSink.OnMessage(new DiagnosticMessage($"The Pulsar cluster changed state to: {args.State}"));
         _cluster.Start();
         _cluster.WaitForMessageInLogs("Successfully updated the policies on namespace public/default", int.MaxValue);
         var endpoint = _cluster.ToHostExposedEndpoint($"{Port}/tcp");
+        _messageSink.OnMessage(new DiagnosticMessage($"Endpoint opened at {endpoint}"));
         ServiceUrl = new Uri($"pulsar://localhost:{endpoint.Port}");
         return Task.CompletedTask;
     }
diff --git a/tests/DotPulsar.Tests/xunit.runner.json b/tests/DotPulsar.Tests/xunit.runner.json
new file mode 100644
index 0000000..6c0d1e4
--- /dev/null
+++ b/tests/DotPulsar.Tests/xunit.runner.json
@@ -0,0 +1,4 @@
+{
+  "$schema": "https://xunit.net/schema/current/xunit.runner.schema.json",
+  "diagnosticMessages": true
+}