mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-10-16 11:08:39 +02:00
Phase 8 closes with all 6 checkpoints done (CP8-1 through CP8-5 + CP8-3-1): - CP8-5: 12/12 enterprise QA scenarios PASS on real hardware (m01/M02) - Master-authoritative lease grants (BUG-CP85-11): master renews primary write leases on every heartbeat response, replacing retain-until-confirmed assignment queue semantics that caused 30s lease expiry - Post-rebuild WAL shipping gap fix (BUG-CP85-1): syncLSNAfterRebuild advances replica nextLSN so WAL entries are accepted after rebuild - Block heartbeat startup race fix (BUG-CP85-10): dynamic blockService check on each tick instead of one-shot at loop start - 8 new tests: 4 engine lease grant + 4 registry lease grant - 13 new YAML scenarios: chaos (kill-loop, partition, disk-full), database integrity (sqlite crash, ext4 fsck), perf baseline, metrics verify, snapshot stress, expand-failover, session storm, role flap, 24h soak - 12 new testrunner actions (database, fsck, grep_log, write_loop_bg, stop_bg, assert_metric_gt/eq/lt) + phase repeat support - Docker compose setup + getting-started guide for block storage users - 960+ cumulative unit tests, 24 YAML scenarios Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
102 lines
2.4 KiB
Go
102 lines
2.4 KiB
Go
package actions
|
|
|
|
import (
|
|
"sort"
|
|
"testing"
|
|
|
|
tr "github.com/seaweedfs/seaweedfs/weed/storage/blockvol/testrunner"
|
|
)
|
|
|
|
func TestDevOpsActions_Registration(t *testing.T) {
|
|
registry := tr.NewRegistry()
|
|
RegisterDevOpsActions(registry)
|
|
|
|
expected := []string{
|
|
"build_deploy_weed",
|
|
"start_weed_master",
|
|
"start_weed_volume",
|
|
"stop_weed",
|
|
"wait_cluster_ready",
|
|
"create_block_volume",
|
|
"cluster_status",
|
|
}
|
|
|
|
for _, name := range expected {
|
|
if _, err := registry.Get(name); err != nil {
|
|
t.Errorf("action %q not registered: %v", name, err)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestDevOpsActions_Tier(t *testing.T) {
|
|
registry := tr.NewRegistry()
|
|
RegisterDevOpsActions(registry)
|
|
|
|
byTier := registry.ListByTier()
|
|
devopsActions := byTier[tr.TierDevOps]
|
|
|
|
if len(devopsActions) != 7 {
|
|
t.Errorf("devops tier has %d actions, want 7", len(devopsActions))
|
|
}
|
|
|
|
// Verify all are in devops tier.
|
|
sort.Strings(devopsActions)
|
|
for _, name := range devopsActions {
|
|
if tier := registry.ActionTier(name); tier != tr.TierDevOps {
|
|
t.Errorf("action %q has tier %q, want devops", name, tier)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestDevOpsActions_TierGating(t *testing.T) {
|
|
registry := tr.NewRegistry()
|
|
RegisterDevOpsActions(registry)
|
|
|
|
// Without gating, all should be accessible.
|
|
if _, err := registry.Get("start_weed_master"); err != nil {
|
|
t.Errorf("ungated: %v", err)
|
|
}
|
|
|
|
// Enable only core tier — devops should be blocked.
|
|
registry.EnableTiers([]string{tr.TierCore})
|
|
if _, err := registry.Get("start_weed_master"); err == nil {
|
|
t.Error("expected error when devops tier is disabled")
|
|
}
|
|
|
|
// Enable devops tier — should work again.
|
|
registry.EnableTiers([]string{tr.TierDevOps})
|
|
if _, err := registry.Get("start_weed_master"); err != nil {
|
|
t.Errorf("devops enabled: %v", err)
|
|
}
|
|
}
|
|
|
|
func TestAllActions_Registration(t *testing.T) {
|
|
registry := tr.NewRegistry()
|
|
RegisterAll(registry)
|
|
|
|
byTier := registry.ListByTier()
|
|
|
|
// Verify tier counts.
|
|
if n := len(byTier[tr.TierCore]); n != 8 {
|
|
t.Errorf("core: %d, want 8", n)
|
|
}
|
|
if n := len(byTier[tr.TierBlock]); n != 44 {
|
|
t.Errorf("block: %d, want 44", n)
|
|
}
|
|
if n := len(byTier[tr.TierDevOps]); n != 7 {
|
|
t.Errorf("devops: %d, want 7", n)
|
|
}
|
|
if n := len(byTier[tr.TierChaos]); n != 5 {
|
|
t.Errorf("chaos: %d, want 5", n)
|
|
}
|
|
|
|
// Total should be 64.
|
|
total := 0
|
|
for _, actions := range byTier {
|
|
total += len(actions)
|
|
}
|
|
if total != 64 {
|
|
t.Errorf("total actions: %d, want 64", total)
|
|
}
|
|
}
|