Repository: conbench/conbench (language: python)

Issue:
benchmark result compare page: rename to `/compare/benchmark-results/`
In the spirit of the app-wide rename from `benchmarks` to `benchmark-results`, this endpoint should be renamed. Probably keep the old endpoint around for old stable links, at least for a while.

https://github.com/conbench/conbench/blob/7c4968e631ecdc064559c86a1174a1353713b700/conbench/app/compare.py#L288


Discussion / hints:

Fix patch:
diff --git a/conbench/app/compare.py b/conbench/app/compare.py
index 888bda9e1..4d721a300 100644
--- a/conbench/app/compare.py
+++ b/conbench/app/compare.py
@@ -285,10 +285,17 @@ class CompareRuns(Compare):
 
 
 rule(
-    "/compare/benchmarks/<compare_ids>/",
+    "/compare/benchmark-results/<compare_ids>/",
     view_func=CompareBenchmarkResults.as_view("compare-benchmark-results"),
     methods=["GET"],
 )
+# legacy route
+rule(
+    "/compare/benchmarks/<compare_ids>/",
+    endpoint="compare-benchmarks",
+    redirect_to="/compare/benchmark-results/<compare_ids>/",
+    methods=["GET"],
+)
 rule(
     "/compare/runs/<compare_ids>/",
     view_func=CompareRuns.as_view("compare-runs"),


Test patch:
diff --git a/conbench/tests/app/test_compare.py b/conbench/tests/app/test_compare.py
index 54f6bea96..1fb24a355 100644
--- a/conbench/tests/app/test_compare.py
+++ b/conbench/tests/app/test_compare.py
@@ -16,7 +16,7 @@ def _emsg_needle(thing, thingid):
 
 
 class TestCompareBenchmarkResults(_asserts.GetEnforcer):
-    url = "/compare/benchmarks/{}/"
+    url = "/compare/benchmark-results/{}/"
     title = "Compare Benchmark Results"
     redirect_on_unknown = False
 
@@ -39,6 +39,41 @@ def test_flash_messages(self, client):
         assert "cannot perform comparison:" in response.text
 
 
+class TestCompareBenchmarks(_asserts.AppEndpointTest):
+    url = "/compare/benchmarks/{}/"
+    title = "Compare Benchmark Results"
+    redirect_on_unknown = False
+
+    def _create(self, client):
+        benchmark_result_id = self.create_benchmark(client)
+        return f"{benchmark_result_id}...{benchmark_result_id}"
+
+    def test_redirects(self, client):
+        self.authenticate(client)
+
+        response = client.get(
+            "/compare/benchmarks/unknown...unknown2/", follow_redirects=True
+        )
+        assert "/compare/benchmark-results/unknown...unknown2/" in response.request.url
+        assert any(
+            [
+                "/compare/benchmarks/unknown...unknown2/" == res.request.path
+                for res in response.history
+            ]
+        )
+        assert "cannot perform comparison:" in response.text, response.text
+
+        response = client.get("/compare/benchmarks/foo...bar/", follow_redirects=True)
+        assert "/compare/benchmark-results/foo...bar/" in response.request.url
+        assert any(
+            [
+                "/compare/benchmarks/foo...bar/" == res.request.path
+                for res in response.history
+            ]
+        )
+        assert "cannot perform comparison:" in response.text
+
+
 class TestCompareRuns(_asserts.GetEnforcer):
     url = "/compare/runs/{}/"
     title = "Compare Runs"