Skip to content

Commit

Permalink
vm-tests.yml: Fix distupgrade tests
Browse files Browse the repository at this point in the history
Signed-off-by: Tobias Knöppler <[email protected]>
  • Loading branch information
theCalcaholic committed Sep 6, 2024
1 parent 325834f commit c0ca13e
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/actions/create-test-instance-bullseye/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ inputs:
server_type:
description: Server type to use for hetzner servers
required: true
default: "cx11"
default: "cx22"

outputs:
server_address:
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/create-test-instance/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ inputs:
server_type:
description: Server type to use for hetzner servers
required: true
default: "cx11"
default: "cx22"

outputs:
server_address:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-lxd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ jobs:
then
break
fi
if [[ "$current_nc_version" == "$current_nc_version_new" ]]
if [[ "$current_nc_version_new" == "$current_nc_version_new" ]]
then
echo "failed to update to $latest_nc_version"
exit 1
Expand Down
47 changes: 43 additions & 4 deletions .github/workflows/vm-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -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:"
Expand Down Expand Up @@ -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:"
Expand Down Expand Up @@ -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 -e
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
Expand Down
1 change: 0 additions & 1 deletion ncp-app/lib/Service/SettingsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ private function runCommand(string $cmd): array {
$stderr = stream_get_contents($pipes[2]);
fclose($pipes[2]);

$this->logger->error("STDERR: $stderr");
return [proc_close($proc), $stdout, $stderr];
}
}
Expand Down

0 comments on commit c0ca13e

Please sign in to comment.