From 4edc5d3018380438351cb6b4058215ebe4d8e5b3 Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Thu, 3 Nov 2011 16:44:01 +0000 Subject: Added test to see us through a clock change. --- test/tc_mauve_alert.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'test/tc_mauve_alert.rb') diff --git a/test/tc_mauve_alert.rb b/test/tc_mauve_alert.rb index a9aef5f..2b8af6f 100644 --- a/test/tc_mauve_alert.rb +++ b/test/tc_mauve_alert.rb @@ -272,4 +272,25 @@ EOF # end + def test_heartbeats_during_clock_change + + updates = YAML.load_file(File.join(File.dirname(__FILE__),"bst_to_gmt.yaml")) + + Timecop.freeze(updates.first[1]-20.minutes) + Configuration.current = ConfigurationBuilder.parse(@test_config) + Server.instance.setup + assert_equal(Time.now, Server.instance.started_at) + + updates.each do |update, received_at, source_ip| + Timecop.freeze(received_at) + Alert.receive_update(update, received_at, source_ip) + alert = Alert.first + assert(alert.cleared?) + alert.poll + assert(alert.cleared?) + assert(0, Server.instance.notification_buffer.length) + end + + end + end -- cgit v1.2.1