Files
Sebastian UnterschützandClaude Opus 5.5 907d400765 feat: remove cephmig snapshots during sync and add cleanup command
Users of a subvolume should not see traces of the migration. Each sync
round now deletes the older cephmig-* round snapshots at source and
target and keeps only the newest one as base for the next round. The new
command `cephmig cleanup` deletes the remaining one after the cutover.
Application snapshots are never touched.

The journal marks a snapshot as removed before deleting it, so an
interrupted run finishes the deletion instead of reporting a vanished
snapshot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 19:52:13 +01:00

34 lines
952 B
Go

package main
import (
"bytes"
"context"
"strings"
"testing"
)
func TestCLIRejectsFinalizationWithoutWriterStop(t *testing.T) {
var out, log bytes.Buffer
err := run(context.Background(), []string{"finalize", "--config", "../../dev/migration.example.json", "--state", "/tmp/unused-state"}, &out, &log)
if err == nil || !strings.Contains(err.Error(), "--writers-stopped") {
t.Fatalf("got %v", err)
}
}
func TestCLIUsage(t *testing.T) {
var out, log bytes.Buffer
if err := run(context.Background(), []string{"--help"}, &out, &log); err != nil {
t.Fatal(err)
}
if !strings.Contains(out.String(), "finalize") {
t.Fatal("help missing")
}
for _, args := range [][]string{nil, {"unknown"}, {"sync"}, {"status"}, {"cleanup"}, {"cleanup", "--config", "../../dev/migration.example.json"}, {"sync", "--config", "x", "extra"}} {
if err := run(context.Background(), args, &out, &log); err == nil {
t.Fatalf("accepted %v", args)
}
}
}