vm-tests.yml: Fix distupgrade tests

Signed-off-by: Tobias Knöppler <6317548+theCalcaholic@users.noreply.github.com>
This commit is contained in:
Tobias Knöppler 2024-09-05 20:22:32 +02:00
parent 325834f86a
commit 90ef9dba53
No known key found for this signature in database
GPG Key ID: 44FD368932E645C1
5 changed files with 46 additions and 8 deletions

View File

@ -13,7 +13,7 @@ inputs:
server_type:
description: Server type to use for hetzner servers
required: true
default: "cx11"
default: "cx22"
outputs:
server_address:

View File

@ -13,7 +13,7 @@ inputs:
server_type:
description: Server type to use for hetzner servers
required: true
default: "cx11"
default: "cx22"
outputs:
server_address:

View File

@ -541,7 +541,7 @@ jobs:
sudo "$LXC" exec ncp -- /usr/local/bin/ncc status
current_nc_version_new="$(sudo "$LXC" exec ncp -- ncc status | grep "version:" | awk '{ print $3 }')"
if [[ "$current_nc_version" =~ "$latest_nc_version".* ]]
if [[ "$current_nc_version_new" =~ "$latest_nc_version".* ]]
then
break
fi

View File

@ -64,7 +64,7 @@ jobs:
version: ${{ env.VERSION }}
uid: "${{ env.UID }}"
hcloud_token: ${{ secrets.TEST_AUTOMATION_HCLOUD_API_TOKEN }}
server_type: "cx11"
server_type: "cx22"
- name: set instance variables
run: |
echo "SERVER_ADDRESS=${{ steps.create-test-instance.outputs.server_address }}" >> "$GITHUB_ENV"
@ -314,7 +314,7 @@ jobs:
version: "${{ env.PREVIOUS_VERSION }}"
uid: "${{ env.UID }}"
hcloud_token: ${{ secrets.TEST_AUTOMATION_HCLOUD_API_TOKEN }}
server_type: "cx11"
server_type: "cx22"
- name: Set instance variables
run: |
echo "SERVER_ADDRESS=${{ steps.create-test-instance.outputs.server_address }}" >> "$GITHUB_ENV"
@ -341,7 +341,7 @@ jobs:
echo "Run integration tests"
ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null" "root@${SERVER_ADDRESS}" cat /usr/local/etc/instance.cfg
test-ncp-instance -a -f "$SNAPSHOT_ID" -b "${VERSION}" --systemtest-args "--skip-update-test" --nc-test-args "--skip-release-check" "root@${SERVER_ADDRESS}" "localhost" "8443" "9443" || {
test-ncp-instance -a -f "$SNAPSHOT_ID" -b "v1.54.3" --systemtest-args "--skip-update-test" --nc-test-args "--skip-release-check" "root@${SERVER_ADDRESS}" "localhost" "8443" "9443" || {
echo "Integration tests failed"
echo "Here are the last lines of ncp-install.log:"
@ -387,7 +387,7 @@ jobs:
NC_TEST_ARGS=()
ssh "${SSH_OPTIONS[@]}" "root@${SERVER_ADDRESS}" cat /etc/os-release | grep VERSION_ID=12 || NC_TEST_ARGS+=("--skip-release-check")
set -x
test-ncp-instance -f "$SNAPSHOT_ID" -b "${VERSION}" --nc-test-args "$NC_TEST_ARGS" --systemtest-args "--skip-update-test" "root@${SERVER_ADDRESS}" "localhost" "8443" "9443" || {
test-ncp-instance -f "$SNAPSHOT_ID" -b "v1.54.3" --nc-test-args "$NC_TEST_ARGS" --systemtest-args "--skip-update-test" "root@${SERVER_ADDRESS}" "localhost" "8443" "9443" || {
echo "Integration tests failed"
echo "Here are the last lines of ncp-install.log:"
@ -420,6 +420,45 @@ jobs:
}
ssh "${SSH_OPTIONS[@]}" "root@${SERVER_ADDRESS}" DEBIAN_FRONTEND=noninteractive ncp-dist-upgrade
echo "skipped=no" | tee -a $GITHUB_OUTPUT
- name: Update Nextcloud
working-directory: /__w/nextcloudpi/nextcloudpi/ncp-test-automation/bin
run: |
set -ex
apk add jq
echo "Setup ssh"
eval "$(ssh-agent)"
ssh-add /__w/nextcloudpi/nextcloudpi/.ssh/automation_ssh_key
source ./library.sh
current_nc_version="$(ssh "${SSH_OPTIONS[@]}" "root@${SERVER_ADDRESS}" "ncc status" | grep "version:" | awk '{ print $3 }')"
latest_nc_version="$(cat ../../etc/ncp.cfg | jq -r '.nextcloud_version')"
if [[ "$current_nc_version" =~ "$latest_nc_version".* ]]
then
echo "Nextcloud is up to date - skipping NC update test."
else
for i in {1..10};
do
echo "running nc update ($i/10)..."
ssh "${SSH_OPTIONS[@]}" "root@${SERVER_ADDRESS}" "bash -c 'DBG=x ncp-update-nc ${latest_nc_version?}'"
ssh "${SSH_OPTIONS[@]}" "root@${SERVER_ADDRESS}" /usr/local/bin/ncc status
current_nc_version_new="$(ssh "${SSH_OPTIONS[@]}" "root@${SERVER_ADDRESS}" "ncc status" | grep "version:" | awk '{ print $3 }')"
if [[ "$current_nc_version_new" =~ "$latest_nc_version".* ]]
then
break
fi
if [[ "$current_nc_version" == "$current_nc_version_new" ]]
then
echo "failed to update to $latest_nc_version"
exit 1
fi
current_nc_version="$current_nc_version_new"
done
fi
- name: Run integration tests after dist-upgrade
id: final_test

View File

@ -139,7 +139,6 @@ class SettingsService {
$stderr = stream_get_contents($pipes[2]);
fclose($pipes[2]);
$this->logger->error("STDERR: $stderr");
return [proc_close($proc), $stdout, $stderr];
}
}