test semantics

This commit is contained in:
2026-03-21 15:23:06 +03:00
parent 9b47b9b667
commit 0b275ed3d1
14 changed files with 467 additions and 101 deletions

View File

@@ -148,6 +148,7 @@ class CleanReleaseCompliancePlugin:
# @PURPOSE: Provide minimal plugin loader contract used by TaskManager in integration tests.
# @INVARIANT: has_plugin/get_plugin only acknowledge the seeded compliance plugin id.
class _PluginLoaderStub:
# @CONTRACT: Partial PluginLoader stub. Implements: has_plugin, get_plugin. Stubs (NotImplementedError): list_plugins, get_all_plugins, get_all_plugin_configs.
def __init__(self, plugin: CleanReleaseCompliancePlugin):
self._plugin = plugin
@@ -159,6 +160,21 @@ class _PluginLoaderStub:
raise ValueError("Plugin not found")
return self._plugin
def list_plugins(self):
raise NotImplementedError(
"list_plugins not implemented in _PluginLoaderStub; add if test path requires plugin enumeration"
)
def get_all_plugins(self):
raise NotImplementedError(
"get_all_plugins not implemented in _PluginLoaderStub; add if test path requires full plugin set"
)
def get_all_plugin_configs(self):
raise NotImplementedError(
"get_all_plugin_configs not implemented in _PluginLoaderStub; add if test path requires plugin configs"
)
# [/DEF:_PluginLoaderStub:Class]

View File

@@ -37,6 +37,8 @@ def make_adapter():
client = MagicMock()
client.network = MagicMock()
return SupersetCompilationAdapter(environment=environment, client=client), client
# [/DEF:make_adapter:Function]
@@ -61,6 +63,8 @@ def test_preview_prefers_supported_client_method_before_network_fallback():
assert preview.compiled_sql == "SELECT 1"
client.compile_preview.assert_called_once()
client.network.request.assert_not_called()
# [/DEF:test_preview_prefers_supported_client_method_before_network_fallback:Function]
@@ -88,10 +92,14 @@ def test_preview_falls_back_across_matrix_until_supported_endpoint_returns_sql()
assert preview.preview_status.value == "ready"
assert preview.compiled_sql == "SELECT * FROM dataset_77"
assert client.network.request.call_count == 2
# @FRAGILE: Positional call assertion — ordering changes will break this test without indicating a real regression. Prefer content-based assertion.
first_call = client.network.request.call_args_list[0].kwargs
# @FRAGILE: Positional call assertion — ordering changes will break this test without indicating a real regression. Prefer content-based assertion.
second_call = client.network.request.call_args_list[1].kwargs
assert first_call["endpoint"] == "/dataset/77/preview"
assert second_call["endpoint"] == "/dataset/77/sql"
# [/DEF:test_preview_falls_back_across_matrix_until_supported_endpoint_returns_sql:Function]
@@ -124,11 +132,15 @@ def test_sql_lab_launch_falls_back_to_legacy_execute_endpoint():
assert sql_lab_ref == "query-123"
assert client.network.request.call_count == 2
# @FRAGILE: Positional call assertion — ordering changes will break this test without indicating a real regression. Prefer content-based assertion.
first_call = client.network.request.call_args_list[0].kwargs
# @FRAGILE: Positional call assertion — ordering changes will break this test without indicating a real regression. Prefer content-based assertion.
second_call = client.network.request.call_args_list[1].kwargs
assert first_call["endpoint"] == "/sqllab/execute/"
assert second_call["endpoint"] == "/sql_lab/execute/"
# [/DEF:test_sql_lab_launch_falls_back_to_legacy_execute_endpoint:Function]
# [/DEF:SupersetCompatibilityMatrixTests:Module]
# [/DEF:SupersetCompatibilityMatrixTests:Module]