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

Function TestFlowWithoutTriggerNotRegistered

flow/registry_test.go:49–65  ·  view source on GitHub ↗

A flow without a trigger is not a running listener and isn't registered.

(t *testing.T)

Source from the content-addressed store, hash-verified

47
48// A flow without a trigger is not a running listener and isn't registered.
49func TestFlowWithoutTriggerNotRegistered(t *testing.T) {
50 reg := registry.NewMemoryRegistry()
51 br := broker.NewMemoryBroker()
52 _ = br.Connect()
53
54 f := New("oneshot", Steps(appendStep("a")))
55 if err := f.Register(reg, br, client.DefaultClient); err != nil {
56 t.Fatalf("Register: %v", err)
57 }
58 if svcs, _ := reg.GetService("oneshot"); len(svcs) != 0 {
59 t.Errorf("triggerless flow should not register, got %d", len(svcs))
60 }
61 // It still runs on demand.
62 if err := f.Execute(context.Background(), ""); err != nil {
63 t.Fatalf("Execute: %v", err)
64 }
65}

Callers

nothing calls this directly

Calls 11

NewMemoryRegistryFunction · 0.92
NewMemoryBrokerFunction · 0.92
StepsFunction · 0.85
appendStepFunction · 0.85
ExecuteMethod · 0.80
NewFunction · 0.70
ConnectMethod · 0.65
RegisterMethod · 0.65
GetServiceMethod · 0.65
FatalfMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…