rusackas commented on code in PR #44406:
URL: https://github.com/apache/superset/pull/44406#discussion_r4172344817
##########
tests/unit_tests/common/test_query_context_processor.py:
##########
@@ -2630,6 +3041,94 @@ def
test_mark_force_executed_noop_without_nonce(processor, mock_query_context):
cache_manager.data_cache.set.assert_not_called()
+# =============================================================================
+# Annotation-data cache decoupled from the dataframe cache
+# =============================================================================
+
+
+def test_get_annotation_data_cached_reads_from_cache(processor):
+ """A hit on the annotation-specific key skips recomputation entirely."""
+ with patch(
+ "superset.common.query_context_processor.cache_manager"
+ ) as cache_manager:
+ cache_manager.data_cache.get.return_value = {"annotation_data": {"a":
1}}
+ with patch.object(processor, "get_annotation_data") as mock_get:
+ result = processor._get_annotation_data_cached(
+ query_obj=MagicMock(),
+ cache_key="ak",
+ force_query=False,
+ force_cached=False,
+ timeout=60,
+ datasource_uid="ds",
+ )
+ assert result == {"a": 1}
+ mock_get.assert_not_called()
+
+
+def test_get_annotation_data_cached_computes_and_caches_on_miss(processor):
Review Comment:
Fixed in the latest push.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]