Skip to content

test(unikontainers): add unit tests for pure functions - #723

Open
mdryaaan wants to merge 1 commit into
urunc-dev:mainfrom
mdryaaan:test/unikontainers-pure-functions
Open

mdryaaan wants to merge 1 commit into
urunc-dev:mainfrom
mdryaaan:test/unikontainers-pure-functions

Conversation

@mdryaaan

Copy link
Copy Markdown
Contributor

Description

Adds unit tests for three sets of pure functions in pkg/unikontainers that have real conditional logic but no test coverage.
TestMapRootfsPropagationFlagmount_test.go Covers all 8 valid propagation flag names (shared, rshared, slave, rslave, private, rprivate, unbindable, runbindable) asserting the exact unix flag value returned, plus one subtest for an unknown value asserting a non-nil error.

TestChooseTmpfsSizeshared_fs_test.go Covers the 9pfs constant path, two virtiofs cases with typical memory (256 MB, 512 MB) verifying the MiB-to-MB conversion and 1 MiB overhead, and the zero-memory edge case.

TestInt32msgSerialize / TestBytemsgSerializeipc_message_test.go Covers int32msg serialization (length, type, and value fields at thecorrect byte offsets) and bytemsg serialization (aligned buffer length, header fields, value bytes). Includes a subtest for the oversized-value panic path in bytemsg that asserts a netlinkError is raised when Len() exceeds math.MaxUint16.

Related issues

How was this tested?

go test -count=1 ./pkg/unikontainers/... -v
-run "TestMapRootfsPropagationFlag|TestChooseTmpfsSize|TestInt32msgSerialize|TestBytemsgSerialize"
All 16 subtests pass. Linter passes (make lint, 0 issues).
Build passes (make).

LLM usage

Claude Sonnet 4.6 was used to assist in identifying untested functions and understanding the codebase structure. All code was manually reviewed and understood before submission.

Checklist

  • I have read the contribution guide.
  • The linter passes locally (make lint).
  • The e2e tests of at least one tool pass locally (make test_ctr, make test_nerdctl, make test_docker, make test_crictl).
  • If LLMs were used: I have read the llm policy.

@netlify

netlify Bot commented May 25, 2026

Copy link
Copy Markdown

Deploy Preview for urunc canceled.

Name Link
🔨 Latest commit b70e91f
🔍 Latest deploy log https://app.netlify.com/projects/urunc/deploys/6a13ff197771630008e93c27

@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 15 days.

@github-actions github-actions Bot added the Stale label Jul 25, 2026
@cmainas cmainas removed the Stale label Jul 25, 2026
@cmainas

cmainas commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Hello @mdryaaan ,

can you bring this PR up-to-date with the main branch?

Signed-off-by: Md Raiyan <alikhurshid842001@gmail.com>
@mdryaaan
mdryaaan force-pushed the test/unikontainers-pure-functions branch from b70e91f to 9e6b0a7 Compare September 16, 2026 14:40
@netlify

netlify Bot commented Sep 16, 2026

Copy link
Copy Markdown

Deploy Preview for urunc canceled.

Name Link
🔨 Latest commit 9e6b0a7
🔍 Latest deploy log https://app.netlify.com/projects/urunc/deploys/6aaaaa5f7cb9ed0008dcba5c

@mdryaaan

Copy link
Copy Markdown
Contributor Author

@cmainas Done! PTAL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants