Improve error messages#1440
Conversation
|
Ephemeral COPR build failed. @containers/packit-build please check. |
|
Good to go, should fix the last failing test in containers/podman#28570 @containers/netavark-maintainers PTAL |
mtrmac
left a comment
There was a problem hiding this comment.
(I’m not a maintainer here, so I can’t approve / reject.)
Consider {:?}: if the value is already known to be not using the correct syntax, could it contain newlines, full sentences, or other surprising data?
Well that is one of the nicer things about rust, String musts be valid utf8, so at least some dangerous bytes are skipped that way. Sure newlines and such can still happen so quoting them here does make sense I guess. I don't think we have paid much attention to any of this so far here. My personal going so far is anything netavark receives is consider trusted input from a security POV. If something gives us garbage I am fine producing garbage. |
| @test "create - fail with invalid network name" { | ||
| expected_rc=1 run_netavark create < ${TESTSDIR}/testfiles/create/invalid-name.json | ||
| assert_json ".error" "Invalid characters in network name: must match [a-zA-Z0-9][a-zA-Z0-9_.-]" "Error message contains 'Invalid characters in network name'" | ||
| assert_json ".error" "Invalid characters in network name badname!: must match [a-zA-Z0-9][a-zA-Z0-9_.-]*" "Error message contains 'Invalid characters in network name'" |
There was a problem hiding this comment.
test need quotes around the name now
Add more detail to errors for network create validation Signed-off-by: Ashley Cui <acui@redhat.com>
Add more detail to errors for network create validation