Skip to content

Commit 30a4f0b

Browse files
committed
Ensure tests that interact with RabbitMQ do not run in parallel
Since there are tests that restart RabbitMQ, every test that could interact with RMQ must have this attribute on the class: [Collection("IntegrationFixture")] We would get random CI failures due to some tests executing that were not part of this collection.
1 parent a43318d commit 30a4f0b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+71
-111
lines changed

projects/Unit/TestAmqpTcpEndpointParsing.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,10 @@
3030
//---------------------------------------------------------------------------
3131

3232
using System;
33-
3433
using Xunit;
3534

3635
namespace RabbitMQ.Client.Unit
3736
{
38-
3937
public class TestAmqpTcpEndpointParsing
4038
{
4139
[Fact]

projects/Unit/TestAmqpUri.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
//---------------------------------------------------------------------------
3131

3232
using System;
33-
3433
using Xunit;
3534

3635
namespace RabbitMQ.Client.Unit

projects/Unit/TestAsyncConsumer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@
3434
using System.Text;
3535
using System.Threading;
3636
using System.Threading.Tasks;
37-
3837
using RabbitMQ.Client.Events;
3938
using Xunit;
4039
using Xunit.Abstractions;
4140

4241
namespace RabbitMQ.Client.Unit
4342
{
43+
[Collection("IntegrationFixture")]
4444
public class TestAsyncConsumer
4545
{
4646
private readonly ITestOutputHelper _output;

projects/Unit/TestAsyncConsumerExceptions.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@
3232
using System;
3333
using System.Threading;
3434
using System.Threading.Tasks;
35-
3635
using RabbitMQ.Client.Events;
37-
3836
using Xunit;
3937
using Xunit.Abstractions;
4038

projects/Unit/TestAuth.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,13 @@
3030
//---------------------------------------------------------------------------
3131

3232
using RabbitMQ.Client.Exceptions;
33-
3433
using Xunit;
3534

3635
namespace RabbitMQ.Client.Unit
3736
{
38-
37+
[Collection("IntegrationFixture")]
3938
public class TestAuth
4039
{
41-
4240
[Fact]
4341
public void TestAuthFailure()
4442
{
@@ -60,4 +58,3 @@ public void TestAuthFailure()
6058
}
6159
}
6260
}
63-

projects/Unit/TestBasicGet.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
//---------------------------------------------------------------------------
3131

3232
using RabbitMQ.Client.Exceptions;
33-
3433
using Xunit;
3534
using Xunit.Abstractions;
3635

projects/Unit/TestBasicProperties.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@
3434
using System.Text;
3535
using System.Threading;
3636
using System.Threading.Tasks;
37-
3837
using RabbitMQ.Client.Events;
39-
4038
using Xunit;
4139

4240
namespace RabbitMQ.Client.Unit

projects/Unit/TestBasicPublish.cs

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,45 @@
1+
// This source code is dual-licensed under the Apache License, version
2+
// 2.0, and the Mozilla Public License, version 2.0.
3+
//
4+
// The APL v2.0:
5+
//
6+
//---------------------------------------------------------------------------
7+
// Copyright (c) 2007-2020 VMware, Inc.
8+
//
9+
// Licensed under the Apache License, Version 2.0 (the "License");
10+
// you may not use this file except in compliance with the License.
11+
// You may obtain a copy of the License at
12+
//
13+
// https://www.apache.org/licenses/LICENSE-2.0
14+
//
15+
// Unless required by applicable law or agreed to in writing, software
16+
// distributed under the License is distributed on an "AS IS" BASIS,
17+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+
// See the License for the specific language governing permissions and
19+
// limitations under the License.
20+
//---------------------------------------------------------------------------
21+
//
22+
// The MPL v2.0:
23+
//
24+
//---------------------------------------------------------------------------
25+
// This Source Code Form is subject to the terms of the Mozilla Public
26+
// License, v. 2.0. If a copy of the MPL was not distributed with this
27+
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
28+
//
29+
// Copyright (c) 2011-2020 VMware, Inc. or its affiliates. All rights reserved.
30+
//---------------------------------------------------------------------------
31+
132
using System;
233
using System.Text;
334
using System.Threading;
435
using System.Threading.Tasks;
5-
636
using RabbitMQ.Client.Events;
737
using Xunit;
838
using Xunit.Sdk;
939

1040
namespace RabbitMQ.Client.Unit
1141
{
42+
[Collection("IntegrationFixture")]
1243
public class TestBasicPublish
1344
{
1445
[Fact]

projects/Unit/TestBlockingCell.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@
3131

3232
using System;
3333
using System.Threading;
34-
3534
using RabbitMQ.Util;
36-
3735
using Xunit;
3836

3937
namespace RabbitMQ.Client.Unit

projects/Unit/TestChannelAllocation.cs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,13 @@
3131

3232
using System;
3333
using System.Collections.Generic;
34-
3534
using RabbitMQ.Client.Impl;
36-
3735
using Xunit;
3836

3937
namespace RabbitMQ.Client.Unit
4038
{
41-
public class TestIChannelAllocation : IDisposable
39+
[Collection("IntegrationFixture")]
40+
public class TestChannelAllocation : IDisposable
4241
{
4342
public const int CHANNEL_COUNT = 100;
4443

@@ -49,15 +48,13 @@ public int ChannelNumber(IChannel channel)
4948
return ((AutorecoveringChannel)channel).ChannelNumber;
5049
}
5150

52-
public TestIChannelAllocation()
51+
public TestChannelAllocation()
5352
{
5453
_c = new ConnectionFactory().CreateConnection();
55-
5654
}
5755

5856
public void Dispose() => _c.Close();
5957

60-
6158
[Fact]
6259
public void AllocateInOrder()
6360
{
@@ -108,6 +105,5 @@ public void AllocateAfterFreeingMany()
108105
foreach (IChannel channel in channels)
109106
Assert.Equal(k++, ChannelNumber(channel));
110107
}
111-
112108
}
113109
}

0 commit comments

Comments
 (0)