Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: cargo test for non-root users #635

Merged
merged 3 commits into from
Mar 1, 2024

Conversation

mmartinv
Copy link
Contributor

@mmartinv mmartinv commented Feb 28, 2024

  • fix: add system_info module to utils
  • fix: do not run tests that require root
  • fix: use system_info mod functions to gather the current user name

Fixes: #630

util/Cargo.toml Outdated Show resolved Hide resolved
@mmartinv
Copy link
Contributor Author

Opened a PR to update the sysinfo crate

@mmartinv mmartinv force-pushed the fix-cargo-test-non-root branch 5 times, most recently from 861738d to 2577761 Compare March 1, 2024 18:05
Add `system_info` module to `utils` containing
functions that gather information from current
user

Signed-off-by: Miguel Martín <mmartinv@redhat.com>
Do not run tests that require root. The tests requiring superuser
privileges are marked as ignored and will display a message on how
to actually run those tests:
```
[root@localhost]# cargo test -- --ignored
```

An additional test is added to check that the effective user name
is actually root before trying to run the commands.

Signed-off-by: Miguel Martín <mmartinv@redhat.com>
Use `system_info` mod functions to gather the current user name.

Signed-off-by: Miguel Martín <mmartinv@redhat.com>
Copy link
Contributor

@miabbott miabbott left a comment

Choose a reason for hiding this comment

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

Nice separation of the commits; LGTM

@mergify mergify bot merged commit c132b63 into fdo-rs:main Mar 1, 2024
16 of 21 checks passed
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.

Tests not working on non-devcontainer environments
4 participants