This is an automated email from the ASF dual-hosted git repository. Xuanwo pushed a commit to branch xuanwo/pr-7999-path-contract in repository https://gitbox.apache.org/repos/asf/opendal.git
commit a0c00fdd3cbfcfdbc4622a119543acdcd9e728ab Author: Xuanwo <[email protected]> AuthorDate: Sat Oct 31 08:13:03 2026 +0800 test: compare deleter path resolution with ordinary delete --- core/tests/deleter_path_contract.rs | 49 +++++++++++++++++++++++++++++++++++++ dev/pr_review_7999_paths.sh | 32 ++++++++++++++++++++++++ 2 files changed, 81 insertions(+) diff --git a/core/tests/deleter_path_contract.rs b/core/tests/deleter_path_contract.rs new file mode 100644 index 000000000..8486d50af --- /dev/null +++ b/core/tests/deleter_path_contract.rs @@ -0,0 +1,49 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use std::fs; + +use opendal::Operator; +use opendal::services::Fs; + +#[tokio::test] +async fn deleter_normalizes_like_operator_delete() { + let root = std::env::temp_dir().join(format!("opendal-7999-path-{}", uuid::Uuid::new_v4())); + fs::create_dir(&root).unwrap(); + let target = root.join("a.txt"); + let spaced = root.join(" a.txt "); + fs::write(&target, b"target").unwrap(); + fs::write(&spaced, b"unrelated sentinel").unwrap(); + let op = Operator::new(Fs::default().root(root.to_str().unwrap())).unwrap(); + + op.delete(" a.txt ").await.unwrap(); + let operator_observed = (target.exists(), spaced.exists()); + assert_eq!(operator_observed, (false, true)); + + fs::write(&target, b"target").unwrap(); + let mut deleter = op.deleter().await.unwrap(); + deleter.delete(" a.txt ").await.unwrap(); + deleter.close().await.unwrap(); + let deleter_observed = (target.exists(), spaced.exists()); + println!("PATH_CONTRACT_OBSERVED operator={operator_observed:?} deleter={deleter_observed:?}"); + fs::remove_dir_all(&root).unwrap(); + + assert_eq!( + deleter_observed, operator_observed, + "Deleter must normalize exactly like Operator::delete" + ); +} diff --git a/dev/pr_review_7999_paths.sh b/dev/pr_review_7999_paths.sh new file mode 100644 index 000000000..b13944bf4 --- /dev/null +++ b/dev/pr_review_7999_paths.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +set -euo pipefail +probe_worktree=$1 +probe_logs=$2 +probe_sha=$3 +mkdir -p "$probe_logs" +exec >"$probe_logs/runner.log" 2>&1 +finish() { + probe_status=$? + printf '%s\n' "$probe_status" > "$probe_logs/done.status" +} +trap finish EXIT +export PATH="$HOME/.cargo/bin:$PATH" +export CARGO_BUILD_JOBS=4 +exec 9>/tmp/opendal-pr-delivery-20261031-build.lock +flock 9 +cd "$probe_worktree" +test -z "$(git status --porcelain)" +test "$(git rev-parse HEAD)" = "$probe_sha" +git rev-parse HEAD +rustc --version +cd core +set +e +cargo test -p opendal --features services-fs --test deleter_path_contract -- --nocapture > "$probe_logs/probe.log" 2>&1 +probe_actual=$? +set -e +printf '%s\n' "$probe_actual" > "$probe_logs/probe.status" +test "$probe_actual" -eq 101 +rg -q 'test result: FAILED. 0 passed; 1 failed' "$probe_logs/probe.log" +rg -Fq 'PATH_CONTRACT_OBSERVED operator=(false, true) deleter=(true, false)' "$probe_logs/probe.log" +rg -Fq 'Deleter must normalize exactly like Operator::delete' "$probe_logs/probe.log" +printf 'Expected negative real-Fs comparison completed; no patch was applied.\n'
