test, master: configure assignment producers in lifecycle fixtures

This commit is contained in:
pingqiu committed 2026-11-28 16:16:53 -08:00
1 parent 0d90833404
commit 0a996cacc2
18 files changed
+22 -21

No files matched your search

@@ -309,6 +309,7 @@ func startHandoffEnvOnCluster(t *testing.T, n int, targets []string, tlsNotAfter
env.masterArgs = append([]string{
"--authority-store", filepath.Join(mstate, "authority"), "--lifecycle-store", filepath.Join(mstate, "lifecycle"),
"--cluster-spec", spec, "--expected-slots-per-volume", "1", "--listen", h.masterAddr,
"--lifecycle-product-loop-interval", "100ms",
"--workspace-rpc"}, masterArgs...)
env.masterArgs = append(env.masterArgs, "--chunk-filer", cluster.filerGRPC, "--chunk-path", chunkPath)
master := h.start(t, "blockmaster", h.master, env.masterArgs...)
@@ -155,7 +155,7 @@ func layoutMove(t *testing.T, exe string, cluster *w4WeedCluster, kind string) {
t.Fatal(err)
}
h, err = master.New(master.Config{AuthorityStoreDir: t.TempDir(), LifecycleStoreDir: t.TempDir(), Listen: "127.0.0.1:0",
WorkspaceRPC: true, WorkspaceHeadReader: reader, WorkspaceMaxClockSkew: 100 * time.Millisecond,
WorkspaceRPC: true, LifecycleProductLoop: true, WorkspaceHeadReader: reader, WorkspaceMaxClockSkew: 100 * time.Millisecond,
LayoutCreateVolume: layoutMasterWriter(t, cluster, base)})
if err != nil {
t.Fatal(err)
@@ -170,7 +170,7 @@ func TestBinaryWorkspaceLeaseOptInOwnsCLEANShutdown(t *testing.T) {
if err != nil {
t.Fatal(err)
}
h, err = master.New(master.Config{AuthorityStoreDir: t.TempDir(), LifecycleStoreDir: t.TempDir(), Listen: "127.0.0.1:0", WorkspaceRPC: enabled, WorkspaceHeadReader: reader,
h, err = master.New(master.Config{AuthorityStoreDir: t.TempDir(), LifecycleStoreDir: t.TempDir(), Listen: "127.0.0.1:0", WorkspaceRPC: enabled, LifecycleProductLoop: true, WorkspaceHeadReader: reader,
LayoutCreateVolume: layoutMasterWriter(t, cluster, base)})
if err != nil {
t.Fatal(err)
@@ -50,7 +50,7 @@ func startAuthMaster(t *testing.T) authMaster {
}
authn := auth.NewAuthenticator(table, nil)
authn.SetAudit(auth.NewAuditLog(io.Discard, nil)) // strict calls need an audit log
h, err := New(Config{Listen: "127.0.0.1:0", AuthorityStoreDir: t.TempDir(), LifecycleStoreDir: t.TempDir(), WorkspaceRPC: true, LayoutCreateVolume: testLayoutCreateVolume,
h, err := New(Config{Listen: "127.0.0.1:0", AuthorityStoreDir: t.TempDir(), LifecycleStoreDir: t.TempDir(), WorkspaceRPC: true, LifecycleProductLoop: true, LayoutCreateVolume: testLayoutCreateVolume,
WorkspaceHeadReader: func(context.Context, string) (authority.WorkspaceHead, error) {
return authority.WorkspaceHead{Gen: 2, Epoch: 1, Holder: "node-a/r1"}, nil
},
@@ -46,7 +46,7 @@ func newIsolationRig(t *testing.T, strict bool, authorityDir, lifecycleDir strin
func startIsolationRig(t *testing.T, strict bool, authorityDir, lifecycleDir string, self *storeident.Identity) *isolationRig {
t.Helper()
logs := &syncBuffer{}
m, err := New(Config{Listen: "127.0.0.1:0", AuthorityStoreDir: authorityDir, LifecycleStoreDir: lifecycleDir, WorkspaceRPC: true, LayoutCreateVolume: testLayoutCreateVolume,
m, err := New(Config{Listen: "127.0.0.1:0", AuthorityStoreDir: authorityDir, LifecycleStoreDir: lifecycleDir, WorkspaceRPC: true, LifecycleProductLoop: true, LayoutCreateVolume: testLayoutCreateVolume,
StrictJournalIsolation: strict, Logger: log.New(logs, "", 0),
WorkspaceHeadReader: func(context.Context, string) (authority.WorkspaceHead, error) {
return authority.WorkspaceHead{Gen: 9, Epoch: 1, Holder: "node-a/r1", RemoteLSN: 42, Detached: true}, nil
@@ -21,7 +21,7 @@ import (
// or one chunk (4 MiB) more with InvalidArgument naming the maximum; a
// refused id gets no record.
func TestCreateVolumeRefusesAVolumeAboveTheMaximum(t *testing.T) {
m, err := New(Config{Listen: "127.0.0.1:0", AuthorityStoreDir: t.TempDir(), LifecycleStoreDir: t.TempDir(), WorkspaceRPC: true, LayoutCreateVolume: testLayoutCreateVolume,
m, err := New(Config{Listen: "127.0.0.1:0", AuthorityStoreDir: t.TempDir(), LifecycleStoreDir: t.TempDir(), WorkspaceRPC: true, LifecycleProductLoop: true, LayoutCreateVolume: testLayoutCreateVolume,
WorkspaceHeadReader: func(context.Context, string) (authority.WorkspaceHead, error) { return authority.WorkspaceHead{}, nil }})
if err != nil {
t.Fatal(err)
@@ -42,7 +42,7 @@ func TestRF1RuntimeLineNamingNoProcessIsReissued(t *testing.T) {
// the same addresses and must be re-issued the line.
func rf1ReissueCase(t *testing.T, first string) {
t.Helper()
h, err := New(Config{Listen: "127.0.0.1:0", AuthorityStoreDir: t.TempDir(), LifecycleStoreDir: t.TempDir(), WorkspaceRPC: true, LayoutCreateVolume: testLayoutCreateVolume, WorkspaceHeadReader: func(context.Context, string) (authority.WorkspaceHead, error) { return authority.WorkspaceHead{}, nil }})
h, err := New(Config{Listen: "127.0.0.1:0", AuthorityStoreDir: t.TempDir(), LifecycleStoreDir: t.TempDir(), WorkspaceRPC: true, LifecycleProductLoop: true, LayoutCreateVolume: testLayoutCreateVolume, WorkspaceHeadReader: func(context.Context, string) (authority.WorkspaceHead, error) { return authority.WorkspaceHead{}, nil }})
if err != nil {
t.Fatal(err)
}
@@ -125,7 +125,7 @@ func rf1ReissueCase(t *testing.T, first string) {
// line stays the target's, at the move's epoch.
func TestRF1RefreshDecidedBeforeACrossHostMoveIsNotApplied(t *testing.T) {
head := authority.WorkspaceHead{Gen: 9, Epoch: 1, Holder: "node-a/r1", RemoteLSN: 1, Detached: true}
h, err := New(Config{Listen: "127.0.0.1:0", AuthorityStoreDir: t.TempDir(), LifecycleStoreDir: t.TempDir(), WorkspaceRPC: true, LayoutCreateVolume: testLayoutCreateVolume,
h, err := New(Config{Listen: "127.0.0.1:0", AuthorityStoreDir: t.TempDir(), LifecycleStoreDir: t.TempDir(), WorkspaceRPC: true, LifecycleProductLoop: true, LayoutCreateVolume: testLayoutCreateVolume,
WorkspaceHeadReader: func(context.Context, string) (authority.WorkspaceHead, error) { return head, nil }})
if err != nil {
t.Fatal(err)
@@ -27,7 +27,7 @@ import (
// holder; the old host, still reporting the replica id with a newer observation, wins none of them.
func TestDisplayedPrimaryIsTheIssuedHolderNotThePlacementSlot(t *testing.T) {
heads := map[string]authority.WorkspaceHead{"a2": {Gen: 9, Epoch: 1, Holder: "node-b/r1", RemoteLSN: 42, Detached: true}}
m, err := New(Config{Listen: "127.0.0.1:0", AuthorityStoreDir: t.TempDir(), LifecycleStoreDir: t.TempDir(), WorkspaceRPC: true, LayoutCreateVolume: testLayoutCreateVolume,
m, err := New(Config{Listen: "127.0.0.1:0", AuthorityStoreDir: t.TempDir(), LifecycleStoreDir: t.TempDir(), WorkspaceRPC: true, LifecycleProductLoop: true, LayoutCreateVolume: testLayoutCreateVolume,
WorkspaceHeadReader: func(_ context.Context, v string) (authority.WorkspaceHead, error) { return heads[v], nil }})
if err != nil {
t.Fatal(err)
@@ -31,7 +31,7 @@ func createReq(vol string) *control.CreateVolumeRequest {
// it) and returns it with a lifecycle client.
func hostOn(t *testing.T, authDir, lcDir string) (*Host, control.LifecycleServiceClient, func()) {
t.Helper()
h, err := New(Config{Listen: "127.0.0.1:0", AuthorityStoreDir: authDir, LifecycleStoreDir: lcDir})
h, err := New(Config{Listen: "127.0.0.1:0", AuthorityStoreDir: authDir, LifecycleStoreDir: lcDir, LifecycleProductLoop: true})
if err != nil {
t.Fatal(err)
}
@@ -29,7 +29,7 @@ func reviewBindingHostWithReader(t *testing.T, reader func(context.Context, stri
func reviewBindingHostBeforeStart(t *testing.T, reader func(context.Context, string) (authority.WorkspaceHead, error), before func(*Host)) (*Host, *grpc.ClientConn, context.Context) {
t.Helper()
h, e := New(Config{Listen: "127.0.0.1:0", AuthorityStoreDir: t.TempDir(), LifecycleStoreDir: t.TempDir(), WorkspaceRPC: true, LayoutCreateVolume: testLayoutCreateVolume, WorkspaceHeadReader: reader})
h, e := New(Config{Listen: "127.0.0.1:0", AuthorityStoreDir: t.TempDir(), LifecycleStoreDir: t.TempDir(), WorkspaceRPC: true, LifecycleProductLoop: true, LayoutCreateVolume: testLayoutCreateVolume, WorkspaceHeadReader: reader})
if e != nil {
t.Fatal(e)
}
@@ -15,7 +15,7 @@ import (
)
func TestWorkspaceBindingPlacesRF1OnChosenNode(t *testing.T) {
h, err := New(Config{Listen: "127.0.0.1:0", AuthorityStoreDir: t.TempDir(), LifecycleStoreDir: t.TempDir(), WorkspaceRPC: true, LayoutCreateVolume: testLayoutCreateVolume, WorkspaceHeadReader: func(context.Context, string) (authority.WorkspaceHead, error) { return authority.WorkspaceHead{}, nil }})
h, err := New(Config{Listen: "127.0.0.1:0", AuthorityStoreDir: t.TempDir(), LifecycleStoreDir: t.TempDir(), WorkspaceRPC: true, LifecycleProductLoop: true, LayoutCreateVolume: testLayoutCreateVolume, WorkspaceHeadReader: func(context.Context, string) (authority.WorkspaceHead, error) { return authority.WorkspaceHead{}, nil }})
if err != nil {
t.Fatal(err)
}
@@ -73,7 +73,7 @@ func TestWorkspaceBindingsForcedRetiresOnlyAfterIssue(t *testing.T) {
}
func workspaceBindingsMove(t *testing.T, forced bool) {
cfg := Config{WorkspaceMaxClockSkew: 100 * time.Millisecond, Listen: "127.0.0.1:0", AuthorityStoreDir: t.TempDir(), LifecycleStoreDir: t.TempDir(), WorkspaceRPC: true, LayoutCreateVolume: testLayoutCreateVolume, WorkspaceHeadReader: func(context.Context, string) (authority.WorkspaceHead, error) {
cfg := Config{WorkspaceMaxClockSkew: 100 * time.Millisecond, Listen: "127.0.0.1:0", AuthorityStoreDir: t.TempDir(), LifecycleStoreDir: t.TempDir(), WorkspaceRPC: true, LifecycleProductLoop: true, LayoutCreateVolume: testLayoutCreateVolume, WorkspaceHeadReader: func(context.Context, string) (authority.WorkspaceHead, error) {
return authority.WorkspaceHead{Gen: 9, Epoch: 1, Holder: "node-a/r1", RemoteLSN: 42, Detached: true}, nil
}}
h, err := New(cfg)
@@ -218,7 +218,7 @@ func workspaceBindingsMove(t *testing.T, forced bool) {
}
func TestWorkspaceBindingsRejectCollisionsAndLiveChangesAndDeleteCleans(t *testing.T) {
h, e := New(Config{Listen: "127.0.0.1:0", AuthorityStoreDir: t.TempDir(), LifecycleStoreDir: t.TempDir(), WorkspaceRPC: true, LayoutCreateVolume: testLayoutCreateVolume, WorkspaceHeadReader: func(context.Context, string) (authority.WorkspaceHead, error) { return authority.WorkspaceHead{}, nil }})
h, e := New(Config{Listen: "127.0.0.1:0", AuthorityStoreDir: t.TempDir(), LifecycleStoreDir: t.TempDir(), WorkspaceRPC: true, LifecycleProductLoop: true, LayoutCreateVolume: testLayoutCreateVolume, WorkspaceHeadReader: func(context.Context, string) (authority.WorkspaceHead, error) { return authority.WorkspaceHead{}, nil }})
if e != nil {
t.Fatal(e)
}
@@ -43,7 +43,7 @@ func TestWorkspaceExitedHolderForcedMoveThenCleanDelete(t *testing.T) {
return layoutWorkspaceHead(h), nil
}
const skew = 100 * time.Millisecond
m, err := New(Config{WorkspaceMaxClockSkew: skew, Listen: "127.0.0.1:0", AuthorityStoreDir: t.TempDir(), LifecycleStoreDir: t.TempDir(), WorkspaceRPC: true, LayoutCreateVolume: testLayoutCreateVolume, WorkspaceHeadReader: reader})
m, err := New(Config{WorkspaceMaxClockSkew: skew, Listen: "127.0.0.1:0", AuthorityStoreDir: t.TempDir(), LifecycleStoreDir: t.TempDir(), WorkspaceRPC: true, LifecycleProductLoop: true, LayoutCreateVolume: testLayoutCreateVolume, WorkspaceHeadReader: reader})
if err != nil {
t.Fatal(err)
}
@@ -113,7 +113,7 @@ func TestWorkspaceForcedMoveLostRangeOverRPC(t *testing.T) {
logs := &syncBuffer{}
headTime := time.Date(2026, 11, 21, 1, 2, 3, 0, time.UTC)
authDir := t.TempDir()
cfg := Config{WorkspaceMaxClockSkew: 100 * time.Millisecond, Listen: "127.0.0.1:0", AuthorityStoreDir: authDir, LifecycleStoreDir: t.TempDir(), WorkspaceRPC: true, LayoutCreateVolume: testLayoutCreateVolume,
cfg := Config{WorkspaceMaxClockSkew: 100 * time.Millisecond, Listen: "127.0.0.1:0", AuthorityStoreDir: authDir, LifecycleStoreDir: t.TempDir(), WorkspaceRPC: true, LifecycleProductLoop: true, LayoutCreateVolume: testLayoutCreateVolume,
Logger: log.New(logs, "", 0),
WorkspaceHeadReader: func(context.Context, string) (authority.WorkspaceHead, error) {
return authority.WorkspaceHead{Gen: 9, Epoch: 1, Holder: "node-a/r1", RemoteLSN: 42, FilerMtimeNS: headTime.UnixNano()}, nil
@@ -42,7 +42,7 @@ func (s *syncBuffer) String() string {
// on that node).
func TestWorkspaceMoveRefusalNamesTheMissingPrecondition(t *testing.T) {
logs := &syncBuffer{}
m, err := New(Config{Listen: "127.0.0.1:0", AuthorityStoreDir: t.TempDir(), LifecycleStoreDir: t.TempDir(), WorkspaceRPC: true, LayoutCreateVolume: testLayoutCreateVolume,
m, err := New(Config{Listen: "127.0.0.1:0", AuthorityStoreDir: t.TempDir(), LifecycleStoreDir: t.TempDir(), WorkspaceRPC: true, LifecycleProductLoop: true, LayoutCreateVolume: testLayoutCreateVolume,
Logger: log.New(logs, "", 0),
WorkspaceHeadReader: func(context.Context, string) (authority.WorkspaceHead, error) {
return authority.WorkspaceHead{Gen: 9, Epoch: 1, Holder: "node-a/r1", RemoteLSN: 42, Detached: true}, nil
@@ -153,7 +153,7 @@ func (b *blockingWriter) Write(p []byte) (int, error) {
// writer is blocked, another workspace RPC still gets the lock.
func TestWorkspaceMoveRefusalLogsOutsideTheWorkspaceLock(t *testing.T) {
w := &blockingWriter{marker: "MoveWorkspace refused", entered: make(chan struct{}), release: make(chan struct{})}
m, err := New(Config{Listen: "127.0.0.1:0", AuthorityStoreDir: t.TempDir(), LifecycleStoreDir: t.TempDir(), WorkspaceRPC: true, LayoutCreateVolume: testLayoutCreateVolume, Logger: log.New(w, "", 0),
m, err := New(Config{Listen: "127.0.0.1:0", AuthorityStoreDir: t.TempDir(), LifecycleStoreDir: t.TempDir(), WorkspaceRPC: true, LifecycleProductLoop: true, LayoutCreateVolume: testLayoutCreateVolume, Logger: log.New(w, "", 0),
WorkspaceHeadReader: func(context.Context, string) (authority.WorkspaceHead, error) { return authority.WorkspaceHead{}, nil }})
if err != nil {
t.Fatal(err)
@@ -23,7 +23,7 @@ import (
// check. The grant routes a2 to the slot-1 endpoints it asked for.
func TestWorkspaceMoveToAnotherSlotOnTheTargetHost(t *testing.T) {
heads := map[string]authority.WorkspaceHead{"a2": {Gen: 9, Epoch: 1, Holder: "node-b/r1", RemoteLSN: 42, Detached: true}}
m, err := New(Config{Listen: "127.0.0.1:0", AuthorityStoreDir: t.TempDir(), LifecycleStoreDir: t.TempDir(), WorkspaceRPC: true, LayoutCreateVolume: testLayoutCreateVolume,
m, err := New(Config{Listen: "127.0.0.1:0", AuthorityStoreDir: t.TempDir(), LifecycleStoreDir: t.TempDir(), WorkspaceRPC: true, LifecycleProductLoop: true, LayoutCreateVolume: testLayoutCreateVolume,
WorkspaceHeadReader: func(_ context.Context, v string) (authority.WorkspaceHead, error) { return heads[v], nil }})
if err != nil {
t.Fatal(err)
@@ -48,7 +48,7 @@ func TestWorkspaceRPCCleanMovePreservesReplicaIdentity(t *testing.T) {
return authority.WorkspaceHead{Gen: generation.Load(), Epoch: 1, Holder: "node-a/r2", RemoteLSN: 42, Detached: detached.Load()}, nil
}
authDir, lifeDir := t.TempDir(), t.TempDir()
cfg := Config{AuthorityStoreDir: authDir, LifecycleStoreDir: lifeDir, Listen: "127.0.0.1:0", WorkspaceRPC: true, LayoutCreateVolume: testLayoutCreateVolume, WorkspaceHeadReader: reader}
cfg := Config{AuthorityStoreDir: authDir, LifecycleStoreDir: lifeDir, Listen: "127.0.0.1:0", WorkspaceRPC: true, LifecycleProductLoop: true, LayoutCreateVolume: testLayoutCreateVolume, WorkspaceHeadReader: reader}
h, err := New(cfg)
if err != nil {
t.Fatal(err)
@@ -121,7 +121,7 @@ func seedSkewPublisher(t *testing.T, p *authority.Publisher, d *skewDirective) {
}
func TestWorkspaceClockSkewConfigReachesLeaseReply(t *testing.T) {
h, err := New(Config{AuthorityStoreDir: t.TempDir(), LifecycleStoreDir: t.TempDir(), Listen: "127.0.0.1:0", WorkspaceRPC: true, LayoutCreateVolume: testLayoutCreateVolume, WorkspaceMaxClockSkew: 4 * time.Second, WorkspaceHeadReader: func(context.Context, string) (authority.WorkspaceHead, error) { return authority.WorkspaceHead{}, nil }})
h, err := New(Config{AuthorityStoreDir: t.TempDir(), LifecycleStoreDir: t.TempDir(), Listen: "127.0.0.1:0", WorkspaceRPC: true, LifecycleProductLoop: true, LayoutCreateVolume: testLayoutCreateVolume, WorkspaceMaxClockSkew: 4 * time.Second, WorkspaceHeadReader: func(context.Context, string) (authority.WorkspaceHead, error) { return authority.WorkspaceHead{}, nil }})
if err != nil {
t.Fatal(err)
}
@@ -51,7 +51,7 @@ func TestWorkspaceUnclaimedGrantForcedReassignOverRPC(t *testing.T) {
return authority.WorkspaceHead{Gen: h.Gen, Epoch: h.Epoch, Holder: h.Holder, RemoteLSN: h.RemoteLSN, Detached: h.State == storage.ChunkHeadDetached}, nil
}
const skew = 100 * time.Millisecond
m, err := New(Config{WorkspaceMaxClockSkew: skew, Listen: "127.0.0.1:0", AuthorityStoreDir: t.TempDir(), LifecycleStoreDir: t.TempDir(), WorkspaceRPC: true, LayoutCreateVolume: testLayoutCreateVolume, WorkspaceHeadReader: reader})
m, err := New(Config{WorkspaceMaxClockSkew: skew, Listen: "127.0.0.1:0", AuthorityStoreDir: t.TempDir(), LifecycleStoreDir: t.TempDir(), WorkspaceRPC: true, LifecycleProductLoop: true, LayoutCreateVolume: testLayoutCreateVolume, WorkspaceHeadReader: reader})
if err != nil {
t.Fatal(err)
}