From 8115eb3c18270049c8d95e7abb21979479be12a8 Mon Sep 17 00:00:00 2001 From: Michal Kuratczyk Date: Mon, 14 Oct 2024 10:50:44 +0200 Subject: [PATCH] Uncomment AMQP application property filter test --- cmd/cmd_test.go | 60 ++++++++++++++++++++++++------------------------- 1 file changed, 29 insertions(+), 31 deletions(-) diff --git a/cmd/cmd_test.go b/cmd/cmd_test.go index 12cd32e..f17e9b1 100644 --- a/cmd/cmd_test.go +++ b/cmd/cmd_test.go @@ -177,37 +177,35 @@ func TestPublishWithPriorities(t *testing.T) { } } -// TODO enable once https://github.com/rabbitmq/rabbitmq-server/pull/12415 is merged -// -// func TestAMQPStreamFilters(t *testing.T) { -// defer metrics.Reset() -// -// rootCmd := RootCmd() -// -// args := []string{"amqp", -// "-C", "6", -// "--publish-to", "/queues/stream-with-filters", -// "--consume-from", "/queues/stream-with-filters", -// "--amqp-app-property", "key1=foo,bar,baz", -// "--amqp-app-property-filter", "key1=$p:ba", -// "--queues", "stream", -// "--cleanup-queues=true", -// "--time", "2s", -// } -// -// rootCmd.SetArgs(args) -// fmt.Println("Running test: omq", strings.Join(args, " ")) -// err := rootCmd.Execute() -// assert.Nil(t, err) -// -// assert.Eventually(t, func() bool { -// return 6 == metrics.MessagesPublished.Get() -// -// }, 2*time.Second, 100*time.Millisecond) -// assert.Eventually(t, func() bool { -// return 4 == metrics.MessagesConsumedNormalPriority.Get() -// }, 2*time.Second, 100*time.Millisecond) -// } +func TestAMQPStreamFilters(t *testing.T) { + defer metrics.Reset() + + rootCmd := RootCmd() + + args := []string{"amqp", + "-C", "6", + "--publish-to", "/queues/stream-with-filters", + "--consume-from", "/queues/stream-with-filters", + "--amqp-app-property", "key1=foo,bar,baz", + "--amqp-app-property-filter", "key1=$p:ba", + "--queues", "stream", + "--cleanup-queues=true", + "--time", "2s", + } + + rootCmd.SetArgs(args) + fmt.Println("Running test: omq", strings.Join(args, " ")) + err := rootCmd.Execute() + assert.Nil(t, err) + + assert.Eventually(t, func() bool { + return 6 == metrics.MessagesPublished.Get() + + }, 2*time.Second, 100*time.Millisecond) + assert.Eventually(t, func() bool { + return 4 == metrics.MessagesConsumedNormalPriority.Get() + }, 2*time.Second, 100*time.Millisecond) +} func TestFanInFromMQTTtoAMQP(t *testing.T) { defer metrics.Reset()