nixos/mosquitto: remove the bind_interface test

bind_interface is the mosquitto way of trying to bind to all addresses
on an interface, but it is unreliable (trying to bind to link-local v6
addresses *sometimes* but not always) and just prone to failure in
general for reasons we have yet to discover.

since this kind of automatic behavior isn't particularly necessary in a
declarative system we may as well skip it.
This commit is contained in:
pennae 2023-10-22 19:12:26 +02:00
parent 5883b305e7
commit 33ba318db6

View file

@ -4,7 +4,6 @@ let
port = 1888; port = 1888;
tlsPort = 1889; tlsPort = 1889;
anonPort = 1890; anonPort = 1890;
bindTestPort = 18910;
password = "VERY_secret"; password = "VERY_secret";
hashedPassword = "$7$101$/WJc4Mp+I+uYE9sR$o7z9rD1EYXHPwEP5GqQj6A7k4W1yVbePlb8TqNcuOLV9WNCiDgwHOB0JHC1WCtdkssqTBduBNUnUGd6kmZvDSw=="; hashedPassword = "$7$101$/WJc4Mp+I+uYE9sR$o7z9rD1EYXHPwEP5GqQj6A7k4W1yVbePlb8TqNcuOLV9WNCiDgwHOB0JHC1WCtdkssqTBduBNUnUGd6kmZvDSw==";
topic = "test/foo"; topic = "test/foo";
@ -127,10 +126,6 @@ in {
}; };
}; };
} }
{
settings.bind_interface = "eth0";
port = bindTestPort;
}
]; ];
}; };
}; };
@ -140,8 +135,6 @@ in {
}; };
testScript = '' testScript = ''
import json
def mosquitto_cmd(binary, user, topic, port): def mosquitto_cmd(binary, user, topic, port):
return ( return (
"mosquitto_{} " "mosquitto_{} "
@ -174,27 +167,6 @@ in {
start_all() start_all()
server.wait_for_unit("mosquitto.service") server.wait_for_unit("mosquitto.service")
with subtest("bind_interface"):
addrs = dict()
for iface in json.loads(server.succeed("ip -json address show")):
for addr in iface['addr_info']:
# don't want to deal with multihoming here
assert addr['local'] not in addrs
addrs[addr['local']] = (iface['ifname'], addr['family'])
# mosquitto grabs *one* random address per type for bind_interface
(has4, has6) = (False, False)
for line in server.succeed("ss -HlptnO sport = ${toString bindTestPort}").splitlines():
items = line.split()
if "mosquitto" not in items[5]: continue
listener = items[3].rsplit(':', maxsplit=1)[0].strip('[]')
assert listener in addrs
assert addrs[listener][0] == "eth0"
has4 |= addrs[listener][1] == 'inet'
has6 |= addrs[listener][1] == 'inet6'
assert has4
assert has6
with subtest("check passwords"): with subtest("check passwords"):
client1.succeed(publish("-m test", "password_store")) client1.succeed(publish("-m test", "password_store"))
client1.succeed(publish("-m test", "password_file")) client1.succeed(publish("-m test", "password_file"))