From ed07005174acbfffbc08824f97a096ee61d5f595 Mon Sep 17 00:00:00 2001 From: Hadi Chokr Date: Fri, 15 Aug 2025 10:33:30 +0300 Subject: [PATCH] Create 111-upgrade.bats Signed-off-by: Hadi Chokr --- test/system/111-upgrade.bats | 74 ++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 test/system/111-upgrade.bats diff --git a/test/system/111-upgrade.bats b/test/system/111-upgrade.bats new file mode 100644 index 0000000..e84b972 --- /dev/null +++ b/test/system/111-upgrade.bats @@ -0,0 +1,74 @@ +# shellcheck shell=bats +# +# Copyright © 2025 Hadi Chokr +# Licensed under the Apache License, Version 2.0 (the "License"); +# You may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# bats file_tags=commands-options + +load 'libs/bats-support/load' +load 'libs/bats-assert/load' +load 'libs/helpers' + +setup() { + bats_require_minimum_version 1.8.0 + cleanup_all +} + +teardown() { + cleanup_all +} + +@test "upgrade(Arch): Upgrade Arch container" { + create_distro_container arch latest arch-toolbox-test + run container_started arch-toolbox-test + assert_success + + run "$TOOLBX" upgrade --container arch-toolbox-test + assert_success + + # Optional: check container still runs after upgrade + run container_started arch-toolbox-test + assert_success +} + +@test "upgrade(Ubuntu 25.04): Upgrade Ubuntu container" { + create_distro_container ubuntu 25.04 ubuntu-toolbox-test + run container_started ubuntu-toolbox-test + assert_success + + run "$TOOLBX" upgrade --container ubuntu-toolbox-test + assert_success + + # Optional: check container still runs after upgrade + run container_started ubuntu-toolbox-test + assert_success +} + +@test "upgrade(All): Upgrade all containers" { + create_distro_container arch latest arch-toolbox-all-test + create_distro_container ubuntu 25.04 ubuntu-toolbox-all-test + + run container_started arch-toolbox-all-test + assert_success + run container_started ubuntu-toolbox-all-test + assert_success + + run "$TOOLBX" upgrade --all + assert_success + + # Optional: check both containers still run + run container_started arch-toolbox-all-test + assert_success + run container_started ubuntu-toolbox-all-test + assert_success +}