pkg/copy: add tests for ParseSourceAndDestination#28908
Conversation
|
@Honny1 @danishprakash can you help me with the review of this pr as well |
Honny1
left a comment
There was a problem hiding this comment.
Can you please add Fixes: #issueNumber to the commit msg? Otherwise LGTM.
|
Packit is unstable. |
|
ohkk will do it thanks for review |
|
/packit rebuild-failed |
|
@danishprakash, @Honny1 the issue is up from a week if any points i have missed solving it do point it out ... so i will solve it or if the pr is invalid for current time then i will try solving other bugs ... |
Honny1
left a comment
There was a problem hiding this comment.
I'm missing some edge cases:
- Multiple colons:
ctr:/path/with:colonshould split only on the first colon - No container on either side: two local paths like
/src,/dst(function allows it despite docstring) - Container on both sides:
a:/x,b:/y(function allows it, no validation) - Bare filename:
myfile.txtwith no colon, dot, or slash prefix - Whitespace in path:
ctr:/path with spaces/file - Source only empty, destination valid:
"",/dst(distinct from "both empty")
Otherwise LGTM
Fixes: podman-container-tools#28907 Signed-off-by: ROKUMATE <rohitkumawat0110@gmail.com>
|
Resolved the additional test cases that you mentioned sir 👍🏼 |
|
PTAL @podman-container-tools/podman-maintainers @podman-container-tools/podman-reviewers |
|
LGTM, something's up with the tests but seems unrelated Edit: my bad, Matt said it right |
|
I think the test failures are legitimate. I bet you it's because the tests use forward-slash and, on Windows, our parsing wants backslashes? |
Fixes: #28907
What
Add unit tests for
ParseSourceAndDestinationinpkg/copy, the parser behindpodman cparguments ([nameOrID:]path). It had no test coverage.Why
The parsing rules are easy to regress: a leading
.//keeps a colon as partof the path (not a container ref), absolute paths never denote a container, and
both paths must be non-empty. Tests lock this behavior in.
Details
Table-driven tests in
pkg/copy/parse_test.gocovering:.or/No production code changes.
go test ./pkg/copy/passes in local run.