diff --git a/test/integration-test/src/tests/iter.rs b/test/integration-test/src/tests/iter.rs index 3325ad2e4..388656a10 100644 --- a/test/integration-test/src/tests/iter.rs +++ b/test/integration-test/src/tests/iter.rs @@ -1,4 +1,4 @@ -use std::io::BufRead; +use std::{env, io::BufRead, path::Path}; use aya::{programs::Iter, Btf, Ebpf}; use test_log::test; @@ -20,11 +20,15 @@ fn iter_task() { let line_init = lines.next().unwrap().unwrap(); assert_eq!(line_title, "tgid pid name"); - let expected_values = ["1 1 init", "1 1 systemd"]; - assert!( - expected_values.contains(&line_init.as_str()), - "Unexpected line_init value: '{}', expected one of: {:?}", - line_init, - expected_values - ); + // It's hard to predict what's the PID of the first process in a container. + // Use this assertion only on non-containerized systems. + if !Path::new("/.dockerenv").exists() && env::var_os("container").is_none() { + let expected_values = ["1 1 init", "1 1 systemd"]; + assert!( + expected_values.contains(&line_init.as_str()), + "Unexpected line_init value: '{}', expected one of: {:?}", + line_init, + expected_values + ); + } }