test_counts: Add test to do_incremental_logging_stat.

Adds an test, to count the number of database queries made by
`do_incremental_logging_stat` function.
This commit is contained in:
Mahhheshh 2024-03-10 20:37:02 +05:30 committed by Tim Abbott
parent 7607969f27
commit 218c7ae8cd
1 changed files with 5 additions and 0 deletions

View File

@ -1324,6 +1324,11 @@ class TestDoIncrementLoggingStat(AnalyticsTestCase):
do_increment_logging_stat(self.default_realm, stat, None, self.TIME_ZERO) do_increment_logging_stat(self.default_realm, stat, None, self.TIME_ZERO)
self.assertTableState(RealmCount, ["value"], [[3]]) self.assertTableState(RealmCount, ["value"], [[3]])
def test_do_increment_logging_start_query_count(self) -> None:
stat = LoggingCountStat("test", RealmCount, CountStat.DAY)
with self.assert_database_query_count(2):
do_increment_logging_stat(self.default_realm, stat, None, self.TIME_ZERO)
class TestLoggingCountStats(AnalyticsTestCase): class TestLoggingCountStats(AnalyticsTestCase):
def test_aggregation(self) -> None: def test_aggregation(self) -> None: