Use IPv6 in test server, log to stderr
spamc by default first tries IPv6, then IPv4, so let's use IPv6, too.
This commit is contained in:
parent
672a3095f4
commit
8c1c9f4692
1 changed files with 4 additions and 3 deletions
|
@ -2,7 +2,7 @@ use spamassassin_milter::ConfigBuilder;
|
||||||
use std::{
|
use std::{
|
||||||
ffi::OsString,
|
ffi::OsString,
|
||||||
io::{ErrorKind, Read, Write},
|
io::{ErrorKind, Read, Write},
|
||||||
net::{Ipv4Addr, Shutdown, SocketAddrV4, TcpListener},
|
net::{Ipv6Addr, Shutdown, SocketAddr, TcpListener},
|
||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
process::{Command, ExitStatus},
|
process::{Command, ExitStatus},
|
||||||
thread::{self, JoinHandle},
|
thread::{self, JoinHandle},
|
||||||
|
@ -14,7 +14,8 @@ use std::{
|
||||||
// the configuration file location.
|
// the configuration file location.
|
||||||
pub fn isolate_from_spamc_conf(mut builder: ConfigBuilder) -> ConfigBuilder {
|
pub fn isolate_from_spamc_conf(mut builder: ConfigBuilder) -> ConfigBuilder {
|
||||||
// Must use `-F` instead of `--config` due to a bug in `spamc`.
|
// Must use `-F` instead of `--config` due to a bug in `spamc`.
|
||||||
builder.spamc_args(vec!["-F", "/dev/null"]);
|
// Additionally, `--log-to-stderr` avoids polluting syslog with test output.
|
||||||
|
builder.spamc_args(vec!["-F", "/dev/null", "--log-to-stderr"]);
|
||||||
builder
|
builder
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +30,7 @@ pub fn spawn_mock_spamd_server<F>(port: u16, f: F) -> JoinHandle<()>
|
||||||
where
|
where
|
||||||
F: Fn(String) -> HamOrSpam + Send + 'static,
|
F: Fn(String) -> HamOrSpam + Send + 'static,
|
||||||
{
|
{
|
||||||
let socket_addr = SocketAddrV4::new(Ipv4Addr::LOCALHOST, port);
|
let socket_addr = SocketAddr::new(Ipv6Addr::LOCALHOST.into(), port);
|
||||||
let timeout = Duration::from_secs(15);
|
let timeout = Duration::from_secs(15);
|
||||||
|
|
||||||
thread::spawn(move || {
|
thread::spawn(move || {
|
||||||
|
|
Loading…
Reference in a new issue