assert(((expected_message-10)<published_messages)&&(published_messages<(expected_message+10)),"Message size is far from %d bytes (expected: %d, published: %d)"%([@@message_estimate_size,expected_message,published_messages]))
EventMachine.stop
}
}
end
deftest_channel_size
headers={'accept'=>'text/html'}
body='1'
shared_size=@max_reserved_memory.to_i*1024*1024
expected_channel=shared_size/(@@message_estimate_size+body.size+@@channel_estimate_size+4)# 4 channel id size
assert(((expected_channel-10)<created_channels)&&(created_channels<(expected_channel+10)),"Channel size is far from %d bytes (expected: %d, created: %d)"%([@@channel_estimate_size,expected_channel,created_channels]))
assert(((expected_subscriber-10)<created_subscriber)&&(created_subscriber<(expected_subscriber+10)),"Subscriber size is far from %d bytes (expected: %d, created: %d)"%([@@subscriber_estimate_size,expected_subscriber,created_subscriber]))
assert(((@@subscriber_estimate_system_size-100)<per_subscriber)&&(per_subscriber<(@@subscriber_estimate_system_size+100)),"Subscriber system size is far from %d bytes (measured: %d)"%([@@subscriber_estimate_system_size,per_subscriber]))