@@ -415,6 +415,48 @@ def test_missing_png_produces_no_html(self, dp, tmp_path):
415415 assert not (tmp_path / "ghost.html" ).exists () # noqa: S101
416416
417417
418+ class TestUpdateIndexHtml :
419+ """Regression tests for quick_look_plots.html accumulating multiple deployments.
420+
421+ a3f4b45 ("Drop <auv_name> suffix from all the file names.") added a filter
422+ intended to purge leftover old auv_name-prefixed hrefs when re-reading an
423+ existing index, but it compared the href's filename against the date-range
424+ dlist_dir instead of the old auv_name prefix. Since filenames are built from
425+ the deployment name (not the dlist_dir), the filter matched nothing on
426+ re-read and silently dropped every previously recorded deployment's entries.
427+ """
428+
429+ def test_preserves_prior_deployments_across_calls (self , dp , tmp_path ):
430+ """A second deployment's _update_index_html() call must not erase the
431+ first deployment's entries."""
432+ year_dir = tmp_path / "2025"
433+ depl_dir_1 = year_dir / "20250414_20250418"
434+ depl_dir_2 = year_dir / "20250501_20250505"
435+ depl_dir_1 .mkdir (parents = True )
436+ depl_dir_2 .mkdir (parents = True )
437+
438+ dp ._update_index_html (
439+ depl_dir_1 ,
440+ [depl_dir_1 / "CANON_April_2025_2column_cmocean.html" ],
441+ deployment_name = "CANON April 2025" ,
442+ )
443+ dp ._update_index_html (
444+ depl_dir_2 ,
445+ [depl_dir_2 / "CANON_May_2025_2column_cmocean.html" ],
446+ deployment_name = "CANON May 2025" ,
447+ )
448+
449+ content = (year_dir / "quick_look_plots.html" ).read_text ()
450+ assert ( # noqa: S101
451+ 'href="20250414_20250418/CANON_April_2025_2column_cmocean.html"' in content
452+ )
453+ assert ( # noqa: S101
454+ 'href="20250501_20250505/CANON_May_2025_2column_cmocean.html"' in content
455+ )
456+ assert "CANON April 2025" in content # noqa: S101
457+ assert "CANON May 2025" in content # noqa: S101
458+
459+
418460# ---------------------------------------------------------------------------
419461# Tests for plot_deployment() — exercises the stoqs_url_from_ds call path
420462# ---------------------------------------------------------------------------
0 commit comments