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

Function TestOutboundAgentToAgent

internal/e2e/e2e_test.go:154–182  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

152}
153
154func TestOutboundAgentToAgent(t *testing.T) {
155 t.Skip("requires an outbound SMTP relay configured in testutil.TestServer (and a loopback to inbound for the recipient webhook to fire) — tracked as test-infra work")
156 pool := testutil.TestDB(t)
157 receiver := testutil.WebhookReceiver(t)
158 ts := testutil.TestServer(t, pool)
159
160 _, apiKey, senderAgent := setupDomainAndAgent(t, ts, "agent@out-a.example.com", "out-a.example.com", "https://example.com/webhook", "cloud")
161 _, _, _ = setupDomainAndAgent(t, ts, "agent@out-b.example.com", "out-b.example.com", receiver.Server.URL, "cloud")
162
163 sendPayload := `{"to":["agent@out-b.example.com"],"subject":"A2A","body":"Hello from A"}`
164 req, _ := http.NewRequest("POST", ts.HTTPServer.URL+"/v1/agents/"+url.PathEscape(senderAgent.EmailAddress())+"/messages", bytes.NewBufferString(sendPayload))
165 req.Header.Set("Content-Type", "application/json")
166 req.Header.Set("Authorization", "Bearer "+apiKey.PlaintextKey)
167 resp, _ := http.DefaultClient.Do(req)
168 defer resp.Body.Close()
169
170 if resp.StatusCode != 200 {
171 t.Fatalf("status = %d, want 200", resp.StatusCode)
172 }
173
174 payloads := receiver.WaitForPayloads(t, 1, 5*time.Second)
175 p := payloads[0]
176 if p.Body.AuthHeaders["X-E2A-Auth-Entity-Type"] != "agent" {
177 t.Errorf("EntityType = %q, want agent", p.Body.AuthHeaders["X-E2A-Auth-Entity-Type"])
178 }
179 if p.Body.AuthHeaders["X-E2A-Auth-Verified"] != "true" {
180 t.Errorf("Verified = %q, want true", p.Body.AuthHeaders["X-E2A-Auth-Verified"])
181 }
182}
183
184func TestOutboundRequiresAuth(t *testing.T) {
185 pool := testutil.TestDB(t)

Callers

nothing calls this directly

Calls 7

TestDBFunction · 0.92
WebhookReceiverFunction · 0.92
TestServerFunction · 0.92
setupDomainAndAgentFunction · 0.85
EmailAddressMethod · 0.80
WaitForPayloadsMethod · 0.80
CloseMethod · 0.45

Tested by

no test coverage detected