1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00

tests/refactor ~ use is_ci() for CI host platform testing

This commit is contained in:
Roy Ivy III 2020-06-13 21:51:59 -05:00
parent 407d455b12
commit d144182add
4 changed files with 9 additions and 24 deletions

View file

@ -13,10 +13,7 @@ fn test_normal() {
for (key, value) in env::vars() {
println!("{}: {}", key, value);
}
if env::var("USER").is_ok()
&& env::var("USER").unwrap() == "runner"
&& result.stderr.contains("failed to get username")
{
if is_ci() && result.stderr.contains("failed to get username") {
// In the CI, some server are failing to return whoami.
// As seems to be a configuration issue, ignoring it
return;
@ -35,10 +32,7 @@ fn test_normal_compare_id() {
println!("result.stdout = {}", result.stdout);
println!("result.stderr = {}", result.stderr);
if env::var("USER").is_ok()
&& env::var("USER").unwrap() == "runner"
&& result.stderr.contains("failed to get username")
{
if is_ci() && result.stderr.contains("failed to get username") {
// In the CI, some server are failing to return whoami.
// As seems to be a configuration issue, ignoring it
return;
@ -47,10 +41,7 @@ fn test_normal_compare_id() {
let ts = TestScenario::new("id");
let id = ts.cmd("id").arg("-un").run();
if env::var("USER").is_ok()
&& env::var("USER").unwrap() == "runner"
&& id.stderr.contains("cannot find name for user ID")
{
if is_ci() && id.stderr.contains("cannot find name for user ID") {
// In the CI, some server are failing to return whoami.
// As seems to be a configuration issue, ignoring it
return;