spec/logstash/outputs/scalyr_spec.rb in logstash-output-scalyr-0.1.9 vs spec/logstash/outputs/scalyr_spec.rb in logstash-output-scalyr-0.1.10.beta
- old
+ new
@@ -76,10 +76,11 @@
'flatten_nested_values' => false,
})
mock_client_session = MockClientSession.new
plugin1.instance_variable_set(:@last_status_transmit_time, 100)
plugin1.instance_variable_set(:@client_session, mock_client_session)
+ plugin1.instance_variable_set(:@session_id, "some_session_id")
plugin1.instance_variable_set(:@plugin_metrics, {
:multi_receive_duration_secs => Quantile::Estimator.new,
:multi_receive_event_count => Quantile::Estimator.new,
:event_attributes_count => Quantile::Estimator.new,
:flatten_values_duration_secs => Quantile::Estimator.new
@@ -93,10 +94,11 @@
it "returns and sends correct status event on send_stats on initial and subsequent send" do
# 1. Initial send
plugin.instance_variable_set(:@last_status_transmit_time, nil)
plugin.instance_variable_set(:@client_session, mock_client_session)
+ plugin.instance_variable_set(:@session_id, "some_session_id")
status_event = plugin.send_status
expect(status_event[:attrs]["message"]).to eq("Started Scalyr LogStash output plugin.")
# 2. Second send
plugin.instance_variable_set(:@last_status_transmit_time, 100)
@@ -136,9 +138,10 @@
# Kind of a weak test but I don't see a decent way to write a stronger one without a live client session
it "send_status only sends posts with is_status = true" do
# 1. Initial send
plugin.instance_variable_set(:@last_status_transmit_time, nil)
plugin.instance_variable_set(:@client_session, mock_client_session)
+ plugin.instance_variable_set(:@session_id, "some_session_id")
expect(mock_client_session).to receive(:post_add_events).with(anything, true, anything)
plugin.send_status
# 2. Second send
plugin.instance_variable_set(:@last_status_transmit_time, 100)