This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-performance-tests.git

commit 149b7bd49b01f5376cbc9f8482e994a8583abc64
Author: Claus Ibsen <[email protected]>
AuthorDate: Sat Dec 5 19:10:32 2026 +0100

    ai-benchmark: test-citrus-orders step 2 accepts the expected error in a 
file the test reads
    
    q4fn-1..4 put the error body in ../expected-error-response.json and checked
    the response with resource: file:; the test passed and the step failed,
    because the check wanted the text in the test file. Step 2 now checks 400 in
    the test and the text with test_data, and test_reads searches the files of
    the whole project that the test names, not only those under test/.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
    Claude-Session: https://claude.ai/code/session_016Y4dDi5iQNgtHrDdz2NpwF
---
 ai-benchmark/agent_mcp_stepwise.py | 8 +++++---
 ai-benchmark/gen_stepwise.py       | 5 ++++-
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/ai-benchmark/agent_mcp_stepwise.py 
b/ai-benchmark/agent_mcp_stepwise.py
index 7d6e173..c13455f 100755
--- a/ai-benchmark/agent_mcp_stepwise.py
+++ b/ai-benchmark/agent_mcp_stepwise.py
@@ -445,17 +445,19 @@ def file_matches(project, fname, rx):
 
 
 def test_reads(project, test, rx):
-    """test_data: whether a test holds the regex, or reads a file under its 
folder that holds it. The test names that
+    """test_data: whether a test holds the regex, or reads a file of the 
project that holds it. The test names that
     file by a path from its own folder, as it names "../sample-order.json" of 
the project (r28n-5, -6 and -7
     test-citrus-orders s3 put the empty order in test/empty-lines-order.json 
and sent it with resource: file:
-    "../test/empty-lines-order.json"; the test passed)."""
+    "../test/empty-lines-order.json"; the test passed). Any folder of the 
project: q4fn-1..4 test-citrus-orders s2
+    put the expected error body in ../expected-error-response.json and checked 
the response with it (the test
+    passed, and the step was failed for the text not being in the test 
file)."""
     path = os.path.join(project, test)
     text = read(path) or ""
     if re.search(rx, text):
         return True
     home = os.path.dirname(path)
     named = {os.path.normpath(os.path.join(home, w)) for w in 
re.findall(r"[^\s\"'(),]+", text)}
-    for root, dirs, files in os.walk(home):
+    for root, dirs, files in os.walk(project):
         for f in files:
             p = os.path.normpath(os.path.join(root, f))
             if p != os.path.normpath(path) and p in named and re.search(rx, 
read(p) or ""):
diff --git a/ai-benchmark/gen_stepwise.py b/ai-benchmark/gen_stepwise.py
index 376df12..cae8819 100644
--- a/ai-benchmark/gen_stepwise.py
+++ b/ai-benchmark/gen_stepwise.py
@@ -1676,7 +1676,10 @@ EXAMPLES.append({
          "check": {"test_run": CO_TEST, "files": {CO_TEST: 
"logMessage:\\s*[\"']?Order ORD-1001 accepted for C-482 with 2 line\\(s\\)"}},
          "reference": {CO_TEST: CO_T1}},
         {"request": "Add an HTTP case to the test: an order without a customer 
gets the answer 400 with {\"error\": \"an order needs a customer\"}.",
-         "check": {"test_run": CO_TEST, "files": {CO_TEST: 
"(?s)(?=.*\\b400\\b)(?=.*an order needs a customer)"}},
+         # the expected error may be in the test or in a file that the test 
reads (q4fn-1..4 wrote it to
+         # ../expected-error-response.json and checked the response with 
resource: file:; the test passed)
+         "check": {"test_run": CO_TEST, "files": {CO_TEST: "\\b400\\b"},
+                   "test_data": {CO_TEST: "an order needs a customer"}},
          "reference": {CO_TEST: CO_T2}},
         {"request": "An order with no lines is accepted today (201), which is 
a bug. Work test first: add a case to the test where an order whose lines are 
empty gets the answer 400 with {\"error\": \"an order needs at least one 
line\"}, then fix the route so that the test passes.",
          # the empty order may be in the test or in a file under test/ that 
the test reads, as the test of step 1 reads

Reply via email to