Files
seaweedfs/seaweed-block/testops/README.md
T
Ping QiuandClaude Opus 5.5 e17e30b4aa seaweed-block: keep only the runner scenarios this tree uses (#13418)
Removes lab-only runner scenarios and suites from seaweed-block/, keeps the scenarios this tree's CI uses with environment placeholders, and guards every artifact-root use before any cleanup. Includes the maintainer's follow-ups from #13419 and #13423.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-05 03:20:55 -08:00

73 lines
4.0 KiB
Markdown

# TestOps scenarios
This directory holds runner scenarios for the `swblock` binary of `sw-test-runner`.
The product owns the test intent: which scripts represent a gate, what each
artifact proves, and what cleanup must hold. The runner owns orchestration:
target cleanup, command execution, run-bundle layout and artifact collection.
The scenarios kept here are the ones this repository's tests or scripts use:
`cmd/blockcsi/g15d_manifest_test.go` checks the contents of some of them, and
scripts under `scripts/` run others.
## Running a scenario
`swblock` is built from the runner's source (`go build -o swblock ./cmd/swblock`),
not from this repository. Check a scenario before running it:
```bash
swblock validate testops/scenarios/nvme-p5-protocol-component-gate.yaml
```
Apart from `helm-multi-volume-rf3-app-spread-failover-chain.yaml`, which still targets
the project's lab, no scenario names a host, user, key or share. Each one reads them
from its `env` block, where they are empty, so set every one on the command line:
| Setting | Meaning |
| --- | --- |
| `product_root` | this repository's checkout on the test node |
| `node_host` | address of the test node |
| `node_user` | ssh user on the test node |
| `ssh_key` | private key for `node_user`, on the controller |
| `artifact_root` | shared directory for run artifacts, as the test node sees it; an absolute path other than `/` using only `A-Za-z0-9._/-` |
| `import_nodes` | every other k3s node, for the image import (`nvme-tcp-status-surface-evidence-chain`, `nvme-tcp-cross-node-multivolume-lifecycle-soak-chain`); without it only the test node gets the images |
| `node_ssh_key` | key path on the test node for the image import (those two chains and `node-loss-survival-rf3-reattach-chain`) |
```bash
swblock run \
-env product_root=/path/to/seaweed-block \
-env node_host=192.0.2.10 \
-env node_user=tester \
-env ssh_key=/path/to/key \
-env artifact_root=/path/to/shared/artifacts \
testops/scenarios/nvme-p5-protocol-component-gate.yaml
```
Destructive and artifact-dependent always actions validate the root independently,
before cleanup starts. The value reaches the guard through the runner's quoted
`env.SW_BLOCK_ARTIFACT_ROOT` parameter, rather than being rendered into shell
syntax. This also protects a direct `swblock run` when an earlier phase fails.
Uninstall refuses cleanup if its artifact directory cannot be created.
Check every complete guard/action copy locally, with cleanup stubs and no cluster:
`bash scripts/testops-artifact-root-guard-test.sh` (requires Go on a POSIX system).
## Which gate to run
Use the smallest gate that proves the contract you changed.
| Change type | Gate |
| --- | --- |
| Package-local logic, parser, renderer, state-machine helper | `go test -count=1 ./<touched-package>` |
| CSI protocol propagation, lifecycle persistence, launcher render shape | `nvme-p5-protocol-component-gate` |
| Kernel initiator, k3s, mounted filesystem, failover or stale-session behaviour | the matching chain, for example `nvme-p5-csi-protocol-chain`, `nvme-p4-multipath-failover-chain` or `iscsi-p6-alua-failover-chain` |
**Node loss (`node-loss-survival-rf3-reattach-chain`).** This release claims no automatic promotion on node loss:
the gate cordons the primary's node and stops it, requires that no other replica is promoted during the hold
(`auto_promotion_while_node_lost=none`), then returns the node and requires the same primary to serve the same
data. Manual failover (a `SwBlockReplicaFailback` handled by the failback executor, which calls blockmaster's admin
`ExecuteFailback`) is covered by the existing tests: `TestFailbackExecutorGRPCRuntimeUsesRealMasterService`,
`TestFailbackServiceEnabledUsesHostRuntime`, `TestHostFailbackAuthorityRuntimeUsesLivePublisher`
(`core/host/master/failback_runtime_test.go`), `TestFailbackAuthorityRuntimeAdapterRejectsStaleExpectedCurrent`
(`core/ops/failback_authority_runtime_adapter_test.go`) and `TestFailbackExecutorInvokesRuntimeWhenExplicitlyEnabled`
(`core/ops/failback_executor_controller_test.go`).