Skip to content

test(rootfs): Add adjust_root_mount_propagation unit tests - #3710

Open
Scanf-s wants to merge 3 commits into
youki-dev:mainfrom
Scanf-s:test/adjust-root-mount-propagation-unit-test
Open

test(rootfs): Add adjust_root_mount_propagation unit tests#3710
Scanf-s wants to merge 3 commits into
youki-dev:mainfrom
Scanf-s:test/adjust-root-mount-propagation-unit-test

Conversation

@Scanf-s

@Scanf-s Scanf-s commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Description

  • Add unit tests for RootFS::adjust_root_mount_propagation in libcontainer/src/rootfs/rootfs.rs.
  • Current adjust_root_mount_propagation covers 'shared', 'unbindable' configuration to set up a rootfs's propagation mode
  • To verify this behavior, I just added few unit tests by mocking rootfs

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test updates
  • CI/CD related changes
  • Other (please describe):

Testing

  • Added new unit tests
  • Added new integration tests
  • Ran existing test suite
  • Tested manually (please provide steps)

Related Issues

Refers to #279

Additional Context

@Scanf-s Scanf-s changed the title Test/adjust root mount propagation unit test test(rootfs): Add adjust_root_mount_propagation unit tests Aug 28, 2026
@Scanf-s
Scanf-s force-pushed the test/adjust-root-mount-propagation-unit-test branch from 2f403cd to 3bdb9dc Compare August 28, 2026 15:33
use crate::syscall::test::{MountArgs, TestHelperSyscall};

#[test]
fn test_shared_root_mount_propagation() -> Result<()> {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The checks for private, unbindable, and slave are almost identical. Could we extract the common logic into a helper function so that adding tests for other options will be easier in the future?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree 👍.
I'll refactor the common logic into a helper function within the test module and keep each test case separate and simple.
I hope this could make it easier to add tests for other propagation options in the future

Signed-off-by: Scanf-s <sullung2yo@gmail.com>
…t test

Signed-off-by: Scanf-s <sullung2yo@gmail.com>
Signed-off-by: Scanf-s <sullung2yo@gmail.com>
@Scanf-s
Scanf-s force-pushed the test/adjust-root-mount-propagation-unit-test branch from 420f16e to d84b1c0 Compare September 5, 2026 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants