Added logging to find race condition.

This commit is contained in:
Martin Edenhofer 2015-05-10 17:24:10 +02:00
parent fbd99e89f3
commit 06047e249b
2 changed files with 26 additions and 31 deletions

View file

@ -497,6 +497,7 @@ returns
# if we do not have it cached, do lookup
if !updated_at
o = select(:updated_at).order(updated_at: :desc).limit(1).first
logger.debug "result latest_change #{o.inspect}"
if o
updated_at = o.updated_at
latest_change_set(updated_at)

View file

@ -3,24 +3,30 @@
require 'test_helper'
class SessionBasicTicketTest < ActiveSupport::TestCase
test 'b ticket_overview_index' do
UserInfo.current_user_id = 1
# create users
roles = Role.where( name: [ 'Agent' ] )
groups = Group.all
agent1 = User.create_or_update(
login: 'session-basic-ticket-agent-1',
firstname: 'Session',
lastname: 'session basic ' + rand(99_999).to_s,
email: 'session-basic-ticket-agent-1@example.com',
password: 'agentpw',
active: true,
roles: roles,
groups: groups,
)
# create ticket
ticket = Ticket.create( title: 'default overview test', group_id: 1, priority_id: 1, state_id: 1, customer_id: 1 )
sleep 6
test 'b ticket_overview_index' do
UserInfo.current_user_id = 1
# create users
roles = Role.where( name: [ 'Agent' ] )
groups = Group.all
agent1 = User.create_or_update(
login: 'session-basic-ticket-agent-1',
firstname: 'Session',
lastname: 'session basic ' + rand(99_999).to_s,
email: 'session-basic-ticket-agent-1@example.com',
password: 'agentpw',
active: true,
roles: roles,
groups: groups,
)
agent1.roles = roles
assert( agent1.save, 'create/update agent1' )
@ -30,7 +36,7 @@ class SessionBasicTicketTest < ActiveSupport::TestCase
# get as stream
result1 = client1.push
if !result1
Rails.logger.debug "FAILD Sessions::Backend::TicketOverviewIndex push"
Rails.logger.error "FAILD Sessions::Backend::TicketOverviewIndex push"
end
assert( result1, 'check ticket_overview_index' )
@ -53,23 +59,8 @@ class SessionBasicTicketTest < ActiveSupport::TestCase
end
test 'b ticket_overview_list' do
UserInfo.current_user_id = 1
# create users
roles = Role.where( name: [ 'Agent' ] )
groups = Group.all
agent1 = User.create_or_update(
login: 'session-basic-ticket-agent-1',
firstname: 'Session',
lastname: 'session basic ' + rand(99_999).to_s,
email: 'session-basic-ticket-agent-1@example.com',
password: 'agentpw',
active: true,
roles: roles,
groups: groups,
)
agent1.roles = roles
assert( agent1.save, 'create/update agent1' )
@ -79,6 +70,9 @@ class SessionBasicTicketTest < ActiveSupport::TestCase
# get as stream
result1 = client1.push
if !result1
Rails.logger.error "FAILD Sessions::Backend::TicketOverviewList push"
end
assert( result1, 'check ticket_overview_list' )
# next check should be empty / no changes