mandeepzemo commented on PR #53815:
URL: https://github.com/apache/airflow/pull/53815#issuecomment-3167424848

   @pierrejeambrun 
   
   In test_pool.py (lines 186–195), the test checks if the /pools endpoint 
returns the pool list in the expected order when using the order_by=name query 
param.
   
   **Example** 
   
   `assert [pool["name"] for pool in body["pools"]] == expected_ids`
   
   **Expected Behavior (Local):**
   
   _Given: POOL1_NAME = "pool1", POOL2_NAME = "pool2", POOL3_NAME = "pool/3"_
   
   **Database sorting by name should return:**
   
   `["pool/3", "pool2", "pool1"]`
   
   (/ sorts before alphanumeric characters in ASCII order).
   
   **Issue (CI/CD):**
   In CI runs, the same query returns:
   
   `["pool1", "pool2", "pool/3"]`
   
   —indicating sorting behavior differs between the local environment and the 
CI environment (likely due to DB collation or locale settings). 
[Logs](https://github.com/apache/airflow/actions/runs/16782614398/job/47619246852)
   
   **Resolution Founded**
   
   _Initial Fix:_
   
   To make the test consistent across environments, I changed the assertion to 
compare sorted lists:
   
   `assert sorted([pool["name"] for pool in body["pools"]]) == 
sorted(expected_ids)`
   
   _Permanent Fix (Preferred):_
   
   On reviewing other test cases such as test_variable.py, where keys include 
slashes:
   
   `TEST_VARIABLE_KEY = "test_variable_key"
   TEST_VARIABLE_KEY4 = "test_variable_key/with_slashes"`
   
   I updated POOL3_NAME to **"pool3/with_slashes"**.
   This makes the sorting order deterministic across environments and removes 
the need for the sorted() workaround entirely.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to