MCPcopy Index your code
hub / github.com/foxcpp/maddy / TestIssue321

Function TestIssue321

tests/mta_test.go:84–135  ·  view source on GitHub ↗
(tt *testing.T)

Source from the content-addressed store, hash-verified

82}
83
84func TestIssue321(tt *testing.T) {
85 t := tests.NewT(tt)
86 t.DNS(map[string]mockdns.Zone{
87 "example.invalid.": {
88 AD: true,
89 A: []string{"127.0.0.1"},
90 },
91 })
92 t.Port("smtp")
93 tgtPort := t.Port("remote_smtp")
94 t.Config(`
95 hostname mx.maddy.test
96 tls off
97 smtp tcp://127.0.0.1:{env:TEST_PORT_smtp} {
98 deliver_to remote {
99 mx_auth {
100 dnssec
101 dane
102 }
103 }
104 }`)
105 t.Run(1)
106 defer t.Close()
107
108 be, s := testutils.SMTPServer(tt, "127.0.0.1:"+strconv.Itoa(int(tgtPort)))
109 defer s.Close()
110
111 c := t.Conn("smtp")
112 defer c.Close()
113 c.SMTPNegotation("client.maddy.test", nil, nil)
114 c.Writeln("MAIL FROM:<from@maddy.test>")
115 c.ExpectPattern("250 *")
116 c.Writeln("RCPT TO:<to1@example.invalid>")
117 c.ExpectPattern("250 *")
118 c.Writeln("RCPT TO:<to2@example.invalid>")
119 c.ExpectPattern("250 *")
120 c.Writeln("DATA")
121 c.ExpectPattern("354 *")
122 c.Writeln("From: <from@maddy.test>")
123 c.Writeln("To: <to@maddy.test>")
124 c.Writeln("Subject: Hello!")
125 c.Writeln("")
126 c.Writeln("Hello!")
127 c.Writeln(".")
128 c.ExpectPattern("250 2.0.0 OK: queued")
129 c.Writeln("QUIT")
130 c.ExpectPattern("221 *")
131
132 if be.SessionCounter != 1 {
133 t.Fatal("No actual connection made?", be.SessionCounter)
134 }
135}

Callers

nothing calls this directly

Calls 12

DNSMethod · 0.95
PortMethod · 0.95
ConfigMethod · 0.95
RunMethod · 0.95
CloseMethod · 0.95
ConnMethod · 0.95
NewTFunction · 0.92
SMTPServerFunction · 0.92
SMTPNegotationMethod · 0.80
WritelnMethod · 0.80
ExpectPatternMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected