This test checks the detection of the default initial branch. It is a hard
thing to test since different platform configurations have different
defaults. checkupdates is basically only used on GNU/Linux anyway.
Here's the failure:
https://gitlab.com/fdroid/fdroidserver/-/jobs/8896420261
On some systems, localhost is only defined for 127.0.0.1 (e.g. Ubuntu
and Debian containers). However, there is code that hardcodes possible
values for localhost, making it possible to open an IPv6 socket for
localhost.
On those systems, the socket will be open but urllib3 will resolve
localhost *only* to 127.0.0.1, thus failing miserably to connect.
To resolve the situation, rather than defaulting to IPv6 we actually
resolve localhost and use the socket family of the first result. On my
current system (upcoming Ubuntu Plucky) if localhost=::1 is defined in
/etc/hosts it will come up as the first result, if not 127.0.0.1 will.
V2: Use self.port rather than a forgotten hardcoded port.
Fixes: f01628ca6b "fix localhost network tests on systems with IPv6"
verified.json can get quite large on verification.f-droid.org, and for some
unknown reason, it sometimes corrupts it when writing it out. All the data
is already available in all the other JSON files, so this just automatically
reconstructs it. Its a hack, but it took me much less time than I've
already spent trying to troubleshoot why it writes out corrupt verified.json.
ZipFile.namelist() produces a string per file. The filename could contain
newline chars, including at the beginning and end. ^$ in regex matches
around newline chars. \A\Z matches the beginning/end of the full string.
This is exactly the same as obfusk's r'\AMETA-INF/(?s:.)*\.(DSA|EC|RSA)\Z'
but in a readable format that is also easily searchable, and standard for
this code base.
https://github.com/obfusk/fdroid-fakesigner-poc/blob/master/fdroidserver-regex.patch#1251
Proxy settings via environment variables can interfere with this
test. The requests library will automatically pick up proxy
settings from environment variables. Proxy settings can force the
local connection over the proxy, which might not support that,
then this fails with an error like 405 or others.
The tests in tests/run-tests do provide coverage for these cases, but it is
not explicit, but just comes from testing that the index file has not
changed. These tests make it explicit what is being tested.
To avoid having thousands of branches on checkupdatess-bot's remote, this
cleans up any remote branches that are pointing to commit that has been
fully merged.
When walking through the repo, there may be another settings.gradle in a
sub project with a different catalog. In the subdir the catalog of the
sub project shuold be used and in other subdir the catalog of the root
project should be used.
The SUSS rule sets are changing all the time, but the test cases are not.
So this makes the test cases just use the built-in ruleset so the test
cases don't randomly break.