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

Function TestConcurrencyLimit

tests/limits_test.go:30–64  ·  view source on GitHub ↗
(tt *testing.T)

Source from the content-addressed store, hash-verified

28)
29
30func TestConcurrencyLimit(tt *testing.T) {
31 tt.Parallel()
32 t := tests.NewT(tt)
33 t.DNS(nil)
34 t.Port("smtp")
35 t.Config(`
36 smtp tcp://127.0.0.1:{env:TEST_PORT_smtp} {
37 hostname mx.maddy.test
38 tls off
39
40 defer_sender_reject no
41 limits {
42 all concurrency 1
43 }
44
45 deliver_to dummy
46 }
47 `)
48 t.Run(1)
49 defer t.Close()
50
51 c1 := t.Conn("smtp")
52 defer c1.Close()
53 c1.SMTPNegotation("localhost", nil, nil)
54 c1.Writeln("MAIL FROM:<testing@maddy.test>")
55 c1.ExpectPattern("250 *")
56 // Down on semaphore.
57
58 c2 := t.Conn("smtp")
59 defer c2.Close()
60 c2.SMTPNegotation("localhost", nil, nil)
61 c1.Writeln("MAIL FROM:<testing@maddy.test>")
62 // Temporary error due to lock timeout.
63 c1.ExpectPattern("451 *")
64}
65
66func TestPerIPConcurrency(tt *testing.T) {
67 tt.Parallel()

Callers

nothing calls this directly

Calls 11

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

Tested by

no test coverage detected