From 0613e9000b6e39eb48e44d2e3101fc42c28f965e Mon Sep 17 00:00:00 2001 From: Vladimir Ischenko Date: Fri, 24 Jan 2025 08:48:40 +0300 Subject: [PATCH] Test OCI --- tests/vagrant/install.sh | 47 +++++++++++++++------------------------- 1 file changed, 17 insertions(+), 30 deletions(-) diff --git a/tests/vagrant/install.sh b/tests/vagrant/install.sh index f531cb6f5a9..2c85aca49ab 100644 --- a/tests/vagrant/install.sh +++ b/tests/vagrant/install.sh @@ -63,7 +63,7 @@ function check_hw() { # Outputs: None ############################################################################################# function add-repo-deb() { - mkdir -p "$HOME"/.gnupg && chmod 700 "$HOME"/.gnupg + mkdir -p -m 700 $HOME/.gnupg echo "deb [signed-by=/usr/share/keyrings/onlyoffice.gpg] https://nexus.onlyoffice.com/repository/4testing-debian stable main" | \ sudo tee /etc/apt/sources.list.d/onlyoffice4testing.list curl -fsSL https://download.onlyoffice.com/GPG-KEY-ONLYOFFICE | \ @@ -165,33 +165,20 @@ function prepare_vm() { if [ -f /etc/os-release ]; then source /etc/os-release case $ID in - ubuntu) - [[ "${TEST_REPO_ENABLE}" == 'true' ]] && add-repo-deb - ;; - - debian) - [ "$VERSION_CODENAME" == "bookworm" ] && apt-get update -y && apt install -y curl gnupg - apt-get remove postfix -y && echo "${COLOR_GREEN}☑ PREPAVE_VM: Postfix was removed${COLOR_RESET}" - [[ "${TEST_REPO_ENABLE}" == 'true' ]] && add-repo-deb - ;; - - fedora) - [[ "${TEST_REPO_ENABLE}" == 'true' ]] && add-repo-rpm - if [[ "$VERSION_ID" == "40" || "$VERSION_ID" == "41" ]]; then - resize_fedora_disk - fi - ;; - - centos) - [ "$VERSION_ID" == "8" ] && sed -i 's|^mirrorlist=|#&|; s|^#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|' /etc/yum.repos.d/CentOS-* - [[ "${TEST_REPO_ENABLE}" == 'true' ]] && add-repo-rpm - yum -y install centos*-release - ;; - + debian | ubuntu) + [[ "${TEST_REPO_ENABLE}" == 'true' ]] && add-repo-deb ;; + centos | fedora ) + [[ "${TEST_REPO_ENABLE}" == 'true' ]] && add-repo-rpm ;; *) - echo "${COLOR_RED}Failed to determine Linux dist${COLOR_RESET}"; exit 1 - ;; + echo "${COLOR_RED}Failed to determine Linux dist${COLOR_RESET}"; exit 1 ;; esac + + if [[ "$ID" == "debian" ]]; then + [ "$VERSION_CODENAME" == "bookworm" ] && apt-get update -y && apt install -y curl gnupg + apt-get remove postfix -y && echo "${COLOR_GREEN}☑ PREPAVE_VM: Postfix was removed${COLOR_RESET}" + elif [[ "$ID" == "fedora" ]]; then + resize_fedora_disk + fi else echo "${COLOR_RED}File /etc/os-release doesn't exist${COLOR_RESET}"; exit 1 fi @@ -231,7 +218,7 @@ function install_docspace() { function healthcheck_systemd_services() { for service in "${SERVICES_SYSTEMD[@]}"; do [[ "$service" == *migration* ]] && continue; - if systemctl is-active --quiet "${service}"; then + if systemctl is-active --quiet ${service}; then echo "${COLOR_GREEN}☑ OK: Service ${service} is running${COLOR_RESET}" else echo "${COLOR_RED}⚠ FAILED: Service ${service} is not running${COLOR_RESET}" @@ -272,12 +259,12 @@ function healthcheck_general_status() { # This function succeeds even if the file for cat was not found. For that use ${SKIP_EXIT} variable ############################################################################################# function services_logs() { - mapfile -t SERVICES_SYSTEMD < <(awk '/SERVICE_NAME=\(/{flag=1; next} /\)/{flag=0} flag' "build.sh" | sed -E 's/^[[:space:]]*|[[:space:]]*$//g; s/^/docspace-/; s/$/.service/') + SERVICES_SYSTEMD=($(awk '/SERVICE_NAME=\(/{flag=1; next} /\)/{flag=0} flag' "build.sh" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' | sed 's/^/docspace-/' | sed 's/$/.service/')) SERVICES_SYSTEMD+=("ds-converter.service" "ds-docservice.service" "ds-metrics.service") for service in "${SERVICES_SYSTEMD[@]}"; do echo $LINE_SEPARATOR && echo "${COLOR_GREEN}Check logs for systemd service: $service${COLOR_RESET}" && echo $LINE_SEPARATOR - journalctl -u "$service" -n 30 || true + journalctl -u $service -n 30 || true done local DOCSPACE_LOGS_DIR="/var/log/onlyoffice/docspace" @@ -304,4 +291,4 @@ main() { healthcheck_general_status } -main +main \ No newline at end of file