Merge pull request #262776 from pennae/mosquitto-skip-bind-test

nixos/mosquitto: remove the bind_interface test
This commit is contained in:
Martin Weinelt 2023-10-22 19:28:24 +02:00 committed by GitHub
commit 8c5947252d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,7 +4,6 @@ let
port = 1888;
tlsPort = 1889;
anonPort = 1890;
bindTestPort = 18910;
password = "VERY_secret";
hashedPassword = "$7$101$/WJc4Mp+I+uYE9sR$o7z9rD1EYXHPwEP5GqQj6A7k4W1yVbePlb8TqNcuOLV9WNCiDgwHOB0JHC1WCtdkssqTBduBNUnUGd6kmZvDSw==";
topic = "test/foo";
@ -127,10 +126,6 @@ in {
};
};
}
{
settings.bind_interface = "eth0";
port = bindTestPort;
}
];
};
};
@ -140,8 +135,6 @@ in {
};
testScript = ''
import json
def mosquitto_cmd(binary, user, topic, port):
return (
"mosquitto_{} "
@ -174,27 +167,6 @@ in {
start_all()
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"):
client1.succeed(publish("-m test", "password_store"))
client1.succeed(publish("-m test", "password_file"))