Browse Source

Improved timing (if ci is under load and tests take more time).

Martin Edenhofer 10 years ago
parent
commit
dc63771df7

+ 6 - 6
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.customer.id, customer1.id  )
     assert_equal( ticket.organization.id, organization1.id  )
     assert_equal( ticket.organization.id, organization1.id  )
 
 
-    sleep 5
+    sleep 6
 
 
     organization1.name = 'Ref Object Update Org 1/1'
     organization1.name = 'Ref Object Update Org 1/1'
     organization1.save
     organization1.save
 
 
     # check if ticket and customer has been touched
     # check if ticket and customer has been touched
     ticket = Ticket.find(ticket.id)
     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' )
       assert( true, 'ticket.updated_at has been updated' )
     else
     else
       assert( false, 'ticket.updated_at has not been updated' )
       assert( false, 'ticket.updated_at has not been updated' )
     end
     end
 
 
     customer1 = User.find(customer1.id)
     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' )
       assert( true, 'customer1.updated_at has been updated' )
     else
     else
       assert( false, 'customer1.updated_at has not been updated' )
       assert( false, 'customer1.updated_at has not been updated' )
     end
     end
 
 
-    sleep 4
+    sleep 6
 
 
     customer2.organization_id = organization1.id
     customer2.organization_id = organization1.id
     customer2.save
     customer2.save
 
 
     # check if customer1 and organization has been touched
     # check if customer1 and organization has been touched
     customer1 = User.find(customer1.id)
     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' )
       assert( true, 'customer1.updated_at has been updated' )
     else
     else
       assert( false, 'customer1.updated_at has not been updated' )
       assert( false, 'customer1.updated_at has not been updated' )
     end
     end
 
 
     organization1 = Organization.find(organization1.id)
     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' )
       assert( true, 'organization1.updated_at has been updated' )
     else
     else
       assert( false, 'organization1.updated_at has not been updated' )
       assert( false, 'organization1.updated_at has not been updated' )

+ 11 - 11
test/unit/ticket_ref_object_touch_test.rb

@@ -71,34 +71,34 @@ class TicketRefObjectTouchTest < ActiveSupport::TestCase
 
 
     # check if customer and organization has been touched
     # check if customer and organization has been touched
     customer1 = User.find(customer1.id)
     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' )
       assert( true, 'customer1.updated_at has been updated' )
     else
     else
       assert( false, 'customer1.updated_at has not been updated' )
       assert( false, 'customer1.updated_at has not been updated' )
     end
     end
 
 
     organization1 = Organization.find(organization1.id)
     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' )
       assert( true, 'organization1.updated_at has been updated' )
     else
     else
       assert( false, 'organization1.updated_at has not been updated' )
       assert( false, 'organization1.updated_at has not been updated' )
     end
     end
 
 
-    sleep 4
+    sleep 6
 
 
     delete = ticket.destroy
     delete = ticket.destroy
     assert( delete, 'ticket destroy' )
     assert( delete, 'ticket destroy' )
 
 
     # check if customer and organization has been touched
     # check if customer and organization has been touched
     customer1 = User.find(customer1.id)
     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' )
       assert( true, 'customer1.updated_at has been updated' )
     else
     else
       assert( false, 'customer1.updated_at has not been updated' )
       assert( false, 'customer1.updated_at has not been updated' )
     end
     end
 
 
     organization1 = Organization.find(organization1.id)
     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' )
       assert( true, 'organization1.updated_at has been updated' )
     else
     else
       assert( false, 'organization1.updated_at has not been updated' )
       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
   test 'b - check if customer (not organization) has been updated' do
 
 
-    sleep 3
+    sleep 6
     ticket = Ticket.create(
     ticket = Ticket.create(
       title: "some title2\n äöüß",
       title: "some title2\n äöüß",
       group: Group.lookup( name: 'Users'),
       group: Group.lookup( name: 'Users'),
@@ -124,34 +124,34 @@ class TicketRefObjectTouchTest < ActiveSupport::TestCase
 
 
     # check if customer and organization has been touched
     # check if customer and organization has been touched
     customer2 = User.find(customer2.id)
     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' )
       assert( true, 'customer2.updated_at has been updated' )
     else
     else
       assert( false, 'customer2.updated_at has not been updated' )
       assert( false, 'customer2.updated_at has not been updated' )
     end
     end
 
 
     organization1 = Organization.find(organization1.id)
     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' )
       assert( false, 'organization1.updated_at has been updated' )
     else
     else
       assert( true, 'organization1.updated_at has not been updated' )
       assert( true, 'organization1.updated_at has not been updated' )
     end
     end
 
 
-    sleep 3
+    sleep 6
 
 
     delete = ticket.destroy
     delete = ticket.destroy
     assert( delete, 'ticket destroy' )
     assert( delete, 'ticket destroy' )
 
 
     # check if customer and organization has been touched
     # check if customer and organization has been touched
     customer2 = User.find(customer2.id)
     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' )
       assert( true, 'customer2.updated_at has been updated' )
     else
     else
       assert( false, 'customer2.updated_at has not been updated' )
       assert( false, 'customer2.updated_at has not been updated' )
     end
     end
 
 
     organization1 = Organization.find(organization1.id)
     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' )
       assert( false, 'organization1.updated_at has been updated' )
     else
     else
       assert( true, 'organization1.updated_at has not been updated' )
       assert( true, 'organization1.updated_at has not been updated' )

+ 6 - 7
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.customer.id, customer1.id  )
     assert_equal( ticket.organization.id, organization1.id  )
     assert_equal( ticket.organization.id, organization1.id  )
 
 
-    sleep 5
+    sleep 6
 
 
     customer1.firstname = 'firstname customer1'
     customer1.firstname = 'firstname customer1'
     customer1.save
     customer1.save
 
 
     # check if organization has been touched
     # check if organization has been touched
     organization1 = Organization.find(organization1.id)
     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' )
       assert( true, 'organization1.updated_at has been updated' )
     else
     else
       assert( false, 'organization1.updated_at has not been updated' )
       assert( false, 'organization1.updated_at has not been updated' )
     end
     end
 
 
-    sleep 4
+    sleep 6
 
 
     ticket.customer_id = customer2.id
     ticket.customer_id = customer2.id
     ticket.save
     ticket.save
 
 
     # check if customer1, customer2 and organization has been touched
     # check if customer1, customer2 and organization has been touched
     customer1 = User.find(customer1.id)
     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' )
       assert( true, 'customer1.updated_at has been updated' )
     else
     else
       assert( false, 'customer1.updated_at has not been updated' )
       assert( false, 'customer1.updated_at has not been updated' )
     end
     end
 
 
     customer2 = User.find(customer2.id)
     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' )
       assert( true, 'customer2.updated_at has been updated' )
     else
     else
       assert( false, 'customer2.updated_at has not been updated' )
       assert( false, 'customer2.updated_at has not been updated' )
     end
     end
 
 
     organization1 = Organization.find(organization1.id)
     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' )
       assert( true, 'organization1.updated_at has been updated' )
     else
     else
       assert( false, 'organization1.updated_at has not been updated' )
       assert( false, 'organization1.updated_at has not been updated' )
@@ -111,6 +111,5 @@ class UserRefObjectTouchTest < ActiveSupport::TestCase
 
 
     delete = ticket.destroy
     delete = ticket.destroy
     assert( delete, 'ticket destroy' )
     assert( delete, 'ticket destroy' )
-
   end
   end
 end
 end