(tt *testing.T)
| 64 | } |
| 65 | |
| 66 | func TestPerIPConcurrency(tt *testing.T) { |
| 67 | tt.Parallel() |
| 68 | t := tests.NewT(tt) |
| 69 | t.DNS(nil) |
| 70 | t.Port("smtp") |
| 71 | t.Config(` |
| 72 | smtp tcp://127.0.0.1:{env:TEST_PORT_smtp} { |
| 73 | hostname mx.maddy.test |
| 74 | tls off |
| 75 | |
| 76 | defer_sender_reject no |
| 77 | limits { |
| 78 | ip concurrency 1 |
| 79 | } |
| 80 | |
| 81 | deliver_to dummy |
| 82 | } |
| 83 | `) |
| 84 | t.Run(1) |
| 85 | defer t.Close() |
| 86 | |
| 87 | c1 := t.Conn("smtp") |
| 88 | defer c1.Close() |
| 89 | c1.SMTPNegotation("localhost", nil, nil) |
| 90 | c1.Writeln("MAIL FROM:<testing@maddy.test>") |
| 91 | c1.ExpectPattern("250 *") |
| 92 | // Down on semaphore. |
| 93 | |
| 94 | c3 := t.Conn4("127.0.0.2", "smtp") |
| 95 | defer c3.Close() |
| 96 | c3.SMTPNegotation("localhost", nil, nil) |
| 97 | c3.Writeln("MAIL FROM:<testing@maddy.test>") |
| 98 | c3.ExpectPattern("250 *") |
| 99 | // Down on semaphore (different IP). |
| 100 | |
| 101 | c2 := t.Conn("smtp") |
| 102 | defer c2.Close() |
| 103 | c2.SMTPNegotation("localhost", nil, nil) |
| 104 | c1.Writeln("MAIL FROM:<testing@maddy.test>") |
| 105 | // Temporary error due to lock timeout. |
| 106 | c1.ExpectPattern("451 *") |
| 107 | } |
nothing calls this directly
no test coverage detected