diff --git a/build.ps1 b/build.ps1 index 2b028ced90..5e1fe39ba3 100644 --- a/build.ps1 +++ b/build.ps1 @@ -25,7 +25,8 @@ if ($RunTests) dotnet test $csproj_file --environment 'RABBITMQ_LONG_RUNNING_TESTS=true' --no-restore --no-build --logger "console;verbosity=detailed" if ($LASTEXITCODE -ne 0) { - Write-Host "[WARNING] tests errored, exiting" -Foreground "Red" + Write-Host "[ERROR] tests errored, exiting" -Foreground "Red" + Exit 1 } else { diff --git a/projects/Test/Integration/ConnectionRecovery/TestExchangeRecovery.cs b/projects/Test/Integration/ConnectionRecovery/TestExchangeRecovery.cs index e48befa249..21dab6f342 100644 --- a/projects/Test/Integration/ConnectionRecovery/TestExchangeRecovery.cs +++ b/projects/Test/Integration/ConnectionRecovery/TestExchangeRecovery.cs @@ -56,25 +56,29 @@ public async Task TestExchangeRecoveryTest() public async Task TestExchangeToExchangeBindingRecovery() { string q = (await _channel.QueueDeclareAsync("", false, false, false)).QueueName; - string x1 = "amq.fanout"; - string x2 = GenerateExchangeName(); - await _channel.ExchangeDeclareAsync(x2, "fanout"); - await _channel.ExchangeBindAsync(x1, x2, ""); - await _channel.QueueBindAsync(q, x1, ""); + string ex_source = GenerateExchangeName(); + string ex_destination = GenerateExchangeName(); + + await _channel.ExchangeDeclareAsync(ex_source, ExchangeType.Fanout); + await _channel.ExchangeDeclareAsync(ex_destination, ExchangeType.Fanout); + + await _channel.ExchangeBindAsync(destination: ex_destination, source: ex_source, ""); + await _channel.QueueBindAsync(q, ex_destination, ""); try { await CloseAndWaitForRecoveryAsync(); Assert.True(_channel.IsOpen); - await _channel.BasicPublishAsync(x2, "", _encoding.GetBytes("msg")); + await _channel.BasicPublishAsync(ex_source, "", _encoding.GetBytes("msg")); await AssertMessageCountAsync(q, 1); } finally { await WithTemporaryChannelAsync(async ch => { - await ch.ExchangeDeleteAsync(x2); + await ch.ExchangeDeleteAsync(ex_source); + await ch.ExchangeDeleteAsync(ex_destination); await ch.QueueDeleteAsync(q); }); } diff --git a/projects/Test/Integration/ConnectionRecovery/TestRecoveryWithDeletedEntities.cs b/projects/Test/Integration/ConnectionRecovery/TestRecoveryWithDeletedEntities.cs index bb40ae4f37..82f5461b84 100644 --- a/projects/Test/Integration/ConnectionRecovery/TestRecoveryWithDeletedEntities.cs +++ b/projects/Test/Integration/ConnectionRecovery/TestRecoveryWithDeletedEntities.cs @@ -47,26 +47,30 @@ public TestRecoveryWithDeletedEntities(ITestOutputHelper output) : base(output) public async Task TestThatDeletedExchangeBindingsDontReappearOnRecovery() { string q = (await _channel.QueueDeclareAsync("", false, false, false)).QueueName; - string x1 = "amq.fanout"; - string x2 = GenerateExchangeName(); - await _channel.ExchangeDeclareAsync(x2, "fanout"); - await _channel.ExchangeBindAsync(x1, x2, ""); - await _channel.QueueBindAsync(q, x1, ""); - await _channel.ExchangeUnbindAsync(x1, x2, ""); + string ex_source = GenerateExchangeName(); + string ex_destination = GenerateExchangeName(); + + await _channel.ExchangeDeclareAsync(ex_source, ExchangeType.Fanout); + await _channel.ExchangeDeclareAsync(ex_destination, ExchangeType.Fanout); + + await _channel.ExchangeBindAsync(destination: ex_destination, source: ex_source, ""); + await _channel.QueueBindAsync(q, ex_destination, ""); + await _channel.ExchangeUnbindAsync(ex_destination, ex_source, ""); try { await CloseAndWaitForRecoveryAsync(); Assert.True(_channel.IsOpen); - await _channel.BasicPublishAsync(x2, "", _encoding.GetBytes("msg")); + await _channel.BasicPublishAsync(ex_source, "", _encoding.GetBytes("msg")); await AssertMessageCountAsync(q, 0); } finally { await WithTemporaryChannelAsync(async ch => { - await ch.ExchangeDeleteAsync(x2); + await ch.ExchangeDeleteAsync(ex_source); + await ch.ExchangeDeleteAsync(ex_destination); await ch.QueueDeleteAsync(q); }); } diff --git a/projects/Test/Integration/TestExchangeDeclare.cs b/projects/Test/Integration/TestExchangeDeclare.cs index 57d606a91a..41850ac996 100644 --- a/projects/Test/Integration/TestExchangeDeclare.cs +++ b/projects/Test/Integration/TestExchangeDeclare.cs @@ -51,6 +51,10 @@ public async Task TestConcurrentExchangeDeclareAndBind() { var exchangeNames = new ConcurrentBag(); var tasks = new List(); + + string ex_destination = GenerateExchangeName(); + await _channel.ExchangeDeclareAsync(exchange: ex_destination, type: "fanout", false, false); + NotSupportedException nse = null; for (int i = 0; i < 256; i++) { @@ -61,7 +65,7 @@ async Task f() await Task.Delay(S_Random.Next(5, 50)); string exchangeName = GenerateExchangeName(); await _channel.ExchangeDeclareAsync(exchange: exchangeName, type: "fanout", false, false); - await _channel.ExchangeBindAsync(destination: "amq.fanout", source: exchangeName, routingKey: "unused"); + await _channel.ExchangeBindAsync(destination: ex_destination, source: exchangeName, routingKey: "unused"); exchangeNames.Add(exchangeName); } catch (NotSupportedException e) @@ -84,7 +88,7 @@ async Task f() try { await Task.Delay(S_Random.Next(5, 50)); - await _channel.ExchangeUnbindAsync(destination: "amq.fanout", source: exchangeName, routingKey: "unused", + await _channel.ExchangeUnbindAsync(destination: ex_destination, source: exchangeName, routingKey: "unused", noWait: false, arguments: null); await _channel.ExchangeDeleteAsync(exchange: exchangeName, ifUnused: false); } @@ -99,6 +103,7 @@ await _channel.ExchangeUnbindAsync(destination: "amq.fanout", source: exchangeNa await AssertRanToCompletion(tasks); Assert.Null(nse); + await _channel.ExchangeDeleteAsync(exchange: ex_destination); } [Fact]