I have a few test classes that fail but only when all the test classes are run in parallel.I'm using a hierarchy custom setting as part of the test code. In order to narrow down the problem I have the following in my test code:
My_Setting__c settings = My_Setting__c.getOrgDefaults();
settings.some_app_date__c = System.today()+1;
upsert settings;
Ctl_SomePage ctrl = new Ctl_SomePage();
My_Setting__c settings1 = My_setting__c.getOrgDefaults();
system.assert(false,'date: ' + settings1.some_app_date__c);
When run by itself or with parallel disabled this produces a date:
System.AssertException: Assertion Failed: date: 2016-03-01 00:00:00
When run with all tests and parallel enabled I get:
System.DmlException: Upsert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: SetupOwnerId duplicates value on record with id: 00DP0000003oTNU: []
If I try to just log out the custom setting its just an empty object. It seems like it won't let me update it but if I try to get the values from it, its empty...
Any suggestions?