Added logging to find race condition.

This commit is contained in:
Martin Edenhofer 2015-05-10 17:43:38 +02:00
parent 06047e249b
commit 4de56f007f

View file

@ -3,6 +3,8 @@
require 'test_helper' require 'test_helper'
class SessionBasicTicketTest < ActiveSupport::TestCase class SessionBasicTicketTest < ActiveSupport::TestCase
test 'b ticket_overview_index' do
UserInfo.current_user_id = 1 UserInfo.current_user_id = 1
# create users # create users
@ -20,16 +22,11 @@ class SessionBasicTicketTest < ActiveSupport::TestCase
groups: groups, 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
agent1.roles = roles agent1.roles = roles
assert( agent1.save, 'create/update agent1' ) assert( agent1.save, 'create/update agent1' )
Ticket.create( title: 'default overview test', group_id: 1, priority_id: 1, state_id: 1, customer_id: 1 )
user = User.lookup( id: agent1.id ) user = User.lookup( id: agent1.id )
client1 = Sessions::Backend::TicketOverviewIndex.new(user, false, '123-1', 5) client1 = Sessions::Backend::TicketOverviewIndex.new(user, false, '123-1', 5)
@ -61,9 +58,26 @@ class SessionBasicTicketTest < ActiveSupport::TestCase
test 'b ticket_overview_list' do test 'b ticket_overview_list' do
UserInfo.current_user_id = 1 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 agent1.roles = roles
assert( agent1.save, 'create/update agent1' ) assert( agent1.save, 'create/update agent1' )
Ticket.create( title: 'default overview test', group_id: 1, priority_id: 1, state_id: 1, customer_id: 1 )
user = User.lookup( id: agent1.id ) user = User.lookup( id: agent1.id )
client1 = Sessions::Backend::TicketOverviewList.new(user, false, '123-1', 5) client1 = Sessions::Backend::TicketOverviewList.new(user, false, '123-1', 5)