From 3b3e00f12321f9cdf192c8b286a68d855b2d4e2a Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Mon, 6 May 2024 11:54:54 -0700 Subject: [PATCH] flatpak: proxy the connection to flathub This is intended to reduce the amount of traffic we generate to flathub, particularly so we can run this test on updates as well as composes. We have to set a proxy and trust an SSL cert. Signed-off-by: Adam Williamson --- tests/flatpak_flathub.pm | 11 ++++++++--- tests/flatpak_update.pm | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/flatpak_flathub.pm b/tests/flatpak_flathub.pm index 27eca221..aaa8f108 100644 --- a/tests/flatpak_flathub.pm +++ b/tests/flatpak_flathub.pm @@ -10,20 +10,25 @@ sub run { my $self = shift; $self->root_console(tty => 3); + # Trust the SSL certificate for the proxy we use to MITM flathub + # to reduce external traffic + # https://pagure.io/fedora-infrastructure/issue/11634 + assert_script_run("curl -o /etc/pki/ca-trust/source/anchors/flathub-proxy.crt https://fedorapeople.org/groups/qa/openqa-data/flathub-proxy.crt"); + assert_script_run("update-ca-trust"); # On Silverblue, Flathub is not set as a Flatpak remote by default, only when Third Party Repos # are enabled. To make sure, we have it enabled, we will use the following command to # add the Flathub repository. - assert_script_run("sudo flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo"); + assert_script_run("sudo http_proxy=http://flatpak-cache01.iad2.fedoraproject.org:3128 flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo"); # Check that the Flathub repository has been added into the repositories. validate_script_output("flatpak remotes", sub { m/flathub/ }); # Now, we can search for an application that only exists in Flathub. - validate_script_output("flatpak search focuswriter", sub { m/org.gottcode.FocusWriter/ }); + validate_script_output("http_proxy=http://flatpak-cache01.iad2.fedoraproject.org:3128 flatpak search focuswriter", sub { m/org.gottcode.FocusWriter/ }); # And we can install it - assert_script_run("flatpak install -y org.gottcode.FocusWriter", timeout => 600); + assert_script_run("http_proxy=http://flatpak-cache01.iad2.fedoraproject.org:3128 flatpak install -y org.gottcode.FocusWriter", timeout => 600); # Check that now the application is listed in the installed flatpaks. assert_script_run("flatpak list | grep org.gottcode.FocusWriter"); diff --git a/tests/flatpak_update.pm b/tests/flatpak_update.pm index 8b3a0d4c..63e49b6e 100644 --- a/tests/flatpak_update.pm +++ b/tests/flatpak_update.pm @@ -19,7 +19,7 @@ sub run { assert_script_run("flatpak remote-add --if-not-exists flatpaktest https://lruzicka.fedorapeople.org/flatpaktest/flatpaktest.flatpakrepo", timeout => 120); # Install the Dummy application. - assert_script_run("flatpak install -y org.flatpak.Dummy", timeout => 600); + assert_script_run("http_proxy=http://flatpak-cache01.iad2.fedoraproject.org:3128 flatpak install -y org.flatpak.Dummy", timeout => 600); # Check that the application has been installed assert_script_run("flatpak list | grep org.flatpak.Dummy");