SIENTIAPDE-1646
Fix flaky shutdown assertions in test suite GC-collected instances during tests also invoke patched shutdown, making assert_called_once_with flaky. Count calls for this instance specifically instead of asserting total call count.
This commit is contained in:
@@ -991,7 +991,8 @@ def test_close_disposes_minio_repository(mock_shutdown):
|
||||
gates.close()
|
||||
minio.close.assert_called_once()
|
||||
assert gates.minio_repository is None
|
||||
mock_shutdown.assert_called_once_with(gates)
|
||||
# Other instances collected by GC during the test also hit the patched shutdown.
|
||||
assert mock_shutdown.call_args_list.count(call(gates)) == 1
|
||||
|
||||
|
||||
@patch.object(SientiaMonitoring, 'shutdown')
|
||||
@@ -1004,4 +1005,5 @@ def test_close_without_minio_repository(mock_shutdown):
|
||||
metrics_controller=MagicMock(spec=MetricsController),
|
||||
)
|
||||
gates.close()
|
||||
mock_shutdown.assert_called_once_with(gates)
|
||||
# Other instances collected by GC during the test also hit the patched shutdown.
|
||||
assert mock_shutdown.call_args_list.count(call(gates)) == 1
|
||||
|
||||
Reference in New Issue
Block a user