Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

relax.UnitTests.TestSimpleProcessAdvancement -- System.AssertException: Assertion Failed: Expected: 30, Actual: 25 #14

Open
dvf1976 opened this issue Feb 12, 2015 · 1 comment

Comments

@dvf1976
Copy link

dvf1976 commented Feb 12, 2015

The error:
relax.UnitTests.TestSimpleProcessAdvancement -- System.AssertException: Assertion Failed: Expected: 30, Actual: 25
seems to happen spuriously in our non-Prod environments (probably once every 15 runs-or-so).

It hasn't happened during a Prod release, yet... but when it does we will be sad because it'll invalidate a test run of over 5000 tests that takes ~2.5 hours to run.

I don't see how this test is failing... but it appears to be.

This is for the Managed Package v1.4

@jeremyhiggs
Copy link

I've seen this on production and sandboxes a few times now, but very randomly. Seems to be some kind of race condition.

Here's the dummy data fetched on line 190 when the test fails:
12:43:36:398 USER_DEBUG [191]|DEBUG|dummyData = (Job__c:{Name=a1QO0000002k9haMAA, Run_Increment__c=30, Id=a1QO0000002k9haMAA}, Job__c:{Name=a1QO0000002k9hbMAA, Run_Increment__c=25, Id=a1QO0000002k9hbMAA}, Job__c:{Name=a1QO0000002k9hcMAA, Run_Increment__c=2, Id=a1QO0000002k9hcMAA}, Job__c:{Name=a1QO0000002k9hZMAQ, Run_Increment__c=30, Id=a1QO0000002k9hZMAQ})

And when it doesn't fail:
12:43:18:080 USER_DEBUG [191]|DEBUG|dummyData = (Job__c:{Name=a1QO0000002k9hPMAQ, Run_Increment__c=30, Id=a1QO0000002k9hPMAQ}, Job__c:{Name=a1QO0000002k9hQMAQ, Run_Increment__c=30, Id=a1QO0000002k9hQMAQ}, Job__c:{Name=a1QO0000002k9hRMAQ, Run_Increment__c=25, Id=a1QO0000002k9hRMAQ}, Job__c:{Name=a1QO0000002k9hSMAQ, Run_Increment__c=2, Id=a1QO0000002k9hSMAQ})

It looks like a combination of two problems:

  • Something in the original insert of dummy data results in the IDs being out of order
  • When the Name of the dummy data records is changed to the Id (UnitTestJob2), the fetched dummy data doesn't come back in the expected order.

I fixed it by replacing the code at line 190 with this:
Map<Id,Job__c> updatedDummyDataMap = new Map<Id,Job__c>([select Id, Name, Run_Increment__c, Run_Units__c from Job__c where Id IN :dummyDataIds order by Name]);
System.assertEquals(4,updatedDummyDataMap.size()); System.assertEquals(30,updatedDummyDataMap.get(dummyData[0].Id).Run_Increment__c); // was 3 minutes, so should now be 30
System.assertEquals(30,updatedDummyDataMap.get(dummyData[1].Id).Run_Increment__c); // was 4 minutes, so should now be 30
System.assertEquals(25,updatedDummyDataMap.get(dummyData[2].Id).Run_Increment__c); // WAS 25 minutes, so no update should have happened
System.assertEquals(2,updatedDummyDataMap.get(dummyData[3].Id).Run_Increment__c); // WAS 2 hours, so no update should have happened

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants