Skip to content

Commit

Permalink
Update check for polkit configuration in e2e tests
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
denisonbarbosa committed Dec 2, 2024
1 parent 1e3563a commit 50df13d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion e2e/cmd/run_tests/11_test_pro_managers/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,15 @@ func action(ctx context.Context, cmd *command.Command) (err error) {
"[email protected]" 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:[email protected]"); err != nil {
if err := rootClient.RequireContains(ctx, fmt.Sprintf("cat %s", polkitFilePath), "unix-user:[email protected]"); err != nil {
return err
}

Expand Down

0 comments on commit 50df13d

Please sign in to comment.