From a82a7c5d67e43013065c35918633a2acd34d5236 Mon Sep 17 00:00:00 2001 From: Maksim Kotlyar Date: Mon, 11 Nov 2024 20:46:18 +0200 Subject: [PATCH] poc --- engine.go | 2 +- log.go | 7 +--- memdriver/delayer.go | 38 +++++++++++++++---- memdriver/driver.go | 34 +++++++++++------ memdriver/suite_test.go | 3 +- pgdriver/driver.go | 18 +++++++-- pgdriver/suite_test.go | 3 +- testcases/actor.go | 2 +- testcases/call_flow.go | 2 +- testcases/call_flow_with_commit.go | 2 +- testcases/call_flow_with_watch.go | 2 +- testcases/condition.go | 2 +- testcases/cron.go | 2 +- testcases/data_flow_config.go | 2 +- testcases/data_store_get.go | 2 +- testcases/data_store_get_with_commit.go | 2 +- testcases/delay_delayed_win_with_commit.go | 2 +- testcases/delay_engine_do.go | 2 +- testcases/delay_paused.go | 2 +- testcases/delay_paused_with_commit.go | 2 +- testcases/delay_return.go | 2 +- testcases/delay_transited_win_with_commit.go | 2 +- testcases/fork.go | 2 +- testcases/fork_join_first_wins.go | 2 +- testcases/fork_join_last_wins.go | 2 +- testcases/fork_with_commit.go | 2 +- testcases/get_by_id_and_rev.go | 2 +- testcases/get_latest_by_id.go | 2 +- testcases/get_latest_by_label.go | 2 +- testcases/get_not_found.go | 2 +- testcases/log.go | 2 +- testcases/mutex.go | 2 +- testcases/queue.go | 2 +- testcases/rate_limit.go | 2 +- testcases/recovery_always_fail.go | 2 +- testcases/recovery_first_attempt_fail.go | 2 +- testcases/single_node.go | 2 +- testcases/three_consequent_nodes.go | 2 +- testcases/two_consequent_nodes.go | 2 +- testcases/two_consequent_nodes_with_commit.go | 2 +- testcases/watch_labels.go | 2 +- testcases/watch_or_labels.go | 2 +- testcases/watch_since_latest.go | 2 +- testcases/watch_since_rev.go | 2 +- testcases/watch_since_time.go | 2 +- 45 files changed, 112 insertions(+), 69 deletions(-) diff --git a/engine.go b/engine.go index ba6e7d3..bf1dfaf 100644 --- a/engine.go +++ b/engine.go @@ -86,7 +86,7 @@ func (e *Engine) Execute(stateCtx *StateCtx) error { conflictErr := &ErrCommitConflict{} if err = e.do(cmd0); errors.As(err, conflictErr) { - e.l.Info("do conflict", + e.l.Info("engine: do conflict", "sess", cmd0.SessID(), "conflict", err.Error(), "id", stateCtx.Current.ID, diff --git a/log.go b/log.go index 797064d..e94827d 100644 --- a/log.go +++ b/log.go @@ -27,7 +27,7 @@ func logExecute(stateCtx *StateCtx, l *slog.Logger) { args = append(args, "recovered", currTs.Annotations[RecoveryAttemptAnnotation]) } - l.Info("execute flow", args...) + l.Info("engine: execute", args...) } func logDo(cmd0 Command, l *slog.Logger) { @@ -35,9 +35,6 @@ func logDo(cmd0 Command, l *slog.Logger) { switch cmd := cmd0.(type) { case *CommitCommand: - //for _, c := range cmd.Commands { - // log.Printf("commit: %T", c) - //} args = append(args, "cmd", "commit", "len", len(cmd.Commands)) case *CommitStateCtxCommand: args = append(args, "cmd", "commit_state_ctx", "id", cmd.StateCtx.Current.ID, "rev", cmd.StateCtx.Current.Rev) @@ -92,6 +89,6 @@ func logDo(cmd0 Command, l *slog.Logger) { args = append(args, "cmd", fmt.Sprintf("%T", cmd)) } - l.Info("do commands", args...) + l.Info("engine: do", args...) } diff --git a/memdriver/delayer.go b/memdriver/delayer.go index caf72e5..c85b516 100644 --- a/memdriver/delayer.go +++ b/memdriver/delayer.go @@ -4,7 +4,7 @@ import ( "context" "errors" "fmt" - "log" + "log/slog" "sync" "time" @@ -17,11 +17,13 @@ type Delayer struct { e *flowstate.Engine stopCh chan struct{} wg sync.WaitGroup + l *slog.Logger } -func NewDelayer() *Delayer { +func NewDelayer(l *slog.Logger) *Delayer { return &Delayer{ stopCh: make(chan struct{}), + l: l, } } @@ -43,26 +45,46 @@ func (d *Delayer) Do(cmd0 flowstate.Command) error { t := time.NewTimer(cmd.Duration) defer t.Stop() + stateCtx := cmd.DelayStateCtx + select { case <-t.C: - if cmd.DelayStateCtx.Current.Transition.Annotations[flowstate.DelayCommitAnnotation] == `true` { + if stateCtx.Current.Transition.Annotations[flowstate.DelayCommitAnnotation] == `true` { conflictErr := &flowstate.ErrCommitConflict{} if err := d.e.Do(flowstate.Commit( flowstate.CommitStateCtx(cmd.DelayStateCtx), )); errors.As(err, conflictErr) { - log.Printf(`ERROR: memdriver: delayer: engine: commit: %s\n`, conflictErr) + d.l.Info("delayer: commit conflict", + "sess", cmd.SessID(), + "conflict", err.Error(), + "id", stateCtx.Current.ID, + "rev", stateCtx.Current.Rev, + ) return } else if err != nil { - log.Printf(`ERROR: memdriver: delayer: engine: commit: %s`, err) + d.l.Error("delayer: commit failed", + "sess", cmd.SessID(), + "error", err, + "id", stateCtx.Current.ID, + "rev", stateCtx.Current.Rev, + ) return } } - if err := d.e.Execute(cmd.DelayStateCtx); err != nil { - log.Printf(`ERROR: memdriver: delayer: engine: execute: %s`, err) + if err := d.e.Execute(stateCtx); err != nil { + d.l.Error("delayer: execute failed", + "sess", stateCtx.SessID(), + "error", err, + "id", stateCtx.Current.ID, + "rev", stateCtx.Current.Rev, + ) } case <-d.stopCh: - log.Printf(`ERROR: memdriver: delayer: state delay was terminated`) + d.l.Error("delayer: delaying terminated", + "id", stateCtx.Current.ID, + "rev", stateCtx.Current.Rev, + ) return } }() diff --git a/memdriver/driver.go b/memdriver/driver.go index fe93e72..189c6a7 100644 --- a/memdriver/driver.go +++ b/memdriver/driver.go @@ -4,6 +4,8 @@ import ( "context" "errors" "fmt" + "log/slog" + "os" "github.com/makasim/flowstate" ) @@ -11,17 +13,25 @@ import ( type Driver struct { *FlowRegistry - l *Log + log *Log doers []flowstate.Doer recoverer flowstate.Doer + + l *slog.Logger } func New(opts ...Option) *Driver { - l := &Log{} + log := &Log{} d := &Driver{ - l: l, + log: log, FlowRegistry: &FlowRegistry{}, + + l: slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{})), + } + + for _, opt := range opts { + opt(d) } doers := []flowstate.Doer{ @@ -37,17 +47,13 @@ func New(opts ...Option) *Driver { NewDataLog(), NewFlowGetter(d.FlowRegistry), - NewCommiter(l), - NewGetter(l), - NewWatcher(l), - NewDelayer(), + NewCommiter(log), + NewGetter(log), + NewWatcher(log), + NewDelayer(d.l), } d.doers = doers - for _, opt := range opts { - opt(d) - } - return d } @@ -105,3 +111,9 @@ func WithRecoverer(r flowstate.Doer) Option { d.recoverer = r } } + +func WithLogger(l *slog.Logger) Option { + return func(d *Driver) { + d.l = l + } +} diff --git a/memdriver/suite_test.go b/memdriver/suite_test.go index e2d60ba..58009a6 100644 --- a/memdriver/suite_test.go +++ b/memdriver/suite_test.go @@ -10,7 +10,8 @@ import ( func TestSuite(t *testing.T) { s := testcases.Get(func(t testcases.TestingT) (flowstate.Doer, testcases.FlowRegistry) { - d := memdriver.New() + l, _ := testcases.NewTestLogger(t) + d := memdriver.New(memdriver.WithLogger(l)) return d, d }) diff --git a/pgdriver/driver.go b/pgdriver/driver.go index 63a21c2..a693aeb 100644 --- a/pgdriver/driver.go +++ b/pgdriver/driver.go @@ -4,6 +4,8 @@ import ( "context" "errors" "fmt" + "log/slog" + "os" "time" "github.com/makasim/flowstate" @@ -18,6 +20,7 @@ type Driver struct { doers []flowstate.Doer recoverer flowstate.Doer + l *slog.Logger } func New(conn conn, opts ...Option) *Driver { @@ -26,6 +29,11 @@ func New(conn conn, opts ...Option) *Driver { q: &queries{}, FlowRegistry: &memdriver.FlowRegistry{}, + l: slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{})), + } + + for _, opt := range opts { + opt(d) } d.doers = []flowstate.Doer{ @@ -50,10 +58,6 @@ func New(conn conn, opts ...Option) *Driver { NewDelayer(d.conn, d.q, time.Now), } - for _, opt := range opts { - opt(d) - } - return d } @@ -111,3 +115,9 @@ func WithRecoverer(r flowstate.Doer) Option { d.recoverer = r } } + +func WithLogger(l *slog.Logger) Option { + return func(d *Driver) { + d.l = l + } +} diff --git a/pgdriver/suite_test.go b/pgdriver/suite_test.go index 64ff4d7..5251e57 100644 --- a/pgdriver/suite_test.go +++ b/pgdriver/suite_test.go @@ -32,7 +32,8 @@ func TestSuite(t *testing.T) { conn.Close() }) - d := pgdriver.New(conn) + l, _ := testcases.NewTestLogger(t) + d := pgdriver.New(conn, pgdriver.WithLogger(l)) return d, d }) diff --git a/testcases/actor.go b/testcases/actor.go index 74706a6..8f73da6 100644 --- a/testcases/actor.go +++ b/testcases/actor.go @@ -49,7 +49,7 @@ func Actor(t TestingT, d flowstate.Doer, fr FlowRegistry) { return nil, fmt.Errorf("must never be executed") })) - l, _ := newTestLogger(t) + l, _ := NewTestLogger(t) e, err := flowstate.NewEngine(d, l) require.NoError(t, err) defer func() { diff --git a/testcases/call_flow.go b/testcases/call_flow.go index 32a2c41..74ed62d 100644 --- a/testcases/call_flow.go +++ b/testcases/call_flow.go @@ -79,7 +79,7 @@ func CallFlow(t TestingT, d flowstate.Doer, fr FlowRegistry) { return flowstate.End(stateCtx), nil })) - l, _ := newTestLogger(t) + l, _ := NewTestLogger(t) e, err := flowstate.NewEngine(d, l) require.NoError(t, err) defer func() { diff --git a/testcases/call_flow_with_commit.go b/testcases/call_flow_with_commit.go index a684e2a..ca37031 100644 --- a/testcases/call_flow_with_commit.go +++ b/testcases/call_flow_with_commit.go @@ -82,7 +82,7 @@ func CallFlowWithCommit(t TestingT, d flowstate.Doer, fr FlowRegistry) { return flowstate.End(stateCtx), nil })) - l, _ := newTestLogger(t) + l, _ := NewTestLogger(t) e, err := flowstate.NewEngine(d, l) require.NoError(t, err) defer func() { diff --git a/testcases/call_flow_with_watch.go b/testcases/call_flow_with_watch.go index b83c7de..00b0d41 100644 --- a/testcases/call_flow_with_watch.go +++ b/testcases/call_flow_with_watch.go @@ -97,7 +97,7 @@ func CallFlowWithWatch(t TestingT, d flowstate.Doer, fr FlowRegistry) { ), nil })) - l, _ := newTestLogger(t) + l, _ := NewTestLogger(t) e, err := flowstate.NewEngine(d, l) require.NoError(t, err) defer func() { diff --git a/testcases/condition.go b/testcases/condition.go index 0e70783..84c5802 100644 --- a/testcases/condition.go +++ b/testcases/condition.go @@ -33,7 +33,7 @@ func Condition(t TestingT, d flowstate.Doer, fr FlowRegistry) { return flowstate.End(stateCtx), nil })) - l, _ := newTestLogger(t) + l, _ := NewTestLogger(t) e, err := flowstate.NewEngine(d, l) require.NoError(t, err) defer func() { diff --git a/testcases/cron.go b/testcases/cron.go index bd70519..75d5133 100644 --- a/testcases/cron.go +++ b/testcases/cron.go @@ -87,7 +87,7 @@ func Cron(t TestingT, d flowstate.Doer, fr FlowRegistry) { ), nil })) - l, _ := newTestLogger(t) + l, _ := NewTestLogger(t) e, err := flowstate.NewEngine(d, l) require.NoError(t, err) defer func() { diff --git a/testcases/data_flow_config.go b/testcases/data_flow_config.go index 76602f1..240ef6f 100644 --- a/testcases/data_flow_config.go +++ b/testcases/data_flow_config.go @@ -125,7 +125,7 @@ func DataFlowConfig(t TestingT, d flowstate.Doer, fr FlowRegistry) { return flowstate.End(stateCtx), nil })) - l, _ := newTestLogger(t) + l, _ := NewTestLogger(t) e, err := flowstate.NewEngine(d, l) require.NoError(t, err) defer func() { diff --git a/testcases/data_store_get.go b/testcases/data_store_get.go index fea99d4..952b612 100644 --- a/testcases/data_store_get.go +++ b/testcases/data_store_get.go @@ -63,7 +63,7 @@ func DataStoreGet(t TestingT, d flowstate.Doer, fr FlowRegistry) { return flowstate.End(stateCtx), nil })) - l, _ := newTestLogger(t) + l, _ := NewTestLogger(t) e, err := flowstate.NewEngine(d, l) require.NoError(t, err) defer func() { diff --git a/testcases/data_store_get_with_commit.go b/testcases/data_store_get_with_commit.go index 3d09095..1fe9a4f 100644 --- a/testcases/data_store_get_with_commit.go +++ b/testcases/data_store_get_with_commit.go @@ -63,7 +63,7 @@ func DataStoreGetWithCommit(t TestingT, d flowstate.Doer, fr FlowRegistry) { return flowstate.End(stateCtx), nil })) - l, _ := newTestLogger(t) + l, _ := NewTestLogger(t) e, err := flowstate.NewEngine(d, l) require.NoError(t, err) defer func() { diff --git a/testcases/delay_delayed_win_with_commit.go b/testcases/delay_delayed_win_with_commit.go index fd7739c..8d0979a 100644 --- a/testcases/delay_delayed_win_with_commit.go +++ b/testcases/delay_delayed_win_with_commit.go @@ -48,7 +48,7 @@ func Delay_DelayedWin_WithCommit(t TestingT, d flowstate.Doer, fr FlowRegistry) ), nil })) - l, _ := newTestLogger(t) + l, _ := NewTestLogger(t) e, err := flowstate.NewEngine(d, l) require.NoError(t, err) defer func() { diff --git a/testcases/delay_engine_do.go b/testcases/delay_engine_do.go index 41829c9..98567c3 100644 --- a/testcases/delay_engine_do.go +++ b/testcases/delay_engine_do.go @@ -33,7 +33,7 @@ func Delay_EngineDo(t TestingT, d flowstate.Doer, fr FlowRegistry) { return flowstate.End(stateCtx), nil })) - l, _ := newTestLogger(t) + l, _ := NewTestLogger(t) e, err := flowstate.NewEngine(d, l) require.NoError(t, err) defer func() { diff --git a/testcases/delay_paused.go b/testcases/delay_paused.go index 3288ea5..e02313d 100644 --- a/testcases/delay_paused.go +++ b/testcases/delay_paused.go @@ -38,7 +38,7 @@ func Delay_Paused(t TestingT, d flowstate.Doer, fr FlowRegistry) { ), nil })) - l, _ := newTestLogger(t) + l, _ := NewTestLogger(t) e, err := flowstate.NewEngine(d, l) require.NoError(t, err) defer func() { diff --git a/testcases/delay_paused_with_commit.go b/testcases/delay_paused_with_commit.go index 7424edf..fbdeaea 100644 --- a/testcases/delay_paused_with_commit.go +++ b/testcases/delay_paused_with_commit.go @@ -40,7 +40,7 @@ func Delay_PausedWithCommit(t TestingT, d flowstate.Doer, fr FlowRegistry) { ), nil })) - l, _ := newTestLogger(t) + l, _ := NewTestLogger(t) e, err := flowstate.NewEngine(d, l) require.NoError(t, err) defer func() { diff --git a/testcases/delay_return.go b/testcases/delay_return.go index f077ec6..a6ea7ec 100644 --- a/testcases/delay_return.go +++ b/testcases/delay_return.go @@ -27,7 +27,7 @@ func Delay_Return(t TestingT, d flowstate.Doer, fr FlowRegistry) { return flowstate.End(stateCtx), nil })) - l, _ := newTestLogger(t) + l, _ := NewTestLogger(t) e, err := flowstate.NewEngine(d, l) require.NoError(t, err) defer func() { diff --git a/testcases/delay_transited_win_with_commit.go b/testcases/delay_transited_win_with_commit.go index 2baddb5..357effc 100644 --- a/testcases/delay_transited_win_with_commit.go +++ b/testcases/delay_transited_win_with_commit.go @@ -44,7 +44,7 @@ func Delay_TransitedWin_WithCommit(t TestingT, d flowstate.Doer, fr FlowRegistry ), nil })) - l, _ := newTestLogger(t) + l, _ := NewTestLogger(t) e, err := flowstate.NewEngine(d, l) require.NoError(t, err) defer func() { diff --git a/testcases/fork.go b/testcases/fork.go index 410f429..7a6bb3c 100644 --- a/testcases/fork.go +++ b/testcases/fork.go @@ -51,7 +51,7 @@ func Fork(t TestingT, d flowstate.Doer, fr FlowRegistry) { return flowstate.End(stateCtx), nil })) - l, _ := newTestLogger(t) + l, _ := NewTestLogger(t) e, err := flowstate.NewEngine(d, l) require.NoError(t, err) defer func() { diff --git a/testcases/fork_join_first_wins.go b/testcases/fork_join_first_wins.go index 253399a..d860464 100644 --- a/testcases/fork_join_first_wins.go +++ b/testcases/fork_join_first_wins.go @@ -103,7 +103,7 @@ func ForkJoin_FirstWins(t TestingT, d flowstate.Doer, fr FlowRegistry) { return flowstate.End(stateCtx), nil })) - l, _ := newTestLogger(t) + l, _ := NewTestLogger(t) e, err := flowstate.NewEngine(d, l) require.NoError(t, err) defer func() { diff --git a/testcases/fork_join_last_wins.go b/testcases/fork_join_last_wins.go index 68aeab7..e2b4b9b 100644 --- a/testcases/fork_join_last_wins.go +++ b/testcases/fork_join_last_wins.go @@ -104,7 +104,7 @@ func ForkJoin_LastWins(t TestingT, d flowstate.Doer, fr FlowRegistry) { return flowstate.End(stateCtx), nil })) - l, _ := newTestLogger(t) + l, _ := NewTestLogger(t) e, err := flowstate.NewEngine(d, l) require.NoError(t, err) defer func() { diff --git a/testcases/fork_with_commit.go b/testcases/fork_with_commit.go index 59a165e..1bf0d67 100644 --- a/testcases/fork_with_commit.go +++ b/testcases/fork_with_commit.go @@ -53,7 +53,7 @@ func Fork_WithCommit(t TestingT, d flowstate.Doer, fr FlowRegistry) { return flowstate.End(stateCtx), nil })) - l, _ := newTestLogger(t) + l, _ := NewTestLogger(t) e, err := flowstate.NewEngine(d, l) require.NoError(t, err) defer func() { diff --git a/testcases/get_by_id_and_rev.go b/testcases/get_by_id_and_rev.go index ceb6389..444ea67 100644 --- a/testcases/get_by_id_and_rev.go +++ b/testcases/get_by_id_and_rev.go @@ -12,7 +12,7 @@ import ( func GetByIDAndRev(t TestingT, d flowstate.Doer, _ FlowRegistry) { defer goleak.VerifyNone(t, goleak.IgnoreCurrent()) - l, _ := newTestLogger(t) + l, _ := NewTestLogger(t) e, err := flowstate.NewEngine(d, l) require.NoError(t, err) defer func() { diff --git a/testcases/get_latest_by_id.go b/testcases/get_latest_by_id.go index 23e5be6..d315b79 100644 --- a/testcases/get_latest_by_id.go +++ b/testcases/get_latest_by_id.go @@ -12,7 +12,7 @@ import ( func GetLatestByID(t TestingT, d flowstate.Doer, _ FlowRegistry) { defer goleak.VerifyNone(t, goleak.IgnoreCurrent()) - l, _ := newTestLogger(t) + l, _ := NewTestLogger(t) e, err := flowstate.NewEngine(d, l) require.NoError(t, err) defer func() { diff --git a/testcases/get_latest_by_label.go b/testcases/get_latest_by_label.go index f04dc9c..541eeb5 100644 --- a/testcases/get_latest_by_label.go +++ b/testcases/get_latest_by_label.go @@ -12,7 +12,7 @@ import ( func GetLatestByLabel(t TestingT, d flowstate.Doer, _ FlowRegistry) { defer goleak.VerifyNone(t, goleak.IgnoreCurrent()) - l, _ := newTestLogger(t) + l, _ := NewTestLogger(t) e, err := flowstate.NewEngine(d, l) require.NoError(t, err) defer func() { diff --git a/testcases/get_not_found.go b/testcases/get_not_found.go index 858237b..ab4c432 100644 --- a/testcases/get_not_found.go +++ b/testcases/get_not_found.go @@ -12,7 +12,7 @@ import ( func GetNotFound(t TestingT, d flowstate.Doer, _ FlowRegistry) { defer goleak.VerifyNone(t, goleak.IgnoreCurrent()) - l, _ := newTestLogger(t) + l, _ := NewTestLogger(t) e, err := flowstate.NewEngine(d, l) require.NoError(t, err) defer func() { diff --git a/testcases/log.go b/testcases/log.go index dc458cc..80266c3 100644 --- a/testcases/log.go +++ b/testcases/log.go @@ -7,7 +7,7 @@ import ( "github.com/thejerf/slogassert" ) -func newTestLogger(t TestingT) (*slog.Logger, *slogassert.Handler) { +func NewTestLogger(t TestingT) (*slog.Logger, *slogassert.Handler) { var wrappedH slog.Handler if os.Getenv(`TEST_OUTPUT_LOG`) == `true` { wrappedH = slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{ diff --git a/testcases/mutex.go b/testcases/mutex.go index b398bc1..bb06cec 100644 --- a/testcases/mutex.go +++ b/testcases/mutex.go @@ -118,7 +118,7 @@ func Mutex(t TestingT, d flowstate.Doer, fr FlowRegistry) { states = append(states, statesCtx) } - l, _ := newTestLogger(t) + l, _ := NewTestLogger(t) e, err := flowstate.NewEngine(d, l) require.NoError(t, err) defer func() { diff --git a/testcases/queue.go b/testcases/queue.go index 5e59ec1..5b0ab3c 100644 --- a/testcases/queue.go +++ b/testcases/queue.go @@ -69,7 +69,7 @@ func Queue(t TestingT, d flowstate.Doer, fr FlowRegistry) { ), nil })) - l, _ := newTestLogger(t) + l, _ := NewTestLogger(t) e, err := flowstate.NewEngine(d, l) require.NoError(t, err) defer func() { diff --git a/testcases/rate_limit.go b/testcases/rate_limit.go index 853bb34..1377f69 100644 --- a/testcases/rate_limit.go +++ b/testcases/rate_limit.go @@ -92,7 +92,7 @@ func RateLimit(t TestingT, d flowstate.Doer, fr FlowRegistry) { states = append(states, stateCtx) } - l, _ := newTestLogger(t) + l, _ := NewTestLogger(t) e, err := flowstate.NewEngine(d, l) require.NoError(t, err) defer func() { diff --git a/testcases/recovery_always_fail.go b/testcases/recovery_always_fail.go index 69134e0..6bf3764 100644 --- a/testcases/recovery_always_fail.go +++ b/testcases/recovery_always_fail.go @@ -20,7 +20,7 @@ func RecoveryAlwaysFail(t TestingT, d flowstate.Doer, fr FlowRegistry) { return flowstate.Noop(stateCtx), nil })) - l, _ := newTestLogger(t) + l, _ := NewTestLogger(t) e, err := flowstate.NewEngine(d, l) require.NoError(t, err) defer func() { diff --git a/testcases/recovery_first_attempt_fail.go b/testcases/recovery_first_attempt_fail.go index a1fbf10..c7fa826 100644 --- a/testcases/recovery_first_attempt_fail.go +++ b/testcases/recovery_first_attempt_fail.go @@ -27,7 +27,7 @@ func RecoveryFirstAttemptFail(t TestingT, d flowstate.Doer, fr FlowRegistry) { ), nil })) - l, _ := newTestLogger(t) + l, _ := NewTestLogger(t) e, err := flowstate.NewEngine(d, l) require.NoError(t, err) defer func() { diff --git a/testcases/single_node.go b/testcases/single_node.go index 76c69ac..459d001 100644 --- a/testcases/single_node.go +++ b/testcases/single_node.go @@ -19,7 +19,7 @@ func SingleNode(t TestingT, d flowstate.Doer, fr FlowRegistry) { return flowstate.End(stateCtx), nil })) - l, _ := newTestLogger(t) + l, _ := NewTestLogger(t) e, err := flowstate.NewEngine(d, l) require.NoError(t, err) defer func() { diff --git a/testcases/three_consequent_nodes.go b/testcases/three_consequent_nodes.go index c32eda3..40107c7 100644 --- a/testcases/three_consequent_nodes.go +++ b/testcases/three_consequent_nodes.go @@ -27,7 +27,7 @@ func ThreeConsequentNodes(t TestingT, d flowstate.Doer, fr FlowRegistry) { return flowstate.End(stateCtx), nil })) - l, _ := newTestLogger(t) + l, _ := NewTestLogger(t) e, err := flowstate.NewEngine(d, l) require.NoError(t, err) defer func() { diff --git a/testcases/two_consequent_nodes.go b/testcases/two_consequent_nodes.go index 10c15ae..026150e 100644 --- a/testcases/two_consequent_nodes.go +++ b/testcases/two_consequent_nodes.go @@ -23,7 +23,7 @@ func TwoConsequentNodes(t TestingT, d flowstate.Doer, fr FlowRegistry) { return flowstate.End(stateCtx), nil })) - l, _ := newTestLogger(t) + l, _ := NewTestLogger(t) e, err := flowstate.NewEngine(d, l) require.NoError(t, err) defer func() { diff --git a/testcases/two_consequent_nodes_with_commit.go b/testcases/two_consequent_nodes_with_commit.go index 87c68c2..d4f07ed 100644 --- a/testcases/two_consequent_nodes_with_commit.go +++ b/testcases/two_consequent_nodes_with_commit.go @@ -29,7 +29,7 @@ func TwoConsequentNodesWithCommit(t TestingT, d flowstate.Doer, fr FlowRegistry) return flowstate.End(stateCtx), nil })) - l, _ := newTestLogger(t) + l, _ := NewTestLogger(t) e, err := flowstate.NewEngine(d, l) require.NoError(t, err) defer func() { diff --git a/testcases/watch_labels.go b/testcases/watch_labels.go index 71c7565..dd1897f 100644 --- a/testcases/watch_labels.go +++ b/testcases/watch_labels.go @@ -13,7 +13,7 @@ import ( func WatchLabels(t TestingT, d flowstate.Doer, _ FlowRegistry) { defer goleak.VerifyNone(t, goleak.IgnoreCurrent()) - l, _ := newTestLogger(t) + l, _ := NewTestLogger(t) e, err := flowstate.NewEngine(d, l) defer func() { sCtx, sCtxCancel := context.WithTimeout(context.Background(), time.Second*5) diff --git a/testcases/watch_or_labels.go b/testcases/watch_or_labels.go index 07e844c..e0f653b 100644 --- a/testcases/watch_or_labels.go +++ b/testcases/watch_or_labels.go @@ -12,7 +12,7 @@ import ( func WatchORLabels(t TestingT, d flowstate.Doer, _ FlowRegistry) { defer goleak.VerifyNone(t, goleak.IgnoreCurrent()) - l, _ := newTestLogger(t) + l, _ := NewTestLogger(t) e, err := flowstate.NewEngine(d, l) defer func() { sCtx, sCtxCancel := context.WithTimeout(context.Background(), time.Second*5) diff --git a/testcases/watch_since_latest.go b/testcases/watch_since_latest.go index 65105aa..bed6420 100644 --- a/testcases/watch_since_latest.go +++ b/testcases/watch_since_latest.go @@ -12,7 +12,7 @@ import ( func WatchSinceLatest(t TestingT, d flowstate.Doer, _ FlowRegistry) { defer goleak.VerifyNone(t, goleak.IgnoreCurrent()) - l, _ := newTestLogger(t) + l, _ := NewTestLogger(t) e, err := flowstate.NewEngine(d, l) defer func() { sCtx, sCtxCancel := context.WithTimeout(context.Background(), time.Second*5) diff --git a/testcases/watch_since_rev.go b/testcases/watch_since_rev.go index 997864f..5ffd478 100644 --- a/testcases/watch_since_rev.go +++ b/testcases/watch_since_rev.go @@ -12,7 +12,7 @@ import ( func WatchSinceRev(t TestingT, d flowstate.Doer, _ FlowRegistry) { defer goleak.VerifyNone(t, goleak.IgnoreCurrent()) - l, _ := newTestLogger(t) + l, _ := NewTestLogger(t) e, err := flowstate.NewEngine(d, l) defer func() { sCtx, sCtxCancel := context.WithTimeout(context.Background(), time.Second*5) diff --git a/testcases/watch_since_time.go b/testcases/watch_since_time.go index d454fef..6460e65 100644 --- a/testcases/watch_since_time.go +++ b/testcases/watch_since_time.go @@ -12,7 +12,7 @@ import ( func WatchSinceTime(t TestingT, d flowstate.Doer, _ FlowRegistry) { defer goleak.VerifyNone(t, goleak.IgnoreCurrent()) - l, _ := newTestLogger(t) + l, _ := NewTestLogger(t) e, err := flowstate.NewEngine(d, l) defer func() { sCtx, sCtxCancel := context.WithTimeout(context.Background(), time.Second*5)