Skip to content

Commit 02eda45

Browse files
committed
Add vhost creation
Signed-off-by: Gabriele Santomaggio <[email protected]>
1 parent 4e241b3 commit 02eda45

File tree

5 files changed

+30
-17
lines changed

5 files changed

+30
-17
lines changed

Tests/ConnectionRecoveryTests.cs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,6 @@
1313

1414
namespace Tests;
1515

16-
internal class FakeBackOffDelayPolicyDisabled : IBackOffDelayPolicy
17-
{
18-
public int CurrentAttempt => 1;
19-
public int Delay() => 1;
20-
public bool IsActive() => false;
21-
public void Reset() { }
22-
}
23-
24-
internal class FakeFastBackOffDelay : IBackOffDelayPolicy
25-
{
26-
public int CurrentAttempt => 1;
27-
public int Delay() => 200;
28-
public bool IsActive() => true;
29-
public void Reset() { }
30-
}
31-
3216
public class ConnectionRecoveryTests(ITestOutputHelper testOutputHelper)
3317
: IntegrationTest(testOutputHelper, setupConnectionAndManagement: false)
3418
{

Tests/HttpApiClient.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ public async Task CreateUserAsync(string userName)
3939
await _managementClient.CreatePermissionAsync("/", userName, permissionInfo);
4040
}
4141

42+
public async Task CreateVhostAsync(string vhostName)
43+
{
44+
await _managementClient.CreateVhostAsync(vhostName);
45+
}
46+
4247
public async Task<bool> CheckConnectionAsync(string containerId, bool checkOpened = true)
4348
{
4449
bool rv = true;

Tests/IntegrationTest.Static.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,11 @@ private static string InitRabbitMqHost()
296296
}
297297
}
298298

299+
protected static Task CreateVhostAsync(string vhost)
300+
{
301+
return s_httpApiClient.CreateVhostAsync(vhost);
302+
}
303+
299304
private static bool InitIsRunningInCI()
300305
{
301306
if (bool.TryParse(Environment.GetEnvironmentVariable("CI"), out bool ci))

Tests/TlsConnectionTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.Net.Security;
77
using System.Security.Authentication;
88
using System.Security.Cryptography.X509Certificates;
9+
using System.Threading;
910
using System.Threading.Tasks;
1011
using RabbitMQ.AMQP.Client;
1112
using RabbitMQ.AMQP.Client.Impl;
@@ -47,10 +48,11 @@ public override Task DisposeAsync()
4748
}
4849

4950
[Theory]
51+
[InlineData("/my_tls_host")]
5052
[InlineData("/")]
51-
[InlineData("tls")]
5253
public async Task ConnectUsingTlsAndUserPassword(string virtualHost)
5354
{
55+
await CreateVhostAsync(virtualHost);
5456
ConnectionSettings connectionSettings = _connectionSettingBuilder
5557
.Scheme("amqps")
5658
.Port(_port)

Tests/UtilsTests.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,25 @@
99

1010
namespace Tests;
1111

12+
internal class FakeBackOffDelayPolicyDisabled : IBackOffDelayPolicy
13+
{
14+
public int CurrentAttempt => 1;
15+
public int Delay() => 1;
16+
public bool IsActive() => false;
17+
public void Reset() { }
18+
}
19+
20+
internal class FakeFastBackOffDelay : IBackOffDelayPolicy
21+
{
22+
public int CurrentAttempt => 1;
23+
public int Delay() => 200;
24+
public bool IsActive() => true;
25+
public void Reset() { }
26+
}
27+
1228
public class UtilsTests
1329
{
30+
1431
[Fact]
1532
public void ValidateMessageAnnotationsTest()
1633
{

0 commit comments

Comments
 (0)