mirror of
https://github.com/openai/codex.git
synced 2026-11-18 22:20:48 +00:00
Fix marketplace source test regressions
This commit is contained in:
@@ -10,7 +10,8 @@ use tempfile::TempDir;
|
|||||||
use tokio::time::Duration;
|
use tokio::time::Duration;
|
||||||
use tokio::time::timeout;
|
use tokio::time::timeout;
|
||||||
|
|
||||||
const DEFAULT_TIMEOUT: Duration = Duration::from_secs(10);
|
const INIT_TIMEOUT: Duration = Duration::from_secs(30);
|
||||||
|
const REQUEST_TIMEOUT: Duration = Duration::from_secs(10);
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn marketplace_add_local_directory_source() -> Result<()> {
|
async fn marketplace_add_local_directory_source() -> Result<()> {
|
||||||
@@ -28,7 +29,7 @@ async fn marketplace_add_local_directory_source() -> Result<()> {
|
|||||||
)?;
|
)?;
|
||||||
std::fs::write(source.join("plugins/sample/marker.txt"), "local ref")?;
|
std::fs::write(source.join("plugins/sample/marker.txt"), "local ref")?;
|
||||||
let mut mcp = McpProcess::new(codex_home.path()).await?;
|
let mut mcp = McpProcess::new(codex_home.path()).await?;
|
||||||
timeout(DEFAULT_TIMEOUT, mcp.initialize()).await??;
|
timeout(INIT_TIMEOUT, mcp.initialize()).await??;
|
||||||
|
|
||||||
let request_id = mcp
|
let request_id = mcp
|
||||||
.send_marketplace_add_request(MarketplaceAddParams {
|
.send_marketplace_add_request(MarketplaceAddParams {
|
||||||
@@ -39,7 +40,7 @@ async fn marketplace_add_local_directory_source() -> Result<()> {
|
|||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
let response: JSONRPCResponse = timeout(
|
let response: JSONRPCResponse = timeout(
|
||||||
DEFAULT_TIMEOUT,
|
REQUEST_TIMEOUT,
|
||||||
mcp.read_stream_until_response_message(RequestId::Integer(request_id)),
|
mcp.read_stream_until_response_message(RequestId::Integer(request_id)),
|
||||||
)
|
)
|
||||||
.await??;
|
.await??;
|
||||||
|
|||||||
@@ -126,10 +126,10 @@ fn normalize_git_url(url: &str) -> String {
|
|||||||
fn looks_like_local_path(source: &str) -> bool {
|
fn looks_like_local_path(source: &str) -> bool {
|
||||||
source.starts_with("./")
|
source.starts_with("./")
|
||||||
|| source.starts_with("../")
|
|| source.starts_with("../")
|
||||||
|| source.starts_with('/')
|
|
||||||
|| source.starts_with("~/")
|
|| source.starts_with("~/")
|
||||||
|| source == "."
|
|| source == "."
|
||||||
|| source == ".."
|
|| source == ".."
|
||||||
|
|| Path::new(source).is_absolute()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn resolve_local_source_path(source: &str) -> Result<PathBuf, MarketplaceAddError> {
|
fn resolve_local_source_path(source: &str) -> Result<PathBuf, MarketplaceAddError> {
|
||||||
|
|||||||
@@ -3,4 +3,5 @@ load("//:defs.bzl", "codex_rust_crate")
|
|||||||
codex_rust_crate(
|
codex_rust_crate(
|
||||||
name = "sandbox-summary",
|
name = "sandbox-summary",
|
||||||
crate_name = "codex_utils_sandbox_summary",
|
crate_name = "codex_utils_sandbox_summary",
|
||||||
|
unit_test_timeout = "short",
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user