Skip to content

Commit

Permalink
[avocado] Upgrade avocado to 103.X LTS
Browse files Browse the repository at this point in the history
Extra changes required due to module and function changes

Closes: sosreport#3588
Resolves: sosreport#3594

Co-authored-by: Jake Hunsaker <[email protected]>
Signed-off-by: Arif Ali <[email protected]>
  • Loading branch information
arif-ali and TurboTurtle committed Apr 11, 2024
1 parent 46cd148 commit 6a96cba
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
16 changes: 5 additions & 11 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ deb_build_task:
apt -y install devscripts equivs python3-pip
mk-build-deps
apt -y install ./sosreport-build-deps*.deb
pip3 install avocado-framework==94.0 --break-system-packages
pip3 install "avocado-framework<104.0" --break-system-packages
main_script: |
dpkg-buildpackage -b -us -uc -rfakeroot -m --build-by="[email protected]"
prep_artifacts_script: mv ../*.deb ./sos_cirrus.deb
Expand Down Expand Up @@ -226,13 +226,13 @@ report_stageone_task:
fi
PIP_EXTRA=""
[[ $(pip3 install --help | grep break-system) ]] && PIP_EXTRA="--break-system-packages"
pip3 install avocado-framework==94.0 ${PIP_EXTRA}
pip3 install "avocado-framework<104.0" ${PIP_EXTRA}
# run the unittests separately as they require a different PYTHONPATH in
# order for the imports to work properly under avocado
unittest_script: &unit_test |
PYTHONPATH=. avocado run tests/unittests/
main_script: &stageone_test
PYTHONPATH=tests/ avocado run -p TESTLOCAL=true --test-runner=runner -t stageone tests/{cleaner,collect,report,vendor}_tests
PYTHONPATH=tests/ avocado run -p TESTLOCAL=true --max-parallel-tasks=1 -t stageone tests/{cleaner,collect,report,vendor}_tests
on_failure:
fail_script: &faillogs |
ls -d /var/tmp/avocado* /root/avocado* 2> /dev/null | xargs tar cf sos-fail-logs.tar
Expand All @@ -252,11 +252,6 @@ report_stageone_daily_task:
environment:
PKG: "snap"
setup_script: *setup
avocado_install_script: &avocado_setup |
pip3 uninstall -y avocado-framework --break-system-packages
git clone --single-branch -b 92lts https://github.com/avocado-framework/avocado.git
cd avocado
make install
unittest_script: *unit_test
main_script: *stageone_test
on_failure:
Expand Down Expand Up @@ -285,7 +280,7 @@ report_stagetwo_task:
dnf -y install python3-pexpect
fi
main_script: &stagetwo_test |
PYTHONPATH=tests/ avocado run -p TESTLOCAL=true --test-runner=runner -t stagetwo tests/{cleaner,collect,report,vendor}_tests
PYTHONPATH=tests/ avocado run -p TESTLOCAL=true --max-parallel-tasks=1 -t stagetwo tests/{cleaner,collect,report,vendor}_tests
on_failure:
fail_script: *faillogs
log_artifacts: *logs
Expand All @@ -303,7 +298,6 @@ report_stagetwo_daily_task:
environment:
PKG: "snap"
setup_script: *setup
avocado_install_script: *avocado_setup
main_script: *stagetwo_test
on_failure:
fail_script: *faillogs
Expand Down Expand Up @@ -335,7 +329,7 @@ report_foreman_task:
FOREMAN_VER: "3.7"
setup_script: *setup
foreman_setup_script: ./tests/test_data/foreman_setup.sh
main_script: PYTHONPATH=tests/ avocado run -p TESTLOCAL=true --test-runner=runner -t foreman tests/product_tests/foreman/
main_script: PYTHONPATH=tests/ avocado run -p TESTLOCAL=true --max-parallel-tasks=1 -t foreman tests/product_tests/foreman/
on_failure:
fail_script: *faillogs
log_artifacts: *logs
2 changes: 1 addition & 1 deletion tests/collect_tests/help_output_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from sos_tests import StageOneOutputTest, SOS_REPO_ROOT, skipIf

installer = software_manager
sm = installer.SoftwareManager()
sm = installer.manager.SoftwareManager()

PEXPECT_PRESENT = sm.check_installed('python3-pexpect')

Expand Down
8 changes: 5 additions & 3 deletions tests/sos_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from avocado import Test
from avocado.utils import archive, process, distro, software_manager
from avocado.utils.cpu import get_arch
from avocado.utils.software_manager import distro_packages
from fnmatch import fnmatch

import glob
Expand All @@ -29,7 +30,7 @@
SOS_TEST_DATA_DIR = os.path.realpath(os.path.join(SOS_TEST_DIR, 'test_data'))
SOS_TEST_BIN = os.path.realpath(os.path.join(SOS_TEST_DIR, '../bin/sos'))

RH_DIST = ['rhel', 'centos', 'fedora']
RH_DIST = ['rhel', 'centos', 'fedora', 'centos-stream']
UBUNTU_DIST = ['Ubuntu', 'debian']

def skipIf(cond, message=None):
Expand Down Expand Up @@ -772,7 +773,7 @@ def setUp(self):
# seems awkward, but check_installed() and remove() are not exposed
# together with install_distro_packages()
self.installer = software_manager
self.sm = self.installer.SoftwareManager()
self.sm = self.installer.manager.SoftwareManager()

for dist in self.packages:
if isinstance(self.packages[dist], str):
Expand All @@ -787,6 +788,7 @@ def setUp(self):
self.packages['fedora'] = self.packages['rhel']
if 'rhel' in keys:
self.packages['centos'] = self.packages['rhel']
self.packages['centos-stream'] = self.packages['rhel']

super(StageTwoReportTest, self).setUp()

Expand Down Expand Up @@ -842,7 +844,7 @@ def setup_mocked_packages(self):
self._strip_installed_packages()
if not self.packages[self.local_distro]:
return
installed = self.installer.install_distro_packages(self.packages)
installed = distro_packages.install_distro_packages(self.packages)
if not installed:
raise Exception(
"Unable to install requested packages %s"
Expand Down

0 comments on commit 6a96cba

Please sign in to comment.