diff --git a/Makefile b/Makefile index 0c1b80587..1dc9a2928 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ SHELL=/bin/bash PYTHON_VENV ?= python VENVNAME ?= tut -DIST_VERSION ?= 7 +DIST_VERSION ?= 8 CONFDIR=${DESTDIR}/etc/leapp LIBDIR=${DESTDIR}/var/lib/leapp @@ -76,13 +76,13 @@ help: @echo " test_container runs linter and unit tests in a container" @echo " - by default rhel8 container is used" @echo " - can be changed by setting TEST_CONTAINER env variable" - @echo " - available containers are:" rhel{7..10} + @echo " - available containers are:" rhel{8..10} @echo " test_container_all runs linter and tests in all available containers" @echo " lint runs just the linter" @echo " build create the RPM" @echo " build_container create the RPM in container" @echo " - set BUILD_CONTAINER to select the container" - @echo " - available containers are:" el{7..9} f{35..40} rawhide + @echo " - available containers are:" el{8..9} f{35..40} rawhide @echo " - this can't be used to build in parallel," @echo " as build containers operate on the same files" @echo " clean_containers clean container images used for building" @@ -93,8 +93,8 @@ help: @echo " MR=6 " @echo " PR=7 SUFFIX='my_additional_suffix' make " @echo " MR=6 COPR_CONFIG='path/to/the/config/copr/file' " - @echo " TEST_CONTAINER=rhel7 make test_container" - @echo " BUILD_CONTAINER=el7 make build_container" + @echo " TEST_CONTAINER=rhel8 make test_container" + @echo " BUILD_CONTAINER=el8 make build_container" @echo " CONTAINER_TOOL=docker make test_container" @echo "" @@ -151,9 +151,6 @@ build: source build_container: @case "$$BUILD_CONTAINER" in \ - el7) \ - _CONT_FILE="Containerfile.centos7"; \ - ;; \ el[8-9]) \ _CONT_FILE="Containerfile.ubi"$${BUILD_CONTAINER: -1}; \ ;; \ @@ -168,7 +165,7 @@ build_container: exit 1; \ ;; \ *) \ - echo "Available containers are: el{7..9} f{35..40} rawhide"; \ + echo "Available containers are: el{8..9} f{35..40} rawhide"; \ exit 1; \ ;; \ esac && \ @@ -208,10 +205,6 @@ test: lint # TODO(pstodulk): create ticket to add rhel10 for testing.... py: 3.12 test_container: @case $(_TEST_CONTAINER) in \ - rhel7) \ - export _VENV=python2.7; \ - export _CONT_FILE="res/container-tests/Containerfile.ubi7"; \ - ;; \ rhel8) \ export _VENV=python3.6; \ export _CONT_FILE="res/container-tests/Containerfile.ubi8"; \ @@ -226,7 +219,7 @@ test_container: export _CONT_FILE="res/container-tests/Containerfile.ubi10"; \ ;; \ *) \ - echo "Available test containers are: rhel{7..10}"; \ + echo "Available test containers are: rhel{8..10}"; \ exit 1; \ ;; \ esac; \ @@ -236,12 +229,12 @@ test_container: $(_CONTAINER_TOOL) run --rm -v $${PWD}:/payload:Z -e PYTHON_VENV=$$_VENV $$TEST_IMAGE test_container_all: - @for container in "rhel"{7..10}; do \ + @for container in "rhel"{8..10}; do \ TEST_CONTAINER=$$container $(MAKE) test_container; \ done clean_containers: - @for i in "leapp-build-"{el7,el8,el9,f35,f36,rawhide} "leapp-tests-rhel"{7..10}; do \ + @for i in "leapp-build-"{el8,el9,f35,f36,rawhide} "leapp-tests-rhel"{8..10}; do \ [ -z $$($(_CONTAINER_TOOL) images -q "$$i") ] || \ $(_CONTAINER_TOOL) rmi "$$i" > /dev/null 2>&1 || :; \ done @@ -254,7 +247,7 @@ lint: echo '=============== Running pylint ===============' && \ echo '==================================================' && \ echo '==================================================' && \ - [[ "$(_PYTHON_VENV)" == "python2.7" ]] && echo "$$LINTABLES" | xargs pylint --py3k || echo "$$LINTABLES" | xargs pylint && echo '===> pylint PASSED' && \ + [[ "$(_PYTHON_VENV)" == "python3.6" ]] && echo "$$LINTABLES" | xargs pylint --py3k || echo "$$LINTABLES" | xargs pylint && echo '===> pylint PASSED' && \ echo '==================================================' && \ echo '==================================================' && \ echo '=============== Running flake8 ===============' && \ @@ -272,7 +265,7 @@ fast_lint: if [[ "$$LINT_EXIT_CODE" != "0" ]]; then \ exit $$LINT_EXIT_CODE; \ fi; \ - if [[ "$(_PYTHON_VENV)" == "python2.7" ]] ; then \ + if [[ "$(_PYTHON_VENV)" == "python3.6" ]] ; then \ pylint --py3k $$FILES_TO_LINT; \ fi; \ else \ diff --git a/docs/source/best-practices.md b/docs/source/best-practices.md index a46691ae3..11f861a93 100644 --- a/docs/source/best-practices.md +++ b/docs/source/best-practices.md @@ -46,7 +46,7 @@ to a shared library function. You can introduce it in one of these two places: Please note that the name of the library module in this case should be unique and contain the actor name. For example: - `repos/system_upgrade/el7toel8/actors/vimmigrate/libraries/vimmigrate.py` +`repos/system_upgrade/common/actors/checkrhsmsku/libraries/checkrhsmsku.py` ## Discover standard library functions @@ -81,13 +81,11 @@ As with the Leapp Standard Library mentioned above, it may be beneficial for you place in the [leapp-repository](https://github.com/oamg/leapp-repository). You might be interested in the messages they produce, for example: -- [SystemFactsActor](https://github.com/oamg/leapp-repository/blob/main/repos/system_upgrade/el7toel8/actors/systemfacts/actor.py) - +- [SystemFactsActor](https://github.com/oamg/leapp-repository/blob/main/repos/system_upgrade/common/actors/systemfacts/actor.py) - information about kernel modules, yum repos, sysctl variables, users, firewall, SELinux, etc. -- [OSReleaseCollector](https://github.com/oamg/leapp-repository/blob/main/repos/system_upgrade/el7toel8/actors/osreleasecollector/actor.py) - - system release information -- [RpmScanner](https://github.com/oamg/leapp-repository/blob/main/repos/system_upgrade/el7toel8/actors/rpmscanner/actor.py) - +- [RpmScanner](https://github.com/oamg/leapp-repository/blob/main/repos/system_upgrade/common/actors/rpmscanner/actor.py) - list of installed packages -- [StorageScanner](https://github.com/oamg/leapp-repository/blob/main/repos/system_upgrade/el7toel8/actors/storagescanner/actor.py) - +- [StorageScanner](https://github.com/oamg/leapp-repository/blob/main/repos/system_upgrade/common/actors/storagescanner/actor.py) - storage information In case you find any message of the existing actors to be incorrect, incomplete or misleading, we encourage you to diff --git a/docs/source/devenv-install.md b/docs/source/devenv-install.md index 07bf946c5..dbceea305 100644 --- a/docs/source/devenv-install.md +++ b/docs/source/devenv-install.md @@ -10,7 +10,7 @@ Packages are built for EPEL and Fedora. * On CentOS/RHEL: ```shell # yum install -y yum-utils - # yum-config-manager --add-repo https://copr.fedorainfracloud.org/coprs/g/oamg/leapp/repo/epel-7/group_oamg-leapp-epel-7.repo + # yum-config-manager --add-repo https://copr.fedorainfracloud.org/coprs/g/oamg/leapp/repo/epel-8/group_oamg-leapp-epel-8.repo ``` * On Fedora: ```shell diff --git a/docs/source/test-actors.md b/docs/source/test-actors.md index 45f5cb73b..65cd47270 100644 --- a/docs/source/test-actors.md +++ b/docs/source/test-actors.md @@ -21,13 +21,13 @@ Test module names should match the following regex: - These tests deal with individual actor's functions/methods. - It's not possible to unit test any method/function within the *actor.py*. You can write unit tests only for functions/methods within the actor's libraries. - Thus, to be able to write unit tests for an actor, ideally the only thing in the _actor.py_'s _process()_ method is calling the entry-point function of the actor's library python module. -- [Example of unit tests](https://github.com/oamg/leapp-repository/blob/main/repos/system_upgrade/el7toel8/actors/checkbootavailspace/tests/unit_test_checkbootavailspace.py) +- [Example of unit tests](https://github.com/oamg/leapp-repository/blob/main/repos/system_upgrade/common/actors/checkbootavailspace/tests/unit_test_checkbootavailspace.py) ### Component tests - These tests provide fabricated input messages for the actor, check the outputs stated in the actor's description. - These tests should not be written based on the actor's code but rather based on the behavior stated in the actor's description. They could be written by somebody who didn't write the code. -- [Example of component tests](https://github.com/oamg/leapp-repository/blob/main/repos/system_upgrade/el7toel8/actors/checknfs/tests/test_checknfs.py) +- [Example of component tests](https://github.com/oamg/leapp-repository/blob/main/repos/system_upgrade/common/actors/checknfs/tests/test_checknfs.py) ## End to end (e2e) tests diff --git a/docs/source/tutorials/unit-testing.md b/docs/source/tutorials/unit-testing.md index 1571ba182..7b007956e 100644 --- a/docs/source/tutorials/unit-testing.md +++ b/docs/source/tutorials/unit-testing.md @@ -215,7 +215,7 @@ More examples could be found in the ### Shared libraries' tests To run tests of all shared libraries (i.e. libraries stored in -`repo/system_upgrade/el7toel8/libraries`) environment variable +`repo/system_upgrade/*/libraries`) environment variable `TEST_LIBS` need to be set (only in case you use make command): ```sh diff --git a/res/container-builds/Containerfile.centos7 b/res/container-builds/Containerfile.centos7 deleted file mode 100644 index a3b0ea070..000000000 --- a/res/container-builds/Containerfile.centos7 +++ /dev/null @@ -1,11 +0,0 @@ -FROM centos:7 - -VOLUME /payload - -ENV DIST_VERSION 7 - -RUN yum update -y && \ - yum install -y make git rpm-build python-setuptools python-devel - -WORKDIR /payload -ENTRYPOINT make build diff --git a/res/container-tests/Containerfile.ubi7 b/res/container-tests/Containerfile.ubi7 deleted file mode 100644 index fd5b965c5..000000000 --- a/res/container-tests/Containerfile.ubi7 +++ /dev/null @@ -1,21 +0,0 @@ -FROM registry.access.redhat.com/ubi7/ubi:7.9 - -VOLUME /payload - -RUN yum -y install python27-python-pip && \ - scl enable python27 -- pip install -U --target /usr/lib/python2.7/site-packages/ pip==20.3.0 && \ - python -m pip install --ignore-installed pip==20.3.4 virtualenv - -WORKDIR /payload -ENTRYPOINT virtualenv testenv && \ - source testenv/bin/activate && \ - pip install -U setuptools && \ - pip install -U funcsigs && \ - pip install -U -r requirements-tests.txt && \ - pip install -U . && \ - echo '==================================================' && \ - echo '==================================================' && \ - echo '=============== Running tests ===============' && \ - echo '==================================================' && \ - echo '==================================================' && \ - py.test -vv --cov-report term-missing --cov=leapp tests/scripts/*.py diff --git a/res/container-tests/Containerfile.ubi7-lint b/res/container-tests/Containerfile.ubi7-lint deleted file mode 100644 index 2e1de4a63..000000000 --- a/res/container-tests/Containerfile.ubi7-lint +++ /dev/null @@ -1,28 +0,0 @@ -FROM registry.access.redhat.com/ubi7/ubi:7.9 - -VOLUME /payload - -RUN yum -y install python27-python-pip && \ - scl enable python27 -- pip install -U --target /usr/lib/python2.7/site-packages/ pip==20.3.0 && \ - python -m pip install --ignore-installed pip==20.3.4 virtualenv - -WORKDIR /payload -ENTRYPOINT virtualenv testenv && \ - source testenv/bin/activate && \ - pip install -U setuptools && \ - pip install -U funcsigs && \ - pip install -U -r requirements-tests.txt && \ - pip install -U . && \ - export LINTABLES=$(find . -name '*.py' | grep -E -e '^\./leapp\/' -e '^\./tests/scripts/' | sort -u ) && \ - echo '==================================================' && \ - echo '==================================================' && \ - echo '=============== Running pylint ===============' && \ - echo '==================================================' && \ - echo '==================================================' && \ - echo $LINTABLES | xargs pylint --py3k && echo '===> pylint PASSED' && \ - echo '==================================================' && \ - echo '==================================================' && \ - echo '=============== Running flake8 ===============' && \ - echo '==================================================' && \ - echo '==================================================' && \ - flake8 $LINTABLES && echo '===> flake8 PASSED'