test: add unit tests for resolveAgainstBase#592
test: add unit tests for resolveAgainstBase#592Shreya2005-2005 wants to merge 1 commit intourunc-dev:mainfrom
Conversation
Signed-off-by: Shreya2005-2005 <bhakatmistu2005@gmail.com>
✅ Deploy Preview for urunc canceled.
|
|
Hello @Shreya2005-2005 , thank you for submitting this PR. Please read the contribution guide and update your PR. |
Sure, made the changes according to the PR template could you take a look again |
|
Hi @cmainas , whenever you get a chance review the changes |
cmainas
left a comment
There was a problem hiding this comment.
Hello @Shreya2005-2005 ,
- there is already a file for the unit tests of
pkg/unikontianers/utils.go. Please update this file instead of creating a new one. - the suggested tests should be transformed to table-based tests (See for example).
urunc/pkg/unikontainers/vaccel_test.go
Line 23 in 8a917b1
- There is no test for failure (i.e. )
urunc/pkg/unikontainers/utils.go
Line 229 in 8a917b1
- Please use a different path than
/home/shreya
| }) | ||
|
|
||
| t.Run("relative path is joined with absolute base", func(t *testing.T) { | ||
| result, err := resolveAgainstBase("/home/shreya", "documents/file.txt") |
There was a problem hiding this comment.
Please use a different path than /home/shreya
| t.Run("relative path with relative base", func(t *testing.T) { | ||
| result, err := resolveAgainstBase("mybase", "myfile.txt") | ||
| assert.NoError(t, err) | ||
| assert.Contains(t, result, "mybase/myfile.txt") |
There was a problem hiding this comment.
Contians for a path is not a strong requirement. We should test the function returned the correct absolute path.
Description
Adds unit tests for the
resolveAgainstBasefunction inpkg/unikontainers/utils.go.This function had no test coverage. The tests cover:
Related issues
How was this tested?
Ran the unit tests locally using:
go test ./pkg/unikontainers/... -v -run TestResolveAgainstBaseAll 3 test cases passed.
LLM usage
Claude Sonnet 4.6 was used to assist in understanding the codebase and test structure.
All generated code was reviewed and understood before submission.
Checklist
make lint).make test_ctr,make test_nerdctl,make test_docker,make test_crictl).