Skip to content

Commit

Permalink
Added tests for ufw allow salt
Browse files Browse the repository at this point in the history
  • Loading branch information
David Murphy committed Aug 4, 2023
1 parent 2730c88 commit 51679fd
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog/64572.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added salt.ufw to salt-master install on Debian and Ubuntu
1 change: 1 addition & 0 deletions pkg/debian/salt-master.dirs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/etc/salt/master.d
/etc/ufw/applications.d/salt-master
/etc/salt/pki/master/minions
/etc/salt/pki/master/minions_autosign
/etc/salt/pki/master/minions_denied
Expand Down
21 changes: 21 additions & 0 deletions tests/pytests/integration/daemons/test_masterapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import os
import shutil
import stat
import subprocess

import pytest

Expand Down Expand Up @@ -120,3 +121,23 @@ def test_autosign_grains_fail(
) # get minion to try to authenticate itself again
assert salt_minion.id not in salt_key_cli.run("-l", "acc")
assert salt_minion.id in salt_key_cli.run("-l", "un")


@pytest.mark.skip_unless_on_linux
@pytest.mark.slow_test
def test_ufw_allow(salt_master, grains):
if grains["os_family"] != "Debian":
pytest.skip("Only runs on Debian family.")

expected_output = """Skipping adding existing rule
Skipping adding existing rule (v6)
"""

proc = subprocess.Popen(
"ufw allow salt\n", shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE
)
out, err = proc.communicate()
out_strg = out.decode()
err_strg = err.decode()
assert out_strg == expected_output
assert err_strg != "ERROR: Could not find a profile matching 'salt'"

0 comments on commit 51679fd

Please sign in to comment.