mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 18:47:20 +01:00
Layout move test: run the product loop; use the gate's prebuilt binary
A line is issued for the process at its endpoints, and a holder refuses a
line that names another process. The test minted the initial line from a
hand-ingested observation before the source started, so it named no
process and the source refused it ("issued for process <empty>"; source did
not serve). The test now runs the lifecycle product loop as blockmaster
does, which re-issues a line once the process reports itself (the initial
line, and a move's target). LAYOUT_MOVE_NO_PRODUCT_LOOP=1 leaves the loop
off and reproduces the refusal (the control). With SWBLOCK_TEST_BINS set
(a gate run) the test uses that prebuilt blockvolume instead of building a
race-enabled one, so the binary it runs is the one the gate hashed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d9c95a716a
commit
8fb26969d3
1 file changed
+33
-3
@@ -134,9 +134,16 @@ func TestIntegrationWorkspaceLayoutMove(t *testing.T) {
|
||||
if os.Getenv("CHUNKSTORE_WEED") == "" {
|
||||
t.Skip("CHUNKSTORE_WEED not set")
|
||||
}
|
||||
exe := filepath.Join(t.TempDir(), "blockvolume")
|
||||
if out, err := exec.Command("go", "build", "-race", "-p", "4", "-o", exe, ".").CombinedOutput(); err != nil {
|
||||
t.Fatalf("build: %v %s", err, out)
|
||||
// A gate run supplies its prebuilt, hashed binaries (SWBLOCK_TEST_BINS);
|
||||
// a local run builds a race-enabled one.
|
||||
exe := filepath.Join(os.Getenv("SWBLOCK_TEST_BINS"), "blockvolume")
|
||||
if os.Getenv("SWBLOCK_TEST_BINS") == "" {
|
||||
exe = filepath.Join(t.TempDir(), "blockvolume")
|
||||
if out, err := exec.Command("go", "build", "-race", "-p", "4", "-o", exe, ".").CombinedOutput(); err != nil {
|
||||
t.Fatalf("build: %v %s", err, out)
|
||||
}
|
||||
} else if _, err := os.Stat(exe); err != nil {
|
||||
t.Fatalf("SWBLOCK_TEST_BINS has no blockvolume: %v", err)
|
||||
}
|
||||
cluster := startWorkspaceWeed(t)
|
||||
for _, kind := range []string{"clean", "forced"} {
|
||||
@@ -170,6 +177,29 @@ func layoutMove(t *testing.T, exe string, cluster *w4WeedCluster, kind string) {
|
||||
defer c()
|
||||
_ = h.Close(ctx)
|
||||
})
|
||||
// The lifecycle product loop runs as blockmaster runs it
|
||||
// (--lifecycle-product-loop-interval): a line is issued for the process
|
||||
// at its endpoints, and a line minted before a process reported itself
|
||||
// (the initial one below, a move's target) is re-issued once it does.
|
||||
// LAYOUT_MOVE_NO_PRODUCT_LOOP=1 leaves it off: the source then refuses
|
||||
// the line that names no process and never serves (the control).
|
||||
if os.Getenv("LAYOUT_MOVE_NO_PRODUCT_LOOP") != "1" {
|
||||
stop, done := make(chan struct{}), make(chan struct{})
|
||||
go func() {
|
||||
defer close(done)
|
||||
tick := time.NewTicker(100 * time.Millisecond)
|
||||
defer tick.Stop()
|
||||
for {
|
||||
select {
|
||||
case <-stop:
|
||||
return
|
||||
case <-tick.C:
|
||||
_, _ = h.RunLifecycleProductTick()
|
||||
}
|
||||
}
|
||||
}()
|
||||
t.Cleanup(func() { close(stop); <-done })
|
||||
}
|
||||
src, dst := newMoveHost(t, "node-a", "nqn.2026-11.test:move-src-"+kind), newMoveHost(t, "node-b", "nqn.2026-11.test:move-dst-"+kind)
|
||||
// The master's create writes VOLUME and the unclaimed HEAD, then marks
|
||||
// the record store-ready; only a store-ready volume gets a placement.
|
||||
|
||||
Reference in new issue
Block a user