1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-22 15:06:54 -05:00

chore(integration_tests): stop collecting unnecessary output in permissions tests (#5926)

This commit is contained in:
uki00a 2020-05-29 08:40:33 +09:00 committed by GitHub
parent fadd93b454
commit 55311c33c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1862,14 +1862,17 @@ fn cafile_bundle_remote_exports() {
#[test]
fn test_permissions_with_allow() {
for permission in &util::PERMISSION_VARIANTS {
let (_, err) = util::run_and_collect_output(
true,
&format!("run --allow-{0} permission_test.ts {0}Required", permission),
None,
None,
false,
);
assert!(!err.contains(util::PERMISSION_DENIED_PATTERN));
let status = util::deno_cmd()
.current_dir(&util::tests_path())
.arg("run")
.arg(format!("--allow-{0}", permission))
.arg("permission_test.ts")
.arg(format!("{0}Required", permission))
.spawn()
.unwrap()
.wait()
.unwrap();
assert!(status.success());
}
}
@ -1891,19 +1894,22 @@ fn test_permissions_without_allow() {
fn test_permissions_rw_inside_project_dir() {
const PERMISSION_VARIANTS: [&str; 2] = ["read", "write"];
for permission in &PERMISSION_VARIANTS {
let (_, err) = util::run_and_collect_output(
true,
&format!(
"run --allow-{0}={1} complex_permissions_test.ts {0} {2} {2}",
let status = util::deno_cmd()
.current_dir(&util::tests_path())
.arg("run")
.arg(format!(
"--allow-{0}={1}",
permission,
util::root_path().into_os_string().into_string().unwrap(),
"complex_permissions_test.ts"
),
None,
None,
false,
);
assert!(!err.contains(util::PERMISSION_DENIED_PATTERN));
util::root_path().into_os_string().into_string().unwrap()
))
.arg("complex_permissions_test.ts")
.arg(permission)
.arg("complex_permissions_test.ts")
.spawn()
.unwrap()
.wait()
.unwrap();
assert!(status.success());
}
}
@ -1940,24 +1946,27 @@ fn test_permissions_rw_outside_test_dir() {
fn test_permissions_rw_inside_test_dir() {
const PERMISSION_VARIANTS: [&str; 2] = ["read", "write"];
for permission in &PERMISSION_VARIANTS {
let (_, err) = util::run_and_collect_output(
true,
&format!(
"run --allow-{0}={1} complex_permissions_test.ts {0} {2}",
let status = util::deno_cmd()
.current_dir(&util::tests_path())
.arg("run")
.arg(format!(
"--allow-{0}={1}",
permission,
util::root_path()
.join("cli")
.join("tests")
.into_os_string()
.into_string()
.unwrap(),
"complex_permissions_test.ts"
),
None,
None,
false,
);
assert!(!err.contains(util::PERMISSION_DENIED_PATTERN));
.unwrap()
))
.arg("complex_permissions_test.ts")
.arg(permission)
.arg("complex_permissions_test.ts")
.spawn()
.unwrap()
.wait()
.unwrap();
assert!(status.success());
}
}
@ -2012,17 +2021,18 @@ fn test_permissions_rw_inside_test_and_js_dir() {
.into_string()
.unwrap();
for permission in &PERMISSION_VARIANTS {
let (_, err) = util::run_and_collect_output(
true,
&format!(
"run --allow-{0}={1},{2} complex_permissions_test.ts {0} {3}",
permission, test_dir, js_dir, "complex_permissions_test.ts"
),
None,
None,
false,
);
assert!(!err.contains(util::PERMISSION_DENIED_PATTERN));
let status = util::deno_cmd()
.current_dir(&util::tests_path())
.arg("run")
.arg(format!("--allow-{0}={1},{2}", permission, test_dir, js_dir))
.arg("complex_permissions_test.ts")
.arg(permission)
.arg("complex_permissions_test.ts")
.spawn()
.unwrap()
.wait()
.unwrap();
assert!(status.success());
}
}
@ -2030,17 +2040,18 @@ fn test_permissions_rw_inside_test_and_js_dir() {
fn test_permissions_rw_relative() {
const PERMISSION_VARIANTS: [&str; 2] = ["read", "write"];
for permission in &PERMISSION_VARIANTS {
let (_, err) = util::run_and_collect_output(
true,
&format!(
"run --allow-{0}=. complex_permissions_test.ts {0} complex_permissions_test.ts",
permission
),
None,
None,
false,
);
assert!(!err.contains(util::PERMISSION_DENIED_PATTERN));
let status = util::deno_cmd()
.current_dir(&util::tests_path())
.arg("run")
.arg(format!("--allow-{0}=.", permission))
.arg("complex_permissions_test.ts")
.arg(permission)
.arg("complex_permissions_test.ts")
.spawn()
.unwrap()
.wait()
.unwrap();
assert!(status.success());
}
}
@ -2048,17 +2059,18 @@ fn test_permissions_rw_relative() {
fn test_permissions_rw_no_prefix() {
const PERMISSION_VARIANTS: [&str; 2] = ["read", "write"];
for permission in &PERMISSION_VARIANTS {
let (_, err) = util::run_and_collect_output(
true,
&format!(
"run --allow-{0}=tls/../ complex_permissions_test.ts {0} complex_permissions_test.ts",
permission
),
None,
None,
false,
);
assert!(!err.contains(util::PERMISSION_DENIED_PATTERN));
let status = util::deno_cmd()
.current_dir(&util::tests_path())
.arg("run")
.arg(format!("--allow-{0}=tls/../", permission))
.arg("complex_permissions_test.ts")
.arg(permission)
.arg("complex_permissions_test.ts")
.spawn()
.unwrap()
.wait()
.unwrap();
assert!(status.success());
}
}