Skip to content

Commit 823d6ff

Browse files
committed
comment test
Signed-off-by: Gabriele Santomaggio <[email protected]>
2 parents 0f7f53f + 48e8a72 commit 823d6ff

File tree

8 files changed

+32
-15
lines changed

8 files changed

+32
-15
lines changed

.ci/ubuntu/cluster/rmq/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ COPY --chown=rabbitmq:rabbitmq --chmod=0644 enabled_plugins /etc/rabbitmq/enable
1212
COPY --chown=rabbitmq:rabbitmq rabbitmq-env.conf /etc/rabbitmq/rabbitmq-env.conf
1313
COPY --chown=rabbitmq:rabbitmq rabbitmq.conf /etc/rabbitmq/rabbitmq.conf
1414
COPY --chown=rabbitmq:rabbitmq advanced.config /etc/rabbitmq/advanced.config
15+
COPY --chown=rabbitmq:rabbitmq 21-enable-management-collector.conf /etc/rabbitmq/conf.d/21-enable-management-collector.conf
1516

1617
EXPOSE 4369 5671 5672 15672 15692 25672 35672-35682

.ci/ubuntu/one-node/gha-setup.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ function start_rabbitmq
9090
--volume "$GITHUB_WORKSPACE/.ci/ubuntu/one-node/rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf:ro" \
9191
--volume "$GITHUB_WORKSPACE/.ci/certs:/etc/rabbitmq/certs:ro" \
9292
--volume "$GITHUB_WORKSPACE/.ci/ubuntu/one-node/advanced.config:/etc/rabbitmq/advanced.config:ro" \
93+
--volume "$GITHUB_WORKSPACE/.ci/ubuntu/one-node/21-enable-management-collector.conf:/etc/rabbitmq/conf.d/21-enable-management-collector.conf:ro" \
9394
--volume "$GITHUB_WORKSPACE/.ci/ubuntu/log:/var/log/rabbitmq" \
9495
"$rabbitmq_image"
9596
}

RabbitMQ.AMQP.Client/Consts.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public static class Consts
2828
private const string AmqpSqlFilter = "amqp:sql-filter";
2929
internal static readonly Symbol s_streamSqlFilterSymbol = new(AmqpSqlFilter);
3030
internal const string SqlFilter = "sql-filter";
31+
internal static readonly Symbol s_sqlFilterSymbol = new(SqlFilter);
3132

3233
internal const string AmqpPropertiesFilter = "amqp:properties-filter";
3334
internal const string AmqpApplicationPropertiesFilter = "amqp:application-properties-filter";

RabbitMQ.AMQP.Client/Impl/AmqpConsumer.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@ void OnAttached(ILink argLink, Attach argAttach)
8888

8989
// TODO configurable timeout
9090
var waitSpan = TimeSpan.FromSeconds(5);
91+
92+
// TODO
93+
// Even 10ms is enough to allow the links to establish,
94+
// which tells me it allows the .NET runtime to process
95+
await Task.Delay(10).ConfigureAwait(false);
96+
9197
_receiverLink = await attachCompletedTcs.Task.WaitAsync(waitSpan)
9298
.ConfigureAwait(false);
9399

RabbitMQ.AMQP.Client/Impl/AmqpConsumerBuilder.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public async Task<IConsumer> BuildAndStartAsync(CancellationToken cancellationTo
8686
throw new ConsumerException("Message handler is not set");
8787
}
8888

89-
if (_configuration.Filters[Consts.SqlFilter] is not null &&
89+
if (_configuration.Filters[Consts.s_sqlFilterSymbol] is not null &&
9090
_amqpConnection._featureFlags.IsSqlFeatureEnabled == false)
9191
{
9292
throw new ConsumerException("SQL filter is not supported by the connection." +
@@ -254,7 +254,7 @@ public IConsumerBuilder.IStreamFilterOptions Sql(string sql)
254254
throw new ArgumentNullException(nameof(sql));
255255
}
256256

257-
_filters[Consts.SqlFilter] =
257+
_filters[Consts.s_sqlFilterSymbol] =
258258
new DescribedValue(Consts.s_streamSqlFilterSymbol, sql);
259259
return this;
260260
}

RabbitMQ.AMQP.Client/Impl/AmqpPublisher.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ void OnAttached(ILink argLink, Attach argAttach)
6767

6868
// TODO configurable timeout
6969
var waitSpan = TimeSpan.FromSeconds(5);
70+
// TODO
71+
// Even 10ms is enough to allow the links to establish,
72+
// which tells me it allows the .NET runtime to process
73+
await Task.Delay(10)
74+
.ConfigureAwait(false);
75+
7076
_senderLink = await attachCompletedTcs.Task.WaitAsync(waitSpan)
7177
.ConfigureAwait(false);
7278

Tests/Consumer/ConsumerSqlFilterTests.cs

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class ConsumerSqlFilterTests(ITestOutputHelper testOutputHelper) : Integr
2121
// Example test method (to be implemented):
2222
[SkippableFact]
2323
[Trait("Category", "SqlFilter")]
24-
public async Task TestSqlFilterFunctionality()
24+
public async Task TestSqlFilterFunctionalityAsync()
2525
{
2626
Assert.NotNull(_connection);
2727
Assert.NotNull(_management);
@@ -37,7 +37,7 @@ public async Task TestSqlFilterFunctionality()
3737
new TaskCompletionSource<IMessage>(TaskCreationOptions.RunContinuationsAsynchronously);
3838
IConsumer consumer = await _connection.ConsumerBuilder()
3939
.Queue(_queueName)
40-
.Stream().Filter().Sql("properties.user_id = 'John'").Stream().Offset(StreamOffsetSpecification.First)
40+
.Stream().Filter().Sql("properties.subject LIKE '%John%'").Stream().Offset(StreamOffsetSpecification.First)
4141
.Builder().MessageHandler((IContext ctx, IMessage msg) =>
4242
{
4343
tcs.SetResult(msg);
@@ -49,20 +49,22 @@ public async Task TestSqlFilterFunctionality()
4949

5050
IPublisher publisher = await _connection.PublisherBuilder().Queue(_queueName).BuildAsync();
5151

52-
var msgNotInTheFilter = new AmqpMessage("Test message for SQL filter")
53-
.Property("user_id", "Gas"); // This property should not match the SQL filter
52+
// var msgNotInTheFilter = new AmqpMessage("Test message for SQL filter")
53+
// .Property("user_id", "Gas"); // This property should not match the SQL filter
54+
var msgNotInTheFilter = new AmqpMessage("Test message for SQL filter, should not match")
55+
.Subject("Gas"); // This property should not match the SQL filter
5456
await publisher.PublishAsync(msgNotInTheFilter);
55-
var msgInTheFilter = new AmqpMessage("Test message for NOT SQL filter")
56-
.Property("user_id", "John"); // This property should match the SQL filter
57+
var msgInTheFilter = new AmqpMessage("Test message for SQL filter")
58+
.Subject("John"); // This property should match the SQL filter
5759
await publisher.PublishAsync(msgInTheFilter);
58-
await tcs.Task.WaitAsync(TimeSpan.FromSeconds(10)).ConfigureAwait(false);
60+
await tcs.Task.WaitAsync(TimeSpan.FromSeconds(10));
5961

6062
Assert.Equal("Test message for SQL filter", tcs.Task.Result.BodyAsString());
61-
Assert.Equal("John", tcs.Task.Result.Property("user_id"));
62-
await consumer.CloseAsync().ConfigureAwait(false);
63-
await publisher.CloseAsync().ConfigureAwait(false);
64-
await q.DeleteAsync().ConfigureAwait(false);
65-
await _connection.CloseAsync().ConfigureAwait(false);
63+
Assert.Equal("John", tcs.Task.Result.Subject());
64+
await consumer.CloseAsync();
65+
await publisher.CloseAsync();
66+
await q.DeleteAsync();
67+
await _connection.CloseAsync();
6668
}
6769
}
6870
}

Tests/Management/ManagementTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,6 @@ public async Task PurgeQueueShouldReturnErrorForStream()
454454
await queueSpec.DeclareAsync();
455455
await PublishAsync(queueSpec, 19);
456456
await WaitUntilQueueMessageCount(_queueName, 19);
457-
await Assert.ThrowsAsync<BadRequestException>(() => queueSpec.PurgeAsync());
457+
await Assert.ThrowsAsync<BadRequestException>(queueSpec.PurgeAsync);
458458
}
459459
}

0 commit comments

Comments
 (0)