From 50df13db496e0d860573af06f7e7387b1e76f33a Mon Sep 17 00:00:00 2001 From: denisonbarbosa Date: Mon, 2 Dec 2024 09:20:20 -0400 Subject: [PATCH] Update check for polkit configuration in e2e tests We used to rely only on a single way of applying the privilege policy. Now, we have two ways of applying it based on the polkit version. The e2e tests validation needs to account for that. --- e2e/cmd/run_tests/11_test_pro_managers/main.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/e2e/cmd/run_tests/11_test_pro_managers/main.go b/e2e/cmd/run_tests/11_test_pro_managers/main.go index 35a1e587a..d9217de4d 100644 --- a/e2e/cmd/run_tests/11_test_pro_managers/main.go +++ b/e2e/cmd/run_tests/11_test_pro_managers/main.go @@ -139,8 +139,15 @@ func action(ctx context.Context, cmd *command.Command) (err error) { "adminuser@warthogs.biz" ALL=(ALL:ALL) ALL`); err != nil { return err } + + // Due to differences in polkit versions between Ubuntu versions, the file path is different + polkitFilePath := "/etc/polkit-1/rules.d/00-adsys-privilege-enforcement.rules" + if cmd.Inventory.Codename == "focal" || cmd.Inventory.Codename == "jammy" { + polkitFilePath = "/etc/polkit-1/localauthority.conf.d/99-adsys-privilege-enforcement.conf" + } + // Only partly assert the polkit file contents as there are differences in polkit configurations between Ubuntu versions - if err := rootClient.RequireContains(ctx, "cat /etc/polkit-1/localauthority.conf.d/99-adsys-privilege-enforcement.conf", "unix-user:adminuser@warthogs.biz"); err != nil { + if err := rootClient.RequireContains(ctx, fmt.Sprintf("cat %s", polkitFilePath), "unix-user:adminuser@warthogs.biz"); err != nil { return err }