Files
seaweedfs/test/samba
490379bff3 Add codespell support with configuration and typo fixes (#10393)
* Add GitHub Actions workflow for codespell on master

* Add rudimentary codespell config

* Tune codespell config: skip generated code, ignore camelCase, whitelist domain terms

Add camelCase/PascalCase regex to ignore common Go/Rust/JS identifiers
like allLocations, publishErr, ReadInside, FlushInterval. Also skip
templ-generated *_templ.go files, and whitelist a handful of
short/domain-specific words (visibles, fo, te, ser, bject, unparseable,
keep-alives, tread, anc, ue) that show up as false positives across the
tree.

Co-Authored-By: Claude Code 2.1.217 / Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Fix ambiguous typos and protect false positives

Fixes typos that codespell reports with multiple candidate suggestions
(so `codespell -w` cannot auto-apply them), plus one inline pragma and
one config entry to protect legitimate identifiers.

Manual fixes (single correct answer chosen from context):
- pattens -> patterns (5x) in filer/upload/shell flag help strings
- finded  -> found (2x) in tarantool storage.lua comment
- spacify -> specify (2x) in helm chart values.yaml comment
- wether  -> whether in skiplist.go docstring
- simpe   -> simple in mq schema test case name

False-positive protection:
- Add `//codespell:ignore` next to `source GET's` (possessive of HTTP
  verb) in s3api_object_handlers_copy_stream.go
- Whitelist `auther` in .codespellrc — it's a local variable meaning
  "authenticator" in weed/security/tls.go, not a typo of "author".

Co-Authored-By: Claude Code 2.1.217 / Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Extend codespell ignore list: .git-meta path and thirdparty groupId

Also skip `.git-meta` (scratch dir for commit messages that may contain
typo words verbatim) and whitelist `thirdparty` — it appears as the
literal Maven groupId `org.apache.hadoop.thirdparty` in hdfs3 poms
and cannot be renamed.

Co-Authored-By: Claude Code 2.1.217 / Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* [DATALAD RUNCMD] Fix non-ambiguous typos with codespell -w

Auto-applied fixes to the 44 remaining single-suggestion typos across
docs, comments, log messages, tests, config, and one Java pom.

=== Do not change lines below ===
{
 "chain": [],
 "cmd": "uvx codespell -w",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^

* Revert breaking codespell fixes; whitelist unknwon and atleast

Two of the auto-applied `codespell -w` fixes were false positives that
would break the build/tests:

- go.mod: `github.com/unknwon/goconfig` is a real Go module path — the
  upstream author's GitHub handle is literally `unknwon`. Renaming to
  `unknown` would fail dependency resolution.
- test/benchmark/fuse_db/bin/{sqlite_verify.py,run_mysql.sh,run_sqlite.sh}:
  `atleast` is a literal CLI mode value (a string constant compared and
  passed as a positional argument). Rewriting to `at least` splits it
  into two arguments and breaks the mode check.

Reverted those files and whitelisted both words in .codespellrc so
future runs won't re-suggest the same broken fixes.

Co-Authored-By: Claude Code 2.1.217 / Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Code 2.1.217 / Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-07-22 14:38:06 -07:00
..

Samba on FUSE integration test

Exports a SeaweedFS FUSE mount over SMB with Samba's smbd and drives it with smbclient, verifying that SMB file operations work correctly on top of the mount and that data stays consistent across both protocols.

What it checks

The functional battery in smb_tests.sh covers:

  • connecting to the share and listing the root
  • 1 MiB upload/download round-trip with content verification
  • subdirectory creation and writes into it
  • file rename
  • 64 MiB upload/download (exercises SeaweedFS chunk splitting)
  • recursive upload of a directory tree
  • cross-protocol consistency: files written over SMB appear on the FUSE mount with identical content, and files written directly on the FUSE mount are readable over SMB
  • deleting files and directory trees

The locking / concurrency battery in lock_tests.sh covers the harder cases a network-filesystem backend has to get right:

  • POSIX fcntl byte-range locking on the FUSE mount: a held exclusive lock denies a conflicting lock, allows a non-overlapping range, and is reacquirable after release (exercises the mount's SetLk/GetLk)
  • Distributed locking (-dlm): a file held open for writing on one mount blocks a writer on a second mount until it is released
  • Distributed-lock integrity: concurrent writers to the same file from two mounts leave exactly one intact payload, never a torn mix
  • Concurrency: parallel writers to distinct files all succeed

Both FUSE mounts are started with -dlm (distributed lock manager). The second mount (/mnt/seaweedfs2) exists only to contend with the smbd-backed mount in the distributed-locking tests; both see the same filer path, so .../share is the same data on each.

Note on DLM semantics: -dlm coordinates write access (one mount writes a file at a time) and guarantees writes are not torn. It does not guarantee which concurrent writer wins or instant cross-mount read convergence — the holder's buffered data is flushed on close, asynchronously to lock release. When a holder closes the file, a writer on another mount acquires the freed lock within ~1s and completes.

Layout

File Purpose
smb_tests.sh SMB functional battery. Shared by both runners.
lock_tests.sh SMB locking / concurrency battery. Shared by both runners.
smb.conf.template Samba config; placeholders are filled in at run time.
run.sh Local runner: weed mini + two -dlm mounts + smbd + both batteries, all as the current user on unprivileged ports.
entrypoint.sh Container entrypoint: starts two -dlm FUSE mounts and runs smbd.
run_inside_container.sh Runs both batteries inside the container against the local smbd.
Dockerfile Adds Samba to the chrislusf/seaweedfs:e2e image.
docker-compose.yml master + volume + filer + samba services.

Running locally

Requirements: weed on $PATH, fusermount3, and Samba's smbd / smbclient / smbpasswd (Debian/Ubuntu: apt-get install samba smbclient).

test/samba/run.sh

No sudo is needed: smbd runs as the current user on port 4450 and all state lives under a temp work dir that is cleaned up on exit.

Running with Docker

Mirrors the CI job. Requires /dev/fuse and SYS_ADMIN (provided in the compose file).

# build the base e2e image first (from the repo's docker/ dir)
docker compose -f test/samba/docker-compose.yml up --wait
docker compose -f test/samba/docker-compose.yml exec -T samba /run_inside_container.sh
docker compose -f test/samba/docker-compose.yml down -v

CI

.github/workflows/samba-integration.yml runs on changes to weed/mount/**, weed/filer/**, or test/samba/**. It builds the e2e image, builds the Samba harness image on top, brings up the cluster, runs the battery, and uploads server logs as artifacts.

Notes

  • The share disables Samba's DOS-attribute / xattr mapping and oplocks. The SeaweedFS FUSE mount does not implement that surface, and leaving it on produces NT_STATUS_NOT_SUPPORTED errors unrelated to data integrity.
  • The share path is a subdirectory of the mount (.../share) so the runner can verify SMB-side operations directly on the FUSE side.