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 2020/03/28 08:11:54 UTC

[pulsar-dotpulsar] branch master updated (c17043f -> 78bdf26)

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

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


    from c17043f  Revert support for proxies and make ready for 0.8.4
     new 4daf0e9  run stress tests from Docker
     new 78bdf26  fixes to test fixture class

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 docker-compose-standalone-tests.yml                | 17 ++++++
 src/DotPulsar.Stress.Tests/ConsumerTests.cs        |  2 +
 .../DotPulsar.Stress.Tests.csproj                  |  3 +
 .../Fixtures/StandaloneClusterFixture.cs           | 68 ++++++++++++++++++++++
 .../Fixtures/StandaloneClusterTests.cs             | 10 ++++
 5 files changed, 100 insertions(+)
 create mode 100644 docker-compose-standalone-tests.yml
 create mode 100644 src/DotPulsar.Stress.Tests/Fixtures/StandaloneClusterFixture.cs
 create mode 100644 src/DotPulsar.Stress.Tests/Fixtures/StandaloneClusterTests.cs


[pulsar-dotpulsar] 02/02: fixes to test fixture class

Posted by bl...@apache.org.
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

commit 78bdf26887fea2f0b3878b85c291fb5e4851788c
Author: Vince Pergolizzi <pe...@gmail.com>
AuthorDate: Sat Mar 28 03:10:11 2020 -0400

    fixes to test fixture class
---
 .../Fixtures/StandaloneClusterFixture.cs                  | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/src/DotPulsar.Stress.Tests/Fixtures/StandaloneClusterFixture.cs b/src/DotPulsar.Stress.Tests/Fixtures/StandaloneClusterFixture.cs
index 36ff0f1..fff27ed 100644
--- a/src/DotPulsar.Stress.Tests/Fixtures/StandaloneClusterFixture.cs
+++ b/src/DotPulsar.Stress.Tests/Fixtures/StandaloneClusterFixture.cs
@@ -6,7 +6,7 @@ using Xunit;
 
 namespace DotPulsar.Stress.Tests.Fixtures
 {
-    public class StandaloneClusterFixture : IDisposable, IAsyncLifetime
+    public class StandaloneClusterFixture : IAsyncLifetime
     {
         public async Task InitializeAsync()
         {
@@ -16,21 +16,22 @@ namespace DotPulsar.Stress.Tests.Fixtures
             RunProcess("docker-compose", "-f docker-compose-standalone-tests.yml up -d");
 
             int waitTries = 10;
-            var handler = new HttpClientHandler();
+
+            using var handler = new HttpClientHandler();
             handler.AllowAutoRedirect = true;
-            var client = new HttpClient(handler);
+            using var client = new HttpClient(handler);
 
             while (waitTries > 0)
             {
                 try
                 {
-                    await client.GetAsync("http://localhost:8080/metrics/");
+                    await client.GetAsync("http://localhost:8080/metrics/").ConfigureAwait(false);
                     return;
                 }
                 catch (Exception ex)
                 {
                     waitTries--;
-                    await Task.Delay(5000);
+                    await Task.Delay(5000).ConfigureAwait(false);
                 }
             }
 
@@ -39,10 +40,6 @@ namespace DotPulsar.Stress.Tests.Fixtures
 
         public async Task DisposeAsync()
         {
-        }
-
-        public void Dispose()
-        {
             RunProcess("docker-compose", "-f docker-compose-standalone-tests.yml down");
         }
 


[pulsar-dotpulsar] 01/02: run stress tests from Docker

Posted by bl...@apache.org.
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

commit 4daf0e9135aa9f9266091050f305fd0afb5a5ae2
Author: Vince Pergolizzi <pe...@gmail.com>
AuthorDate: Fri Mar 27 06:00:36 2020 -0400

    run stress tests from Docker
---
 docker-compose-standalone-tests.yml                | 17 ++++++
 src/DotPulsar.Stress.Tests/ConsumerTests.cs        |  2 +
 .../DotPulsar.Stress.Tests.csproj                  |  3 +
 .../Fixtures/StandaloneClusterFixture.cs           | 71 ++++++++++++++++++++++
 .../Fixtures/StandaloneClusterTests.cs             | 10 +++
 5 files changed, 103 insertions(+)

diff --git a/docker-compose-standalone-tests.yml b/docker-compose-standalone-tests.yml
new file mode 100644
index 0000000..755301b
--- /dev/null
+++ b/docker-compose-standalone-tests.yml
@@ -0,0 +1,17 @@
+version: '3.5'
+
+services:
+
+  pulsar:
+    container_name: pulsar
+    image: 'apachepulsar/pulsar:2.5.0'
+    ports:
+      - '8080:8080'
+      - '6650:6650'
+    expose:
+      - 8080
+      - 6650
+    environment:
+      PULSAR_MEM: " -Xms1g -Xmx1g -XX:MaxDirectMemorySize=2g"
+    command: |
+      /bin/bash -c "bin/apply-config-from-env.py conf/standalone.conf && bin/pulsar standalone --no-functions-worker"
diff --git a/src/DotPulsar.Stress.Tests/ConsumerTests.cs b/src/DotPulsar.Stress.Tests/ConsumerTests.cs
index 260fe06..0f81a84 100644
--- a/src/DotPulsar.Stress.Tests/ConsumerTests.cs
+++ b/src/DotPulsar.Stress.Tests/ConsumerTests.cs
@@ -20,11 +20,13 @@ using System.Linq;
 using System.Text;
 using System.Threading;
 using System.Threading.Tasks;
+using DotPulsar.Stress.Tests.Fixtures;
 using Xunit;
 using Xunit.Abstractions;
 
 namespace DotPulsar.Stress.Tests
 {
+    [Collection(nameof(StandaloneClusterTest))]
     public class ConsumerTests
     {
         private readonly ITestOutputHelper _output;
diff --git a/src/DotPulsar.Stress.Tests/DotPulsar.Stress.Tests.csproj b/src/DotPulsar.Stress.Tests/DotPulsar.Stress.Tests.csproj
index 77ce962..86f59f6 100644
--- a/src/DotPulsar.Stress.Tests/DotPulsar.Stress.Tests.csproj
+++ b/src/DotPulsar.Stress.Tests/DotPulsar.Stress.Tests.csproj
@@ -23,4 +23,7 @@
     <ProjectReference Include="..\DotPulsar\DotPulsar.csproj" />
   </ItemGroup>
 
+  <ItemGroup>
+    <None Include="..\..\docker-compose-standalone-tests.yml" CopyToOutputDirectory="Always" />
+  </ItemGroup>
 </Project>
diff --git a/src/DotPulsar.Stress.Tests/Fixtures/StandaloneClusterFixture.cs b/src/DotPulsar.Stress.Tests/Fixtures/StandaloneClusterFixture.cs
new file mode 100644
index 0000000..36ff0f1
--- /dev/null
+++ b/src/DotPulsar.Stress.Tests/Fixtures/StandaloneClusterFixture.cs
@@ -0,0 +1,71 @@
+using System;
+using System.Diagnostics;
+using System.Net.Http;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace DotPulsar.Stress.Tests.Fixtures
+{
+    public class StandaloneClusterFixture : IDisposable, IAsyncLifetime
+    {
+        public async Task InitializeAsync()
+        {
+            // clean-up if anything was left running from previous run
+            RunProcess("docker-compose", "-f docker-compose-standalone-tests.yml down");
+            RunProcess("docker-compose", "-f docker-compose-standalone-tests.yml build");
+            RunProcess("docker-compose", "-f docker-compose-standalone-tests.yml up -d");
+
+            int waitTries = 10;
+            var handler = new HttpClientHandler();
+            handler.AllowAutoRedirect = true;
+            var client = new HttpClient(handler);
+
+            while (waitTries > 0)
+            {
+                try
+                {
+                    await client.GetAsync("http://localhost:8080/metrics/");
+                    return;
+                }
+                catch (Exception ex)
+                {
+                    waitTries--;
+                    await Task.Delay(5000);
+                }
+            }
+
+            throw new Exception("Unable to confirm Pulsar has initialized");
+        }
+
+        public async Task DisposeAsync()
+        {
+        }
+
+        public void Dispose()
+        {
+            RunProcess("docker-compose", "-f docker-compose-standalone-tests.yml down");
+        }
+
+        private void RunProcess(string name, string arguments)
+        {
+            var processStartInfo = new ProcessStartInfo()
+            {
+                FileName = name,
+                Arguments = arguments
+            };
+
+            processStartInfo.Environment["TAG"] = "test";
+            processStartInfo.Environment["CONFIGURATION"] = "Debug";
+            processStartInfo.Environment["COMPUTERNAME"] = Environment.MachineName;
+
+            var process = Process.Start(processStartInfo);
+
+            process.WaitForExit();
+
+            if (process.ExitCode != 0)
+            {
+                throw new Exception($"Exit code {process.ExitCode} when running process {name} with arguments {arguments}");
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/DotPulsar.Stress.Tests/Fixtures/StandaloneClusterTests.cs b/src/DotPulsar.Stress.Tests/Fixtures/StandaloneClusterTests.cs
new file mode 100644
index 0000000..0f05954
--- /dev/null
+++ b/src/DotPulsar.Stress.Tests/Fixtures/StandaloneClusterTests.cs
@@ -0,0 +1,10 @@
+using Xunit;
+
+namespace DotPulsar.Stress.Tests.Fixtures
+{
+    [CollectionDefinition(nameof(StandaloneClusterTest))]
+    public class StandaloneClusterTest : ICollectionFixture<StandaloneClusterFixture>
+    {
+
+    }
+}
\ No newline at end of file