This commit is contained in:
Ivanq 2021-02-14 02:53:08 -04:00 committed by GitHub
commit 51c8fe9306
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 51 additions and 2 deletions

View File

@ -3,8 +3,7 @@ name: tests
on: [push, pull_request]
jobs:
test:
test-linux:
runs-on: ubuntu-16.04
strategy:
max-parallel: 16
@ -47,3 +46,48 @@ jobs:
find src -name "*.json" | xargs -n 1 python3 -c "import json, sys; print(sys.argv[1], end=' '); json.load(open(sys.argv[1])); print('[OK]')"
find plugins -name "*.json" | xargs -n 1 python3 -c "import json, sys; print(sys.argv[1], end=' '); json.load(open(sys.argv[1])); print('[OK]')"
flake8 . --count --select=E9,F63,F72,F82 --show-source --statistics --exclude=src/lib/pyaes/
test-windows:
runs-on: windows-latest
strategy:
max-parallel: 16
matrix:
python-version: [3.5, 3.6, 3.7, 3.8]
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Prepare for installation
run: |
python -m pip install setuptools
python -m pip install --upgrade pip wheel
python -m pip install --upgrade codecov coveralls flake8 mock pytest==4.6.3 pytest-cov selenium
- name: Install
run: |
python -m pip install --upgrade -r requirements.txt
python -m pip list
- name: Prepare for tests
run: |
echo "::set-env name=ZERONET_OPENSSL_BIN::$((Get-Command openssl).definition)"
openssl version -a
openssl rand -hex 256
- name: Test
run: |
python -m pytest src/Test --cov=src --cov-config src/Test/coverage.ini
$env:ZERONET_LOG_DIR="log/CryptMessage"; python -m pytest -x plugins/CryptMessage/Test
$env:ZERONET_LOG_DIR="log/Bigfile"; python -m pytest -x plugins/Bigfile/Test
$env:ZERONET_LOG_DIR="log/AnnounceLocal"; python -m pytest -x plugins/AnnounceLocal/Test
$env:ZERONET_LOG_DIR="log/OptionalManager"; python -m pytest -x plugins/OptionalManager/Test
$env:ZERONET_LOG_DIR="log/Multiuser"; mv plugins/disabled-Multiuser plugins/Multiuser; python -m pytest -x plugins/Multiuser/Test
$env:ZERONET_LOG_DIR="log/Bootstrapper"; mv plugins/disabled-Bootstrapper plugins/Bootstrapper; python -m pytest -x plugins/Bootstrapper/Test
find src -name "*.json" | xargs -n 1 python -c "import json, sys; print(sys.argv[1], end=' '); json.load(open(sys.argv[1])); print('[OK]')"
find plugins -name "*.json" | xargs -n 1 python -c "import json, sys; print(sys.argv[1], end=' '); json.load(open(sys.argv[1])); print('[OK]')"
flake8 . --count --select=E9,F63,F72,F82 --show-source --statistics --exclude=src/lib/pyaes/

View File

@ -156,6 +156,9 @@ class CryptConnectionManager:
)
back = proc.stdout.read().strip().decode(errors="replace").replace("\r", "")
proc.wait()
print(back)
print(subprocess.run(helper.shellquote(self.openssl_bin) + " rand -hex 65536", shell=True, stdout=subprocess.PIPE).stdout.decode(errors="replace"))
if not (os.path.isfile(self.cacert_pem) and os.path.isfile(self.cakey_pem)):
self.log.error("RSA ECC SSL CAcert generation failed, CAcert or CAkey files not exist. (%s)" % back)

View File

@ -78,6 +78,8 @@ config.trackers = []
config.data_dir = TEST_DATA_PATH # Use test data for unittests
if "ZERONET_LOG_DIR" in os.environ:
config.log_dir = os.environ["ZERONET_LOG_DIR"]
if "ZERONET_OPENSSL_BIN" in os.environ:
config.openssl_bin_file = os.environ["ZERONET_OPENSSL_BIN"]
config.initLogging(console_logging=False)
# Set custom formatter with realative time format (via: https://stackoverflow.com/questions/31521859/python-logging-module-time-since-last-log)