A library for testing milters.
The API provided is powerful, but rather low-level. It provides little guidance on how to interact with the milter under test. You must be familiar with the steps of an SMTP conversation. See the included tests for basic usage, and consult the sendmail API documentation.
The purpose of indymilter-test is exercising some milter and checking that it behaves as expected. Running the milter is out of scope for this library. You must arrange for the milter to be set up and torn down yourself. In any case, indymilter-test requires to be passed a listening socket to talk to the milter under test.
When designing a test case, keep in mind that your method calls on
TestConnection should be those of a well-behaved MTA. The sequence of
steps will usually be: open the connection, interact with the milter under
test while asserting expected responses, close the connection. As mentioned,
familiarity with the milter protocol is assumed.
As a quick overview, the following are the SMTP commands that an MTA may forward to a milter, in order. Negotiation is done automatically when opening the test connection.
During the message-scoped commands,
processing for the current message. The commands indicated may be called
The optional feature
regex enables implementations of
- Flags that represent
- A matcher that accepts any input.
- End-of-message actions received from the milter.
- Flags that represent milter protocol options.
- A milter test connection.
- A builder for milter test connections.
- An end-of-message action performed by a milter.
- The stage for which macros are sent.
- Socket information.
- The status returned for a milter command.
- Errors that may occur when interacting with the milter API.
- Infallible conversion to a C string.
- Infallible conversion to
- A matcher for results expected from a milter.
- Returns a matcher that accepts any input.
- A result type specialised for test errors.
- The type of the milter protocol version.