Sha256: 688e67c8af4b2caa94b9d6bfe564317103adec3147ee37d4b5f4b3769fba57da
Contents?: true
Size: 1.59 KB
Versions: 4
Compression:
Stored size: 1.59 KB
Contents
module NulogyMessageBusConsumer module Tasks RSpec.describe LogConsumerLag::Calculator do subject(:calculator) { LogConsumerLag::Calculator } describe ".add_max_lag" do it "adds max lag per partition" do lag_per_topic = { topic_1: { partition_1: 100, partition_2: 900, partition_3: 100 }, topic_2: { partition_1: 100, partition_2: 200, partition_3: 100 } } lag_with_max = calculator.add_max_lag(lag_per_topic) expect(lag_with_max).to match( _max: 900, topic_1: { _max: 900, partition_1: 100, partition_2: 900, partition_3: 100 }, topic_2: { _max: 200, partition_1: 100, partition_2: 200, partition_3: 100 } ) end it "sets the max to 0 when no partitions are subscribed to" do lag_per_topic = { topic_1: {} } lag_with_max = calculator.add_max_lag(lag_per_topic) expect(lag_with_max).to match( _max: 0, topic_1: { _max: 0 } ) end it "sets the max to 0 when no topics are subscribed to" do lag_per_topic = {} lag_with_max = calculator.add_max_lag(lag_per_topic) expect(lag_with_max).to match( _max: 0 ) end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems