Permalink
Browse files

Set the fake time baseline (for black box testing)

to 1 to avoid tricky edge cases around 0.
  • Loading branch information...
Onsi Fakhouri and Ruth Byers
Onsi Fakhouri and Ruth Byers committed Sep 4, 2013
1 parent 2549375 commit 28f37b5e1deaa7406c6d20e4b45f96fa92e4038d
View
@@ -99,10 +99,6 @@ def start
register_as_vcap_component(message_bus)
@scheduler.start #blocking call
-
- if HealthManager::Config.black_box_test_mode?
- message_bus.publish("healthmanager.ready_for_black_box_testing", {})
- end
end
end
@@ -17,9 +17,7 @@ def initialize(varz, droplet_registry, message_bus)
end
def update(&block)
- logger.log(:info, "Fetching desired state") if HealthManager::Config.black_box_test_mode?
process_next_batch({}, Time.now, &block)
- logger.log(:info, "Done fetching desired state") if HealthManager::Config.black_box_test_mode?
end
def update_user_counts
@@ -136,7 +136,6 @@ def missing_indices
# possibly add other sanity checks here to ensure valid running state,
# e.g. valid version, etc.
].all?
-
(0...num_instances).find_all do |i|
instance = get_instance(i)
instance.missing?
@@ -5,7 +5,7 @@ class FakeScheduler
attr_reader :now
def initialize(message_bus)
- @now = 0
+ @now = 1 #time starts at 1 to avoid weird edge conditions with 0
@single_blocks = []
@periodic_blocks = []
@receipt_counter = 0
@@ -14,7 +14,6 @@ def initialize(message_bus)
message_bus.subscribe('healthmanager.advance_time') do |msg, reply_to|
time = Time.new
advance_time(msg.fetch(:seconds))
- logger.log(:info, "Done Advancing time by #{msg.fetch(:seconds)}s. It took #{Time.new - time} seconds.")
message_bus.publish(reply_to, {:seconds => msg.fetch(:seconds)})
end
end
@@ -23,7 +22,6 @@ def start
end
def advance_time(seconds)
- logger.log(:info, "Advancing time by #{seconds}s")
seconds.times do |_|
@now += 1
check_periodic_blocks
@@ -67,6 +67,7 @@
end
before do
+ manager #load up the config!
app,@desired = make_app
@hb = make_heartbeat_message([app])

0 comments on commit 28f37b5

Please sign in to comment.