Port allocates the random TCP port for use by test. It will made accessible in the configuration via environment variables with name in the form TEST_PORT_name. If there is a port with name remote_smtp, it will be passed as the value for the -debug.smtpport parameter.
(name string)
| 144 | // If there is a port with name remote_smtp, it will be passed as the value for |
| 145 | // the -debug.smtpport parameter. |
| 146 | func (t *T) Port(name string) uint16 { |
| 147 | if port := t.ports[name]; port != 0 { |
| 148 | return port |
| 149 | } |
| 150 | |
| 151 | // TODO: Try to bind on port to test its usability. |
| 152 | port := rand.Int31n(45536) + 20000 |
| 153 | t.ports[name] = uint16(port) |
| 154 | t.portsRev[uint16(port)] = name |
| 155 | return uint16(port) |
| 156 | } |
| 157 | |
| 158 | func (t *T) Env(kv string) { |
| 159 | t.env = append(t.env, kv) |
no outgoing calls