mirror of
https://github.com/openai/codex.git
synced 2026-10-21 21:06:49 +00:00
Isolate apply-patch permission test variants (#36138)
## What changed - Run the strict auto-review enabled and disabled scenarios as separate test cases on a two-thread Tokio runtime. - Explicitly shut down each Codex instance after verifying that the approved folder grant allows the later `apply_patch` call. GitOrigin-RevId: cbbf47d834c4a9adcf181b97b8aa72b5f0a513e2
This commit is contained in:
@@ -38,6 +38,7 @@ use serde_json::Value;
|
||||
use serde_json::json;
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
use test_case::test_case;
|
||||
|
||||
fn absolute_path(path: &Path) -> AbsolutePathBuf {
|
||||
AbsolutePathBuf::try_from(path).expect("absolute path")
|
||||
@@ -328,16 +329,17 @@ async fn approved_folder_write_request_permissions_unblocks_later_exec_without_s
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "current_thread")]
|
||||
#[test_case(false ; "without_strict_auto_review")]
|
||||
#[test_case(true ; "with_strict_auto_review")]
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
#[cfg(target_os = "macos")]
|
||||
async fn approved_folder_write_request_permissions_unblocks_later_apply_patch() -> Result<()> {
|
||||
async fn approved_folder_write_request_permissions_unblocks_later_apply_patch(
|
||||
strict_auto_review: bool,
|
||||
) -> Result<()> {
|
||||
skip_if_no_network!(Ok(()));
|
||||
skip_if_sandbox!(Ok(()));
|
||||
|
||||
apply_patch_after_request_permissions(/*strict_auto_review*/ false).await?;
|
||||
apply_patch_after_request_permissions(/*strict_auto_review*/ true).await?;
|
||||
|
||||
Ok(())
|
||||
apply_patch_after_request_permissions(strict_auto_review).await
|
||||
}
|
||||
|
||||
async fn apply_patch_after_request_permissions(strict_auto_review: bool) -> Result<()> {
|
||||
@@ -510,5 +512,7 @@ async fn apply_patch_after_request_permissions(strict_auto_review: bool) -> Resu
|
||||
format!("{patch_content}\n")
|
||||
);
|
||||
|
||||
test.codex.shutdown_and_wait().await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user