Added logging to find race condition.
This commit is contained in:
parent
06047e249b
commit
4de56f007f
1 changed files with 34 additions and 20 deletions
|
@ -3,33 +3,30 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class SessionBasicTicketTest < ActiveSupport::TestCase
|
class SessionBasicTicketTest < ActiveSupport::TestCase
|
||||||
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
|
test 'b ticket_overview_index' 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::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)
|
||||||
|
|
Loading…
Reference in a new issue