kaxil opened a new pull request, #73298: URL: https://github.com/apache/airflow/pull/73298
Follow-up to #72348, which fixed this symptom for `host` and left it for `port`. Clicking **Test** on a connection that has no port returns `400 "The host or port to test differs from the stored connection. Include the credentials to test in the request body."` That covers every connection type which does not address a port: `aws`, `fs`, `generic`, `http` configured without one. The UI builds its request body with `port: Number(connection.port)`, and `Number(null)` is `0`. `_same_endpoint` normalised `""` to `None` so a blank host matches a stored NULL, but not `0`, and `0 == ""` is `False` in Python. So the requested port never matched the stored NULL, `port_changed` was true, and the masked `"***"` password the UI sends for an unchanged secret is deliberately not treated as caller-supplied credentials. Hence the 400. The fix normalises `0` alongside `""`. Nothing addresses port 0, so within a comparison that only asks "is this a different destination from the stored one" it means the same thing as blank. **Fixed in the API rather than the UI**, even though the `Number(null)` coercion is where the `0` comes from. The route's job at this point is deciding whether the caller is pointing somewhere other than the stored connection, and `port: 0` on a portless connection is not, so accepting it is correct on the endpoint's own terms rather than a workaround for the client. There is also no test file for `TestConnectionButton.tsx`, so a UI-side change would ship with no coverage. The added test posts exactly what the UI posts (`host: ""`, `port: 0`, `password: "***"`). The two tests added by #72348 both avoid this case, one by omitting `port` and the other by sending a real one. `test_should_reject_test_when_target_overridden_without_credentials[port-changed]` still passes, so a genuinely different port is still rejected and the check this sits inside is not loosened. -- 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]
