Beispiel #1
0
 def test_text_partitioning_correct(self):
     from corehq.sql_db.shard_data_management import get_count_of_models_by_shard_for_testing
     form = self._make_form_instance(str(self.p2_uuid))
     form.save()
     self.assertEqual(XFormInstanceSQL.objects.using(self.db2).count(), 1)
     matches = get_count_of_unmatched_models_by_shard(self.db2, XFormInstanceSQL)
     self.assertEqual(0, len(matches))
     all_data = get_count_of_models_by_shard_for_testing(self.db2, XFormInstanceSQL)
     self.assertEqual(1, len(all_data))
     self.assertEqual((2, 1), all_data[0])
Beispiel #2
0
 def test_uuid_partitioning_correct(self):
     from corehq.sql_db.shard_data_management import get_count_of_models_by_shard_for_testing
     instance = BaseSchedulingPartitionedDBAccessorsTest.make_alert_schedule_instance(
         self.p1_uuid, domain=self.domain
     )
     save_alert_schedule_instance(instance)
     self.assertEqual(AlertScheduleInstance.objects.using(self.db1).count(), 1)
     matches = get_count_of_unmatched_models_by_shard(self.db1, AlertScheduleInstance)
     self.assertEqual(0, len(matches))
     all_data = get_count_of_models_by_shard_for_testing(self.db1, AlertScheduleInstance)
     self.assertEqual(1, len(all_data))
     self.assertEqual((0, 1), all_data[0])