This is an automated email from the ASF dual-hosted git repository. cmcfarlen pushed a commit to branch 10.2.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit ff3ec35ebaf7fad34f1890d7f484e61622baada5 Author: Brian Neradt <[email protected]> AuthorDate: Thu Jun 25 09:44:00 2026 -0500 slice_prefetch.test.py: address cache.log flakiness (#13322) 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 (cherry picked from commit c179b6b9bbc0853d2a184296ec38a37b5032e4c4) --- .../pluginTest/slice/gold/slice_prefetch.gold | 27 ------------------ .../pluginTest/slice/slice_prefetch.test.py | 33 +++++++++++++++++++++- 2 files changed, 32 insertions(+), 28 deletions(-) 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 60a398b009..0000000000 --- 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 baf9cbb1ec..14767b41c0 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 @@ test_run = Test.AddAwaitFileContainsTestRun( 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
