From dc63771df7dfffffe8c6f7ff1044a93405c5db7e Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Sat, 2 May 2015 10:36:39 +0200 Subject: [PATCH] Improved timing (if ci is under load and tests take more time). --- .../organization_ref_object_touch_test.rb | 12 +++++----- test/unit/ticket_ref_object_touch_test.rb | 22 +++++++++---------- test/unit/user_ref_object_touch_test.rb | 13 +++++------ 3 files changed, 23 insertions(+), 24 deletions(-) diff --git a/test/unit/organization_ref_object_touch_test.rb b/test/unit/organization_ref_object_touch_test.rb index fa845c1d3..4b7727348 100644 --- a/test/unit/organization_ref_object_touch_test.rb +++ b/test/unit/organization_ref_object_touch_test.rb @@ -75,41 +75,41 @@ class OrganizationRefObjectTouchTest < ActiveSupport::TestCase assert_equal( ticket.customer.id, customer1.id ) assert_equal( ticket.organization.id, organization1.id ) - sleep 5 + sleep 6 organization1.name = 'Ref Object Update Org 1/1' organization1.save # check if ticket and customer has been touched ticket = Ticket.find(ticket.id) - if ticket.updated_at > 2.second.ago + if ticket.updated_at > 4.second.ago assert( true, 'ticket.updated_at has been updated' ) else assert( false, 'ticket.updated_at has not been updated' ) end customer1 = User.find(customer1.id) - if customer1.updated_at > 2.second.ago + if customer1.updated_at > 4.second.ago assert( true, 'customer1.updated_at has been updated' ) else assert( false, 'customer1.updated_at has not been updated' ) end - sleep 4 + sleep 6 customer2.organization_id = organization1.id customer2.save # check if customer1 and organization has been touched customer1 = User.find(customer1.id) - if customer1.updated_at > 2.second.ago + if customer1.updated_at > 4.second.ago assert( true, 'customer1.updated_at has been updated' ) else assert( false, 'customer1.updated_at has not been updated' ) end organization1 = Organization.find(organization1.id) - if organization1.updated_at > 2.second.ago + if organization1.updated_at > 4.second.ago assert( true, 'organization1.updated_at has been updated' ) else assert( false, 'organization1.updated_at has not been updated' ) diff --git a/test/unit/ticket_ref_object_touch_test.rb b/test/unit/ticket_ref_object_touch_test.rb index 1da9ec3c8..23af3da11 100644 --- a/test/unit/ticket_ref_object_touch_test.rb +++ b/test/unit/ticket_ref_object_touch_test.rb @@ -71,34 +71,34 @@ class TicketRefObjectTouchTest < ActiveSupport::TestCase # check if customer and organization has been touched customer1 = User.find(customer1.id) - if customer1.updated_at > 2.second.ago + if customer1.updated_at > 4.second.ago assert( true, 'customer1.updated_at has been updated' ) else assert( false, 'customer1.updated_at has not been updated' ) end organization1 = Organization.find(organization1.id) - if organization1.updated_at > 2.second.ago + if organization1.updated_at > 4.second.ago assert( true, 'organization1.updated_at has been updated' ) else assert( false, 'organization1.updated_at has not been updated' ) end - sleep 4 + sleep 6 delete = ticket.destroy assert( delete, 'ticket destroy' ) # check if customer and organization has been touched customer1 = User.find(customer1.id) - if customer1.updated_at > 2.second.ago + if customer1.updated_at > 4.second.ago assert( true, 'customer1.updated_at has been updated' ) else assert( false, 'customer1.updated_at has not been updated' ) end organization1 = Organization.find(organization1.id) - if organization1.updated_at > 2.second.ago + if organization1.updated_at > 4.second.ago assert( true, 'organization1.updated_at has been updated' ) else assert( false, 'organization1.updated_at has not been updated' ) @@ -107,7 +107,7 @@ class TicketRefObjectTouchTest < ActiveSupport::TestCase test 'b - check if customer (not organization) has been updated' do - sleep 3 + sleep 6 ticket = Ticket.create( title: "some title2\n äöüß", group: Group.lookup( name: 'Users'), @@ -124,34 +124,34 @@ class TicketRefObjectTouchTest < ActiveSupport::TestCase # check if customer and organization has been touched customer2 = User.find(customer2.id) - if customer2.updated_at > 2.second.ago + if customer2.updated_at > 4.second.ago assert( true, 'customer2.updated_at has been updated' ) else assert( false, 'customer2.updated_at has not been updated' ) end organization1 = Organization.find(organization1.id) - if organization1.updated_at > 2.second.ago + if organization1.updated_at > 4.second.ago assert( false, 'organization1.updated_at has been updated' ) else assert( true, 'organization1.updated_at has not been updated' ) end - sleep 3 + sleep 6 delete = ticket.destroy assert( delete, 'ticket destroy' ) # check if customer and organization has been touched customer2 = User.find(customer2.id) - if customer2.updated_at > 2.second.ago + if customer2.updated_at > 4.second.ago assert( true, 'customer2.updated_at has been updated' ) else assert( false, 'customer2.updated_at has not been updated' ) end organization1 = Organization.find(organization1.id) - if organization1.updated_at > 2.second.ago + if organization1.updated_at > 4.second.ago assert( false, 'organization1.updated_at has been updated' ) else assert( true, 'organization1.updated_at has not been updated' ) diff --git a/test/unit/user_ref_object_touch_test.rb b/test/unit/user_ref_object_touch_test.rb index 1d61935ea..c97eb380e 100644 --- a/test/unit/user_ref_object_touch_test.rb +++ b/test/unit/user_ref_object_touch_test.rb @@ -69,41 +69,41 @@ class UserRefObjectTouchTest < ActiveSupport::TestCase assert_equal( ticket.customer.id, customer1.id ) assert_equal( ticket.organization.id, organization1.id ) - sleep 5 + sleep 6 customer1.firstname = 'firstname customer1' customer1.save # check if organization has been touched organization1 = Organization.find(organization1.id) - if organization1.updated_at > 2.second.ago + if organization1.updated_at > 4.second.ago assert( true, 'organization1.updated_at has been updated' ) else assert( false, 'organization1.updated_at has not been updated' ) end - sleep 4 + sleep 6 ticket.customer_id = customer2.id ticket.save # check if customer1, customer2 and organization has been touched customer1 = User.find(customer1.id) - if customer1.updated_at > 2.second.ago + if customer1.updated_at > 4.second.ago assert( true, 'customer1.updated_at has been updated' ) else assert( false, 'customer1.updated_at has not been updated' ) end customer2 = User.find(customer2.id) - if customer2.updated_at > 2.second.ago + if customer2.updated_at > 4.second.ago assert( true, 'customer2.updated_at has been updated' ) else assert( false, 'customer2.updated_at has not been updated' ) end organization1 = Organization.find(organization1.id) - if organization1.updated_at > 2.second.ago + if organization1.updated_at > 4.second.ago assert( true, 'organization1.updated_at has been updated' ) else assert( false, 'organization1.updated_at has not been updated' ) @@ -111,6 +111,5 @@ class UserRefObjectTouchTest < ActiveSupport::TestCase delete = ticket.destroy assert( delete, 'ticket destroy' ) - end end