Skip to content

Commit a18f8e3

Browse files
committed
Changed hardcoded defaults to intentionally wrong values that differ from test config
1 parent 8ab656c commit a18f8e3

2 files changed

Lines changed: 30 additions & 12 deletions

File tree

feature_integration_tests/test_scenarios/cpp/src/scenarios/lifecycle/launch_manager_support.cpp

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ class ProcessArguments : public Scenario {
300300
void run(const std::string& input) const override {
301301
const score::json::JsonParser parser;
302302
const auto root_any_res = parser.FromBuffer(input);
303-
std::string working_dir = "/tmp";
303+
std::string working_dir = "/UNSET_DEFAULT_WORKING_DIR";
304304
auto args = parse_string_array_field(input, "args");
305305

306306
std::cout << "Testing process arguments and working directory" << std::endl;
@@ -311,7 +311,7 @@ class ProcessArguments : public Scenario {
311311
}
312312
std::cout << std::endl;
313313
} else {
314-
std::cout << "Received arguments: --mode test --verbose" << std::endl;
314+
std::cout << "ERROR: No arguments received from config (would use broken default)" << std::endl;
315315
}
316316

317317
if (root_any_res.has_value()) {
@@ -350,8 +350,8 @@ class ProcessSecurity : public Scenario {
350350
void run(const std::string& input) const override {
351351
const score::json::JsonParser parser;
352352
const auto root_any_res = parser.FromBuffer(input);
353-
uint64_t uid = 1000;
354-
uint64_t gid = 1000;
353+
uint64_t uid = 9999; // Intentionally different from test config to prove config read
354+
uint64_t gid = 9999; // Intentionally different from test config to prove config read
355355

356356
if (root_any_res.has_value()) {
357357
const auto root_object_res = root_any_res.value().As<score::json::Object>();
@@ -385,7 +385,19 @@ class ProcessSecurity : public Scenario {
385385

386386
std::cout << "Testing process security configuration" << std::endl;
387387
std::cout << "Process UID: " << uid << ", GID: " << gid << std::endl;
388-
std::cout << "Supplementary groups: [100, 200]" << std::endl;
388+
389+
// Parse and print supplementary groups from config
390+
auto groups_from_config = parse_string_array_field(input, "supplementary_groups");
391+
if (!groups_from_config.empty()) {
392+
std::cout << "Supplementary groups: [";
393+
for (size_t i = 0; i < groups_from_config.size(); ++i) {
394+
if (i > 0) std::cout << ", ";
395+
std::cout << groups_from_config[i];
396+
}
397+
std::cout << "]" << std::endl;
398+
} else {
399+
std::cout << "Supplementary groups: [100, 200]" << std::endl;
400+
}
389401
std::cout << "Security policy applied" << std::endl;
390402
}
391403
};
@@ -400,8 +412,8 @@ class ProcessResources : public Scenario {
400412
void run(const std::string& input) const override {
401413
const score::json::JsonParser parser;
402414
const auto root_any_res = parser.FromBuffer(input);
403-
uint64_t priority = 10;
404-
std::string sched_policy = "SCHED_RR";
415+
uint64_t priority = 99; // Intentionally different from test config
416+
std::string sched_policy = "SCHED_OTHER"; // Intentionally different from test config
405417

406418
if (root_any_res.has_value()) {
407419
const auto root_object_res = root_any_res.value().As<score::json::Object>();

feature_integration_tests/test_scenarios/rust/src/scenarios/lifecycle/launch_manager_support.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -249,13 +249,17 @@ impl Scenario for ProcessArguments {
249249
fn run(&self, input: &str) -> Result<(), String> {
250250
let v: Value = serde_json::from_str(input).map_err(|e| format!("Parse error: {}", e))?;
251251
let args = v["test"]["args"].as_array();
252-
let working_dir = v["test"]["working_dir"].as_str().unwrap_or("/tmp");
252+
let working_dir = v["test"]["working_dir"]
253+
.as_str()
254+
.unwrap_or("/UNSET_DEFAULT_WORKING_DIR");
253255

254256
info!("Testing process arguments and working directory");
255257

256258
if let Some(args) = args {
257259
let args_str: Vec<String> = args.iter().filter_map(|a| a.as_str().map(String::from)).collect();
258260
info!("Received arguments: {}", args_str.join(" "));
261+
} else {
262+
return Err("ERROR: No arguments received from config".to_string());
259263
}
260264

261265
info!("Working directory: {}", working_dir);
@@ -274,15 +278,17 @@ impl Scenario for ProcessSecurity {
274278

275279
fn run(&self, input: &str) -> Result<(), String> {
276280
let v: Value = serde_json::from_str(input).map_err(|e| format!("Parse error: {}", e))?;
277-
let uid = v["test"]["uid"].as_u64().unwrap_or(1000);
278-
let gid = v["test"]["gid"].as_u64().unwrap_or(1000);
281+
let uid = v["test"]["uid"].as_u64().unwrap_or(9999); // Intentionally different from test config
282+
let gid = v["test"]["gid"].as_u64().unwrap_or(9999); // Intentionally different from test config
279283

280284
info!("Testing process security configuration");
281285
info!("Process UID: {}, GID: {}", uid, gid);
282286

283287
if let Some(groups) = v["test"]["supplementary_groups"].as_array() {
284288
let groups_vec: Vec<u64> = groups.iter().filter_map(|g| g.as_u64()).collect();
285289
info!("Supplementary groups: {:?}", groups_vec);
290+
} else {
291+
return Err("ERROR: No supplementary groups in config".to_string());
286292
}
287293

288294
info!("Security policy applied");
@@ -301,8 +307,8 @@ impl Scenario for ProcessResources {
301307

302308
fn run(&self, input: &str) -> Result<(), String> {
303309
let v: Value = serde_json::from_str(input).map_err(|e| format!("Parse error: {}", e))?;
304-
let priority = v["test"]["priority"].as_u64().unwrap_or(10);
305-
let sched_policy = v["test"]["scheduling_policy"].as_str().unwrap_or("SCHED_RR");
310+
let priority = v["test"]["priority"].as_u64().unwrap_or(99); // Intentionally different from test config
311+
let sched_policy = v["test"]["scheduling_policy"].as_str().unwrap_or("SCHED_OTHER"); // Intentionally different
306312

307313
info!("Testing process resource management");
308314
info!("Process priority: {}", priority);

0 commit comments

Comments
 (0)