diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6f2a748ed..651b75b3b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -3,8 +3,7 @@ name: tests on: [push] 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/ diff --git a/src/Crypt/CryptConnection.py b/src/Crypt/CryptConnection.py index ebbc62955..293954c86 100644 --- a/src/Crypt/CryptConnection.py +++ b/src/Crypt/CryptConnection.py @@ -156,6 +156,9 @@ def createSslRsaCert(self): ) 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) diff --git a/src/Test/conftest.py b/src/Test/conftest.py index 8f9dc3a56..d932b10bc 100644 --- a/src/Test/conftest.py +++ b/src/Test/conftest.py @@ -77,6 +77,8 @@ def pytest_collection_modifyitems(config, items): 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)