fix(cubefs): round-trip full record envelope through DaemonBackend + gate hardening
- DaemonBackend::put/get now round-trip the FULL record envelope (header+body) verbatim via rawput/rawget instead of stripping to a bare body. Before this, a socket-backed mount wrote the bare body but get returned it as if it were a record, breaking the FUSE read-back path (get_record could not decode it). This diverged from the in-memory backend and silently corrupted reads. - Cargo fmt --check now passes (was failing; the committed tree was never a clean ./check, which is why the durable mount could regress undetected). - Fix two new clippy lints (manual_is_multiple_of) in cubefs/backend.rs and cubesys/commands.rs so the -D warnings gate is green. - Daemon-backed integration tests (cubefs_daemon_smoke, daemon_backend_smoke) now use the real CubeStore<DaemonBackend> record path and are #[ignore]d so the default gate (no daemon) stays green, while ./check daemon spins up a live cube-server and runs them via --ignored. This makes the durable-socket contract an actual enforced test, not a manual ad-hoc script.
This commit is contained in:
@@ -46,15 +46,44 @@ cargo test --workspace $FEAT --jobs "$JOBS"
|
||||
step "3/3 clippy"
|
||||
cargo clippy --workspace --all-targets $FEAT --jobs "$JOBS" -- -D warnings
|
||||
|
||||
[ "${1:-}" = mount ] && { run_mount=1; }
|
||||
[ "${1:-}" = bench ] && { run_bench=1; }
|
||||
[ "${1:-}" = mount ] && { run_mount=1; }
|
||||
[ "${1:-}" = bench ] && { run_bench=1; }
|
||||
[ "${1:-}" = stress ] && { run_stress=1; }
|
||||
[ "${1:-}" = daemon ] && { run_daemon=1; }
|
||||
|
||||
[ -z "${run_mount:-}${run_bench:-}${run_stress:-}" ] && {
|
||||
printf '\n\033[32mALL CHECKS PASSED\033[0m (run: ./check mount | bench | stress for those stages)\n'
|
||||
[ -z "${run_mount:-}${run_bench:-}${run_stress:-}${run_daemon:-}" ] && {
|
||||
printf '\n\033[32mALL CHECKS PASSED\033[0m (run: ./check mount | bench | stress | daemon for those stages)\n'
|
||||
exit 0
|
||||
}
|
||||
|
||||
if [ "${run_daemon:-}" ]; then
|
||||
step "4/4 daemon-backed integration tests (live cube-server)"
|
||||
# Spin up a real daemon on a temp socket/store, then run the `#[ignore]`d
|
||||
# tests that require CUBE_SOCK. Tears the daemon down afterwards.
|
||||
DSOCK=$(mktemp -u /tmp/cube-check-daemon.XXXXXX.sock)
|
||||
DDIR=$(mktemp -d /tmp/cube-check-daemon.XXXXXX)
|
||||
DSTORE=$DDIR/cube-store.json
|
||||
./target/debug/cube-server --socket "$DSOCK" --store "$DSTORE" \
|
||||
--allow-anonymous --checkpoint-ms 400 --wal-fsync-ms 30 \
|
||||
>/tmp/cube-check-daemon.log 2>&1 &
|
||||
DPID=$!
|
||||
for i in $(seq 1 30); do [ -S "$DSOCK" ] && break; sleep 0.3; done
|
||||
if [ ! -S "$DSOCK" ]; then
|
||||
echo "DAEMON FAILED to start:"; cat /tmp/cube-check-daemon.log
|
||||
exit 1
|
||||
fi
|
||||
export CUBE_SOCK="$DSOCK"
|
||||
cargo test -p cubefs --features cubefs/mount \
|
||||
--test cubefs_daemon_smoke --test daemon_backend_smoke \
|
||||
-- --ignored --nocapture
|
||||
RC=$?
|
||||
kill -9 "$DPID" 2>/dev/null || true
|
||||
rm -rf "$DDIR" 2>/dev/null || true
|
||||
[ "$RC" -eq 0 ] || exit "$RC"
|
||||
printf '\n\033[32mALL CHECKS PASSED\033[0m (incl. daemon-backed tests)\n'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "${run_bench:-}" ]; then
|
||||
step "4/4 cube-bench"
|
||||
# Release build + timed run. Asserts correctness on every path; numbers are
|
||||
|
||||
Reference in New Issue
Block a user