#82 Refactoring module_framework.py into more classes and Exceptions into alone exception.py class
Closed by phracek. Opened by phracek.
refactoring_avocado_tests  into  devel

Download 82.patch

This PR contains:
- updating SPEC file - Requires: python-retrying
- splitting module_framework.py into more helpers and avocado_testers classes. For better handling and code readability.
- MTF exceptions should be in alone exception.py class. So we have file for it.
- Moving CommonFunctions class from module_framework.py into common.py.

@jscotka @ttomecek Please have a look on it. Critical comments are welcome.
I have tried it and all seems to be working properly. On memcached module.

[sudo] password for phracek: 
cd tests; MODULE=docker MODULEMD=file://memcached.yaml URL="docker.io/modularitycontainers/memcached" make all
make[1]: Entering directory '/home/phracek/work/FedoraModules/memcached/tests'
mtf-generator
Added test (runmethod: run): processrunning
Added test (runmethod: runHost): selfcheck
Added test (runmethod: runHost): selcheckError
python -m avocado run --filter-by-tags=-WIP /home/phracek/work/programming/modularity-testing-framework/tools/modulelint.py *.py
JOB ID     : 51451e6e28b2c1322ff87858d92c7adfe4f73ad5
JOB LOG    : /root/avocado/job-results/job-2017-07-12T15.13-51451e6/job.log
 (01/20) /home/phracek/work/programming/modularity-testing-framework/tools/modulelint.py:DockerfileLinter.testDockerFromBaseruntime: PASS (0.01 s)
 (02/20) /home/phracek/work/programming/modularity-testing-framework/tools/modulelint.py:DockerfileLinter.testDockerRunMicrodnf: PASS (0.01 s)
 (03/20) /home/phracek/work/programming/modularity-testing-framework/tools/modulelint.py:DockerfileLinter.testArchitectureInEnvAndLabelExists: PASS (0.01 s)
 (04/20) /home/phracek/work/programming/modularity-testing-framework/tools/modulelint.py:DockerfileLinter.testNameInEnvAndLabelExists: PASS (0.02 s)
 (05/20) /home/phracek/work/programming/modularity-testing-framework/tools/modulelint.py:DockerfileLinter.testReleaseLabelExists: PASS (0.02 s)
 (06/20) /home/phracek/work/programming/modularity-testing-framework/tools/modulelint.py:DockerfileLinter.testVersionLabelExists: PASS (0.01 s)
 (07/20) /home/phracek/work/programming/modularity-testing-framework/tools/modulelint.py:DockerfileLinter.testComRedHatComponentLabelExists: PASS (0.01 s)
 (08/20) /home/phracek/work/programming/modularity-testing-framework/tools/modulelint.py:DockerfileLinter.testIok8sDescriptionExists: PASS (0.01 s)
 (09/20) /home/phracek/work/programming/modularity-testing-framework/tools/modulelint.py:DockerfileLinter.testIoOpenshiftExposeServicesExists: PASS (0.02 s)
 (10/20) /home/phracek/work/programming/modularity-testing-framework/tools/modulelint.py:DockerfileLinter.testIoOpenShiftTagsExists: PASS (0.02 s)
 (11/20) /home/phracek/work/programming/modularity-testing-framework/tools/modulelint.py:DockerLint.testBasic: PASS (23.10 s)
 (12/20) /home/phracek/work/programming/modularity-testing-framework/tools/modulelint.py:DockerLint.testContainerIsRunning: PASS (17.80 s)
 (13/20) /home/phracek/work/programming/modularity-testing-framework/tools/modulelint.py:DockerLint.testLabels: PASS (4.83 s)
 (14/20) /home/phracek/work/programming/modularity-testing-framework/tools/modulelint.py:ModuleLintPackagesCheck.test: PASS (19.40 s)
 (15/20) generated.py:GeneratedTestsConfig.test_processrunning: PASS (17.97 s)
 (16/20) generated.py:GeneratedTestsConfig.test_selfcheck: PASS (18.78 s)
 (17/20) generated.py:GeneratedTestsConfig.test_selcheckError: ERROR (17.94 s)
 (18/20) sanity1.py:SanityCheck1.testSettingTestVariable: PASS (18.04 s)
 (19/20) sanity1.py:SanityCheck1.testBinExistsInRootDir: PASS (17.76 s)
 (20/20) sanity1.py:SanityCheck1.test3GccSkipped: ERROR (18.44 s)
RESULTS    : PASS 18 | ERROR 2 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
JOB TIME   : 178.04 s
JOB HTML   : /root/avocado/job-results/job-2017-07-12T15.13-51451e6/results.html
Makefile:7: recipe for target 'all' failed
make[1]: *** [all] Error 1
make[1]: Leaving directory '/home/phracek/work/FedoraModules/memcached/tests'
Makefile:14: recipe for target 'test' failed
make: *** [test] Error 2

where we use this library?
@Retry is from own timeout library included inside project.

This is little bit harder to use, in case you don't have moduleframework installed, it causes that you will not be able to use container_avocado_test.py directly (add symlink to this path should help)

maybe, there make sense also move there get_profile function, and remove this import. Probably imports should be just in one way

we should remove this and use print_info/debug from common instead of direct using of print buction

should be removed and instead of print() used print_info from common or self.log in case it is test class

it seems that there is missing:

from moduleframework.avocado_testers import *

to keep backward compatibility

Otherwise, could you please run make install && (cd examples/testing-module; make check-docker; make check-rpm)

@jscotka Answer to first comment. https://pagure.io/modularity-testing-framework/blob/refactoring_avocado_tests/f/moduleframework/helpers/nspawn_helper.py#_205

yep I'm using retry lib inside, but this is internal Retry class from https://pagure.io/modularity-testing-framework/blob/master/f/moduleframework/timeoutlib.py written there. not any external one

@jscotka Answer to first comment. https://pagure.io/modularity-testing-framework/blob/refactoring_avocado_tests/f/moduleframework/helpers/nspawn_helper.py#_205

1 new commit added

  • Several fixes caused by missing testing.

Pull-Request has been closed by phracek

Metadata