Skip to content

Commit

Permalink
fix err to use UserBuilder
Browse files Browse the repository at this point in the history
Signed-off-by: sat0ken <[email protected]>
  • Loading branch information
sat0ken committed Nov 4, 2024
1 parent 2b2374e commit 236da75
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion tests/contest/contest/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use std::path::{Path, PathBuf};
use anyhow::{Context, Result};
use clap::Parser;
use contest::logger;
use contest::tests::process_user::get_process_user_test;
use test_framework::TestManager;
use tests::cgroups;

Expand All @@ -22,6 +21,7 @@ use crate::tests::linux_ns_itype::get_ns_itype_tests;
use crate::tests::mounts_recursive::get_mounts_recursive_test;
use crate::tests::no_pivot::get_no_pivot_test;
use crate::tests::pidfile::get_pidfile_test;
use crate::tests::process_user::get_process_user_test;
use crate::tests::readonly_paths::get_ro_paths_test;
use crate::tests::scheduler::get_scheduler_test;
use crate::tests::seccomp::get_seccomp_test;
Expand Down
17 changes: 9 additions & 8 deletions tests/contest/contest/src/tests/process_user/process_user.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
use crate::utils::test_inside_container;

Check warning on line 1 in tests/contest/contest/src/tests/process_user/process_user.rs

View workflow job for this annotation

GitHub Actions / check (x86_64, gnu)

Diff in /home/runner/work/youki/youki/tests/contest/contest/src/tests/process_user/process_user.rs

Check warning on line 1 in tests/contest/contest/src/tests/process_user/process_user.rs

View workflow job for this annotation

GitHub Actions / check (x86_64, gnu)

Diff in /home/runner/work/youki/youki/tests/contest/contest/src/tests/process_user/process_user.rs
use anyhow::{Context, Ok, Result};
use oci_spec::runtime::{ProcessBuilder, Spec, SpecBuilder, User};
use oci_spec::runtime::{ProcessBuilder, Spec, SpecBuilder, UserBuilder};
use test_framework::{test_result, Test, TestGroup, TestResult};

Check warning on line 5 in tests/contest/contest/src/tests/process_user/process_user.rs

View workflow job for this annotation

GitHub Actions / check (x86_64, gnu)

Diff in /home/runner/work/youki/youki/tests/contest/contest/src/tests/process_user/process_user.rs

Check warning on line 5 in tests/contest/contest/src/tests/process_user/process_user.rs

View workflow job for this annotation

GitHub Actions / check (x86_64, gnu)

Diff in /home/runner/work/youki/youki/tests/contest/contest/src/tests/process_user/process_user.rs
fn create_spec() -> Result<Spec> {
let user = UserBuilder::default()
.uid(10u32)
.gid(10u32)
.additional_gids(vec![5u32])
.umask(0o02u32)
.build()?;

let spec = SpecBuilder::default()
.process(
ProcessBuilder::default()
.user(
User::default()
.set_uid(10)
.set_gid(10)
.set_additional_gids(Option::from(vec![5]))
.set_umask(Option::from(u32::from(0o02))),
)
.user(user)
.build()
.expect("error in creating process config"),
)
Expand Down

0 comments on commit 236da75

Please sign in to comment.