spec/rdkafka/config_spec.rb in karafka-rdkafka-0.12.4 vs spec/rdkafka/config_spec.rb in karafka-rdkafka-0.13.0.beta1

- old
+ new

@@ -1,5 +1,7 @@ +# frozen_string_literal: true + require "spec_helper" describe Rdkafka::Config do context "logger" do it "should have a default logger" do @@ -146,14 +148,27 @@ expect { config.producer }.to raise_error(Rdkafka::Config::ConfigError, "No such configuration property: \"invalid.key\"") end + it "allows string partitioner key" do + expect(Rdkafka::Producer).to receive(:new).with(kind_of(Rdkafka::NativeKafka), "murmur2").and_call_original + config = Rdkafka::Config.new("partitioner" => "murmur2") + config.producer.close + end + + it "allows symbol partitioner key" do + expect(Rdkafka::Producer).to receive(:new).with(kind_of(Rdkafka::NativeKafka), "murmur2").and_call_original + config = Rdkafka::Config.new(:partitioner => "murmur2") + config.producer.close + end + it "should allow configuring zstd compression" do config = Rdkafka::Config.new('compression.codec' => 'zstd') begin - expect(config.producer).to be_a Rdkafka::Producer - config.producer.close + producer = config.producer + expect(producer).to be_a Rdkafka::Producer + producer.close rescue Rdkafka::Config::ConfigError => ex pending "Zstd compression not supported on this machine" raise ex end end