Sha256: 23b6413cd2dfd37e71f1023cb53b25fe2509e089bb1aab7889e88bb5b1f3c5e3
Contents?: true
Size: 950 Bytes
Versions: 3
Compression:
Stored size: 950 Bytes
Contents
require_relative '../test_helper' module Appender class KafkaTest < Minitest::Test describe SemanticLogger::Appender::Kafka do before do @appender = SemanticLogger::Appender::Kafka.new( seed_brokers: ['localhost:9092'] ) @message = 'AppenderKafkaTest log message' end after do @appender&.close end it 'sends log messages in JSON format' do message = nil options = nil ::Kafka::Producer.stub_any_instance(:produce, ->(value, **opts) { message = value; options = opts }) do @appender.info(@message) @appender.flush end h = JSON.parse(message) assert_equal 'info', h['level'] assert_equal @message, h['message'] assert_equal 'SemanticLogger::Appender::Kafka', h['name'] assert_equal $$, h['pid'] assert_equal 'log_messages', options[:topic] end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
semantic_logger-4.3.1 | test/appender/kafka_test.rb |
semantic_logger-4.3.0 | test/appender/kafka_test.rb |
semantic_logger-4.2.2 | test/appender/kafka_test.rb |