mirror of
				https://github.com/Telecominfraproject/wlan-cloud-lib-cppkafka.git
				synced 2025-11-04 04:27:48 +00:00 
			
		
		
		
	Add dumb test that extracts event from queue
This commit is contained in:
		@@ -241,3 +241,18 @@ TEST_CASE("consume batch", "[consumer]") {
 | 
				
			|||||||
    CHECK(all_messages[0].get_payload() == payload);
 | 
					    CHECK(all_messages[0].get_payload() == payload);
 | 
				
			||||||
    CHECK(all_messages[1].get_payload() == payload);
 | 
					    CHECK(all_messages[1].get_payload() == payload);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					TEST_CASE("Event consumption", "[consumer]") {
 | 
				
			||||||
 | 
					    // Create a consumer and subscribe to the topic
 | 
				
			||||||
 | 
					    Consumer consumer(make_consumer_config());
 | 
				
			||||||
 | 
					    consumer.subscribe({ KAFKA_TOPICS[0] });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    vector<rd_kafka_event_type_t> types = {
 | 
				
			||||||
 | 
					        RD_KAFKA_EVENT_NONE
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					    Queue queue = consumer.get_main_queue();
 | 
				
			||||||
 | 
					    for (const auto type : types) {
 | 
				
			||||||
 | 
					        const Event event = queue.next_event();
 | 
				
			||||||
 | 
					        CHECK(event.get_type() == type);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user