MCPcopy
hub / github.com/micro/go-micro / TestFlowStepNamesMustBeUnique

Function TestFlowStepNamesMustBeUnique

flow/steps_test.go:383–399  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

381}
382
383func TestFlowStepNamesMustBeUnique(t *testing.T) {
384 step := Step{Name: "work", Run: func(_ context.Context, in State) (State, error) {
385 return in, nil
386 }}
387 f := New("duplicate-steps",
388 WithCheckpoint(StoreCheckpoint(store.NewMemoryStore(), "duplicate-steps")),
389 Steps(step, step),
390 )
391
392 err := f.Execute(context.Background(), "")
393 if err == nil {
394 t.Fatal("expected duplicate step names to fail validation")
395 }
396 if got, want := err.Error(), `flow: duplicate step name "work"`; got != want {
397 t.Fatalf("error = %q, want %q", got, want)
398 }
399}
400
401func TestFlowStepNamesMustBeNonEmpty(t *testing.T) {
402 f := New("empty-step-name",

Callers

nothing calls this directly

Calls 9

NewMemoryStoreFunction · 0.92
StepsFunction · 0.85
ExecuteMethod · 0.80
FatalMethod · 0.80
NewFunction · 0.70
WithCheckpointFunction · 0.70
StoreCheckpointFunction · 0.70
ErrorMethod · 0.65
FatalfMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…