MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / triggerBoth

Method triggerBoth

internal/e2e/dual_path_e2e_test.go:53–77  ·  view source on GitHub ↗

triggerBoth fires the event through BOTH paths, mirroring the rollout-window state where the legacy goroutine + new outbox both run. Returns the deterministic event id.

(ctx context.Context, userID, agentID, messageID string)

Source from the content-addressed store, hash-verified

51// rollout-window state where the legacy goroutine + new outbox both
52// run. Returns the deterministic event id.
53func (f *dualPathFixture) triggerBoth(ctx context.Context, userID, agentID, messageID string) string {
54 f.t.Helper()
55 f.seedMessage(messageID, agentID, "inbound")
56 eventID := webhookpub.DeterministicEventID(messageID, webhookpub.EventEmailReceived)
57 event := webhookpub.Event{
58 ID: eventID,
59 Type: webhookpub.EventEmailReceived,
60 UserID: userID,
61 AgentID: agentID,
62 MessageID: messageID,
63 Data: map[string]any{"path": "dual"},
64 }
65 // Path 1: outbox (no-op if the flag is off).
66 if err := f.store.WithTx(ctx, func(tx pgx.Tx) error {
67 return f.outbox.PublishTx(ctx, tx, event)
68 }); err != nil {
69 f.t.Fatalf("PublishTx: %v", err)
70 }
71 // Path 2: legacy in-process fan-out (always fires).
72 f.legacyPublisher.Publish(ctx, event)
73 // Drain everything so the test can immediately assert.
74 f.worker.Tick(ctx)
75 f.subWorker.Tick(ctx)
76 return eventID
77}
78
79// TestDualPath_FlagOff_OnlyLegacyDelivers proves that with the
80// WEBHOOKS_OUTBOX_ENABLED flag OFF (the v1 default), the legacy

Calls 6

DeterministicEventIDFunction · 0.92
seedMessageMethod · 0.80
WithTxMethod · 0.80
PublishTxMethod · 0.65
PublishMethod · 0.65
TickMethod · 0.45

Tested by

no test coverage detected