Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 11 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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"
Expand All @@ -93,8 +93,8 @@ help:
@echo " MR=6 <target>"
@echo " PR=7 SUFFIX='my_additional_suffix' make <target>"
@echo " MR=6 COPR_CONFIG='path/to/the/config/copr/file' <target>"
@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 ""

Expand Down Expand Up @@ -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}; \
;; \
Expand All @@ -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 && \
Expand Down Expand Up @@ -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"; \
Expand All @@ -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; \
Expand All @@ -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
Expand All @@ -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 ===============' && \
Expand All @@ -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 \
Expand Down
10 changes: 4 additions & 6 deletions docs/source/best-practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/source/devenv-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions docs/source/test-actors.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion docs/source/tutorials/unit-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 0 additions & 11 deletions res/container-builds/Containerfile.centos7

This file was deleted.

21 changes: 0 additions & 21 deletions res/container-tests/Containerfile.ubi7

This file was deleted.

28 changes: 0 additions & 28 deletions res/container-tests/Containerfile.ubi7-lint

This file was deleted.

Loading