From f1f5673fed41acbf2d89d157366b534a3f83de23 Mon Sep 17 00:00:00 2001 From: Justin Ludwig Date: Sat, 25 May 2024 19:02:45 -0700 Subject: [PATCH] libsodium package added back to amzn 2023 in September 2023 (for version 2023.2.20230920) --- install.sh | 7 ++++++- test_install/install_amzn_2023.py | 32 ++++++++++++++++++++++++++++--- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index 37a7ed6..934a91d 100755 --- a/install.sh +++ b/install.sh @@ -761,7 +761,12 @@ can_install_libsodium() { test "$(get_package_manager)" || return 0 case "$(get_distro_name)/$(get_distro_version)" in amzn/2022) return 0 ;; - amzn/2023) return 0 ;; + amzn/2023) + awk '{ + split($4, a, "."); + if (int(a[3]) >= 20230920) { print "yes" } + }' /etc/amazon-linux-release + ;; *) echo "yes" ;; esac } diff --git a/test_install/install_amzn_2023.py b/test_install/install_amzn_2023.py index 7284f4e..dbe7abe 100644 --- a/test_install/install_amzn_2023.py +++ b/test_install/install_amzn_2023.py @@ -2,10 +2,10 @@ """Install tests for Amazon Linux 2023.""" import pytest -from .util import exec_docker_shell, read_line, write_cmd, write_fake_cnf +from .util import exec_docker_shell, read_line, read_until, write_cmd, write_fake_cnf -@pytest.mark.timeout(30) +@pytest.mark.timeout(90) def test_forced_install_with_fake_credentials(): with exec_docker_shell("amzn_2023") as proc: write_fake_cnf(proc, credentials=True) @@ -23,4 +23,30 @@ def test_forced_install_with_fake_credentials(): assert read_line(proc).endswith("credentials.conf owner is root") assert read_line(proc).endswith("credentials.conf group is root") assert read_line(proc) == "WARNING libsodium not found" - assert read_line(proc) == "ERROR unable to install libsodium automatically" + assert read_line(proc) == "OK will install libsodium" + assert read_until(proc, "installed libsodium")[-1] == "installed libsodium" + assert read_line(proc).endswith("found at /usr/bin/python3") + assert read_line(proc) == "python includes all packages needed for venv" + assert read_line(proc).startswith("WARNING python virtualenv not found") + assert read_line(proc) == "OK will create virtualenv" + assert read_line(proc) == "created virtualenv" + assert read_line(proc) == "WARNING agent package not installed" + assert read_line(proc) == "OK will install agent" + assert read_until(proc, "installed agent")[-1] == "installed agent" + assert read_line(proc).startswith("WARNING systemd daemon not found") + assert read_line(proc) == "OK will install daemon" + assert read_line(proc) == "installed daemon" + assert read_line(proc) == "WARNING daemon dead" + assert read_line(proc) == "OK will start daemon" + assert read_until(proc, "started daemon")[-1] == "started daemon" + assert read_line(proc) == "install SUCCESS" + + write_cmd(proc, "journalctl -u procustodibus-agent -n2 -q") + assert "Started procustodibus-agent" in read_line(proc) + + write_cmd(proc, "/opt/venvs/procustodibus-agent/bin/procustodibus-agent --test") + assert read_line(proc).startswith("!!! no wg executable found") + assert read_line(proc).endswith("is pro custodibus ip address ...") + assert read_line(proc) == "... healthy pro custodibus api ..." + assert read_line(proc).startswith("!!! cannot access host record") + assert read_line(proc).startswith("Issues encountered") -- 2.45.2