beads/cmd/bd/init_commit_test.go
Zachary Taylor 6cbd63359a
fix(dolt): bind bootstrap recovery to database incarnation (#5252)
* fix(init): commit intentional config state

* fix: bind bootstrap recovery to database incarnation

* fix(uow): bind bootstrap recovery to incarnation

---------

Co-authored-by: Steve Yegge <steve.yegge@gmail.com>
2026-08-02 06:25:13 -07:00

35 lines
882 B
Go

package main
import (
"context"
"errors"
"testing"
)
type recordingInitCommitter struct {
message string
err error
}
func (s *recordingInitCommitter) CommitWithConfig(_ context.Context, message string) error {
s.message = message
return s.err
}
func TestCommitInitStateIncludesIntentionalConfig(t *testing.T) {
store := &recordingInitCommitter{}
if err := commitInitState(context.Background(), store); err != nil {
t.Fatalf("commitInitState: %v", err)
}
if store.message != "bd init" {
t.Fatalf("CommitWithConfig message = %q, want %q", store.message, "bd init")
}
}
func TestCommitInitStatePreservesCommitError(t *testing.T) {
want := errors.New("commit failed")
store := &recordingInitCommitter{err: want}
if got := commitInitState(context.Background(), store); !errors.Is(got, want) {
t.Fatalf("commitInitState error = %v, want %v", got, want)
}
}