From 19e311e8bc0058cdde007bc94a21e40da26fd061 Mon Sep 17 00:00:00 2001 From: bneradt Date: Wed, 24 Jun 2026 15:07:43 -0500 Subject: [PATCH] slice_prefetch.test.py: address cache.log flakiness Background slice prefetch requests can log around the client transactions. A run can therefore contain the expected cache records while still failing an ordered cache.log gold comparison. This replaces the full-file gold comparison with per-entry log assertions that verify the expected cache and prefetch records independently of ordering, then removes the unused gold file. Fixes: #13311 --- .../pluginTest/slice/gold/slice_prefetch.gold | 27 --------------- .../pluginTest/slice/slice_prefetch.test.py | 33 ++++++++++++++++++- 2 files changed, 32 insertions(+), 28 deletions(-) delete mode 100644 tests/gold_tests/pluginTest/slice/gold/slice_prefetch.gold diff --git a/tests/gold_tests/pluginTest/slice/gold/slice_prefetch.gold b/tests/gold_tests/pluginTest/slice/gold/slice_prefetch.gold deleted file mode 100644 index 60a398b009b..00000000000 --- a/tests/gold_tests/pluginTest/slice/gold/slice_prefetch.gold +++ /dev/null @@ -1,27 +0,0 @@ -bytes 0-6/18 miss -bytes ``/18 miss -bytes ``/18 miss -bytes 14-17/18 hit-fresh -- miss, none -bytes 0-6/18 hit-fresh -bytes 7-13/18 hit-fresh -bytes 14-17/18 hit-fresh -- hit-fresh, none -bytes 0-6/18 hit-stale -bytes ``/18 hit-stale -bytes ``/18 hit-stale -bytes 14-17/18 hit-fresh -- hit-stale, none -bytes 0-6/18 hit-fresh -bytes 7-13/18 hit-fresh -bytes 14-17/18 hit-fresh -bytes 0-17/18 hit-fresh, none -bytes 0-4/18 miss -bytes ``/18 miss -bytes ``/18 miss -bytes ``/18 miss -bytes 10-14/18 hit-fresh -bytes 15-17/18 hit-fresh -bytes 5-16/18 miss, none -bytes 0-6/18 hit-fresh -*/18 hit-fresh, none diff --git a/tests/gold_tests/pluginTest/slice/slice_prefetch.test.py b/tests/gold_tests/pluginTest/slice/slice_prefetch.test.py index baf9cbb1eca..14767b41c02 100644 --- a/tests/gold_tests/pluginTest/slice/slice_prefetch.test.py +++ b/tests/gold_tests/pluginTest/slice/slice_prefetch.test.py @@ -16,6 +16,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import os +import re Test.Summary = ''' slice plugin prefetch feature test @@ -180,4 +181,34 @@ cache_file, r'\*/18 hit-fresh, none$', ) -ts.Disk.File(cache_file).Content = "gold/slice_prefetch.gold" +cache_log = ts.Disk.File(cache_file) +expected_cache_entries = [ + "bytes 0-6/18 miss", + "bytes 7-13/18 miss", + "bytes 14-17/18 miss", + "bytes 14-17/18 hit-fresh", + "- miss, none", + "bytes 0-6/18 hit-fresh", + "bytes 7-13/18 hit-fresh", + "bytes 14-17/18 hit-fresh", + "- hit-fresh, none", + "bytes 0-6/18 hit-stale", + "bytes 7-13/18 hit-stale", + "bytes 14-17/18 hit-stale", + "- hit-stale, none", + "bytes 0-17/18 hit-fresh, none", + "bytes 0-4/18 miss", + "bytes 5-9/18 miss", + "bytes 10-14/18 miss", + "bytes 15-17/18 miss", + "bytes 10-14/18 hit-fresh", + "bytes 15-17/18 hit-fresh", + "bytes 5-16/18 miss, none", + "*/18 hit-fresh, none", +] +for index, entry in enumerate(expected_cache_entries): + tester = Testers.ContainsExpression(f'(?m)^{re.escape(entry)}$', f'Verify cache log contains: {entry}') + if index == 0: + cache_log.Content = tester + else: + cache_log.Content += tester