(t *testing.T)
| 358 | } |
| 359 | |
| 360 | func TestMsgPipeline_PerSourceReject(t *testing.T) { |
| 361 | target := testutils.Target{} |
| 362 | d := MsgPipeline{ |
| 363 | msgpipelineCfg: msgpipelineCfg{ |
| 364 | perSource: map[string]sourceBlock{ |
| 365 | "sender1@example.com": { |
| 366 | perRcpt: map[string]*rcptBlock{}, |
| 367 | defaultRcpt: &rcptBlock{ |
| 368 | targets: []module.DeliveryTarget{&target}, |
| 369 | }, |
| 370 | }, |
| 371 | "example.com": { |
| 372 | perRcpt: map[string]*rcptBlock{}, |
| 373 | rejectErr: errors.New("go away"), |
| 374 | }, |
| 375 | }, |
| 376 | defaultSource: sourceBlock{rejectErr: errors.New("go away")}, |
| 377 | }, |
| 378 | Log: testutils.Logger(t, "msgpipeline"), |
| 379 | } |
| 380 | |
| 381 | testutils.DoTestDelivery(t, &d, "sender1@example.com", []string{"rcpt@example.com"}) |
| 382 | |
| 383 | _, err := d.StartDelivery(context.Background(), &module.MsgMetadata{ID: "testing"}, "sender2@example.com") |
| 384 | if err == nil { |
| 385 | t.Error("expected error for delivery.StartDelivery, got nil") |
| 386 | } |
| 387 | |
| 388 | _, err = d.StartDelivery(context.Background(), &module.MsgMetadata{ID: "testing"}, "sender2@example.org") |
| 389 | if err == nil { |
| 390 | t.Error("expected error for delivery.StartDelivery, got nil") |
| 391 | } |
| 392 | } |
| 393 | |
| 394 | func TestMsgPipeline_PerRcptReject(t *testing.T) { |
| 395 | target := testutils.Target{} |
nothing calls this directly
no test coverage detected