@@ 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
}
@@ 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")