]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
pytests: add html report
authorTomas Krizek <tomas.krizek@nic.cz>
Tue, 20 Nov 2018 14:18:56 +0000 (15:18 +0100)
committerTomas Krizek <tomas.krizek@nic.cz>
Tue, 4 Dec 2018 16:13:42 +0000 (17:13 +0100)
.gitlab-ci.yml
ci/pytests/run.sh
tests/pytests/README.rst
tests/pytests/conftest.py
tests/pytests/requirements.txt

index cc7d9b2dfc15d7345908c3f6b0e042961e003db9..39005be18cf7e58b5c9cdedab5bb31a850112a54 100644 (file)
@@ -287,7 +287,15 @@ pytests:run:
   except:
     - master
   script:
-    - PATH="$PREFIX/sbin:$PATH" ./ci/pytests/run.sh
+    - PATH="$PREFIX/sbin:$PATH" ./ci/pytests/run.sh &> pytests.log.txt
+  after_script:
+    - tail -1 pytests.log.txt
+    - echo "See pytests.html or pytests.log.txt for full report."
+  artifacts:
+    when: always
+    expire_in: 1 week
+    paths:
+      - pytest*
   tags:
     - docker
     - linux
index bd1a1b216be65eafbe828251a07684dc930daf02..e1b55afc663b8708fa3e1e301ecf53039f4042fd 100755 (executable)
@@ -1,3 +1,3 @@
 #!/bin/bash
 
-python3 -m pytest -ra -n 24 tests/pytests
+python3 -m pytest --html pytests.html --self-contained-html -dn 24 tests/pytests
index f6cb7c9572f05d81bcb940f56480fd44dbe0e12e..e066f3c0d172d98c033ca34d9004d5c22d35a68a 100644 (file)
@@ -18,7 +18,7 @@ Tests can be executed with the pytest framework.
 
    $ pytest-3  # sequential, all tests (with exception of few special tests)
    $ pytest-3 test_conn_mgmt.py::test_ignore_garbage   # specific test only
-   $ pytest-3 -s # turn on verbose logs even for successfull tests
+   $ pytest-3 --html pytests.html --self-contained-html  # html report
 
 It's highly recommended to run these tests in parallel, since lot of them
 wait for kresd timeout. This can be don with `python-xdist`:
index 7beed5050885d2aa3b036902d34b4488fe855f43..9e7370d31d516971c751714c78cbc5a3ee14a317 100644 (file)
@@ -49,3 +49,15 @@ def kresd_sock(make_kresd_sock):
 ])
 def sock_family(request):
     return request.param
+
+
+@pytest.mark.optionalhook
+def pytest_metadata(metadata):  # filter potentially sensitive data from GitLab CI
+    keys_to_delete = []
+    for key in metadata.keys():
+        key_lower = key.lower()
+        if 'password' in key_lower or 'token' in key_lower or \
+                key_lower.startswith('ci') or key_lower.startswith('gitlab'):
+            keys_to_delete.append(key)
+    for key in keys_to_delete:
+        del metadata[key]
index 98bedb0c625dc7cabe0ae3d41f266da45c3ea224..6e2e4d24af5e6c7203a3f25776467674e13aade4 100644 (file)
@@ -1,4 +1,5 @@
 dnspython
 jinja2
 pytest
+pytest-html
 pytest-xdist