Small testing improvements.

This commit is contained in:
Martin Edenhofer 2015-02-25 22:35:37 +01:00
parent 52c8410f50
commit b625a6563a
5 changed files with 19 additions and 20 deletions

View file

@ -33,8 +33,7 @@ class Sessions::Backend::TicketOverviewIndex
def push def push
# check check interval # check check interval
timeout = Sessions::CacheIn.get( self.client_key ) return if Sessions::CacheIn.get( self.client_key )
return if timeout
# reset check interval # reset check interval
Sessions::CacheIn.set( self.client_key, true, { :expires_in => 5.seconds } ) Sessions::CacheIn.set( self.client_key, true, { :expires_in => 5.seconds } )

View file

@ -43,8 +43,7 @@ class Sessions::Backend::TicketOverviewList
def push def push
# check interval # check interval
timeout = Sessions::CacheIn.get( self.client_key ) return if Sessions::CacheIn.get( self.client_key )
return if timeout
# reset check interval # reset check interval
Sessions::CacheIn.set( self.client_key, true, { :expires_in => 6.seconds } ) Sessions::CacheIn.set( self.client_key, true, { :expires_in => 6.seconds } )

View file

@ -28,12 +28,13 @@ class ActiveSupport::TestCase
setup do setup do
# clear cache
Cache.clear
# set current user # set current user
puts 'reset UserInfo.current_user_id' puts 'reset UserInfo.current_user_id'
UserInfo.current_user_id = nil UserInfo.current_user_id = nil
end end
# Add more helper methods to be used by all tests here... # Add more helper methods to be used by all tests here...
end end

View file

@ -71,7 +71,7 @@ class SessionBasicTest < ActiveSupport::TestCase
# change collection # change collection
group = Group.first group = Group.first
group.touch group.touch
sleep 16 sleep 12
# get whole collections # get whole collections
result1 = collection_client1.push result1 = collection_client1.push
@ -102,7 +102,7 @@ class SessionBasicTest < ActiveSupport::TestCase
assert_equal( result1, result2, "check collections" ) assert_equal( result1, result2, "check collections" )
# check again after create # check again after create
sleep 14 sleep 12
result1 = collection_client1.push result1 = collection_client1.push
assert( !result1, "check collections - after create - recall" ) assert( !result1, "check collections - after create - recall" )
sleep 1 sleep 1
@ -112,7 +112,7 @@ class SessionBasicTest < ActiveSupport::TestCase
# change collection # change collection
group.destroy group.destroy
sleep 14 sleep 12
# get whole collections # get whole collections
result1 = collection_client1.push result1 = collection_client1.push
@ -163,7 +163,7 @@ class SessionBasicTest < ActiveSupport::TestCase
# change collection # change collection
org = Organization.create( :name => 'SomeOrg2::' + rand(999999).to_s, :active => true ) org = Organization.create( :name => 'SomeOrg2::' + rand(999999).to_s, :active => true )
sleep 16 sleep 12
# get whole collections # get whole collections
result1 = collection_client1.push result1 = collection_client1.push
@ -173,7 +173,7 @@ class SessionBasicTest < ActiveSupport::TestCase
assert( !result2.empty?, "check collections - after create" ) assert( !result2.empty?, "check collections - after create" )
assert_equal( result1, result2, "check collections" ) assert_equal( result1, result2, "check collections" )
sleep 16 sleep 12
# next check should be empty # next check should be empty
result1 = collection_client1.push result1 = collection_client1.push
@ -183,7 +183,7 @@ class SessionBasicTest < ActiveSupport::TestCase
organization = Organization.first organization = Organization.first
organization.touch organization.touch
sleep 16 sleep 12
# get whole collections # get whole collections
result1 = collection_client1.push result1 = collection_client1.push
@ -241,14 +241,14 @@ class SessionBasicTest < ActiveSupport::TestCase
assert( !result1, "check as agent1 - recall" ) assert( !result1, "check as agent1 - recall" )
# next check should be empty # next check should be empty
sleep 60 sleep 31
result1 = as_client1.push result1 = as_client1.push
assert( !result1, "check as agent1 - recall 2" ) assert( !result1, "check as agent1 - recall 2" )
agent1.update_attribute( :email, 'activity-stream-agent11@example.com' ) agent1.update_attribute( :email, 'activity-stream-agent11@example.com' )
ticket = Ticket.create(:title => '12323', :group_id => 1, :priority_id => 1, :state_id => 1, :customer_id => 1 ) ticket = Ticket.create(:title => '12323', :group_id => 1, :priority_id => 1, :state_id => 1, :customer_id => 1 )
sleep 32 sleep 31
# get as stream # get as stream
result1 = as_client1.push result1 = as_client1.push
@ -271,7 +271,7 @@ class SessionBasicTest < ActiveSupport::TestCase
assert( !result1, "check ticket_create - recall" ) assert( !result1, "check ticket_create - recall" )
# next check should be empty # next check should be empty
sleep 10 sleep 2
result1 = ticket_create_client1.push result1 = ticket_create_client1.push
assert( !result1, "check ticket_create - recall 2" ) assert( !result1, "check ticket_create - recall 2" )

View file

@ -36,13 +36,13 @@ class SessionBasicTicketTest < ActiveSupport::TestCase
assert( !result1, "check ticket_overview_index - recall" ) assert( !result1, "check ticket_overview_index - recall" )
# next check should be empty # next check should be empty
sleep 10 sleep 8
result1 = client1.push result1 = client1.push
assert( !result1, "check ticket_overview_index - recall 2" ) assert( !result1, "check ticket_overview_index - recall 2" )
ticket = Ticket.create( :title => '12323', :group_id => 1, :priority_id => 1, :state_id => 1, :customer_id => 1 ) ticket = Ticket.create( :title => '12323', :group_id => 1, :priority_id => 1, :state_id => 1, :customer_id => 1 )
sleep 10 sleep 8
# get as stream # get as stream
result1 = client1.push result1 = client1.push
@ -84,13 +84,13 @@ class SessionBasicTicketTest < ActiveSupport::TestCase
assert( !result1, "check ticket_overview_list - recall" ) assert( !result1, "check ticket_overview_list - recall" )
# next check should be empty # next check should be empty
sleep 10 sleep 8
result1 = client1.push result1 = client1.push
assert( !result1, "check ticket_overview_list - recall 2" ) assert( !result1, "check ticket_overview_list - recall 2" )
ticket = Ticket.create( :title => '12323', :group_id => 1, :priority_id => 1, :state_id => 1, :customer_id => 1 ) ticket = Ticket.create( :title => '12323', :group_id => 1, :priority_id => 1, :state_id => 1, :customer_id => 1 )
sleep 10 sleep 8
# get as stream # get as stream
result1 = client1.push result1 = client1.push