Skip to content

Commit

Permalink
Merge pull request #672 from skalenetwork/merge-develop
Browse files Browse the repository at this point in the history
New beta (2.1 release candidate)
  • Loading branch information
dmytrotkk authored Nov 25, 2022
2 parents 13b10c9 + 44be8a3 commit 7b69d2a
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 15 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/issue_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Get linked issues
on:
pull_request:
types: [ edited, synchronize, opened, reopened ]

jobs:
check-linked-issues:
name: Check if pull request has linked issues
runs-on: ubuntu-latest
steps:
- name: Get issues
id: get-issues
uses: mondeja/pr-linked-issues-action@v2
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: PR has not linked issues
if: join(steps.get-issues.outputs.issues) == ''
run:
exit 1
9 changes: 7 additions & 2 deletions node_cli/core/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,14 @@ def check(self) -> ResultList:


class MachineChecker(BaseChecker):
def __init__(self, requirements: Dict, disk_device: str) -> None:
def __init__(
self,
requirements: Dict,
disk_device: str,
network_timeout: Optional[int] = None) -> None:
self.requirements = requirements
self.disk_device = disk_device
self.network_timeout = network_timeout or NETWORK_CHECK_TIMEOUT

@preinstall
def cpu_total(self) -> CheckResult:
Expand Down Expand Up @@ -281,7 +286,7 @@ def disk(self) -> CheckResult:
def network(self) -> CheckResult:
name = 'network'
try:
socket.setdefaulttimeout(NETWORK_CHECK_TIMEOUT)
socket.setdefaulttimeout(self.network_timeout)
socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect(
(CLOUDFLARE_DNS_HOST, CLOUDFLARE_DNS_HOST_PORT))
return self._ok(name=name)
Expand Down
20 changes: 10 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def find_version(*file_paths):

extras_require = {
'linter': [
"flake8==4.0.1",
"flake8==5.0.4",
"isort>=4.2.15,<5.10.2",
],
'dev': [
Expand All @@ -29,7 +29,7 @@ def find_version(*file_paths):
"pytest-cov==3.0.0",
"twine==4.0.1",
"mock==4.0.3",
"freezegun==1.2.1"
"freezegun==1.2.2"
]
}

Expand All @@ -51,21 +51,21 @@ def find_version(*file_paths):
url='https://github.com/skalenetwork/node-cli',
install_requires=[
"click==8.1.3",
"docker==5.0.3",
"PyInstaller==5.1",
"PyInstaller==5.6.2",
"docker==6.0.1",
"texttable==1.6.4",
"python-dateutil==2.8.1",
"python-dateutil==2.8.2",
"Jinja2==3.1.2",
"psutil==5.9.1",
"python-dotenv==0.20.0",
"python-dotenv==0.21.0",
"terminaltables==3.1.10",
"requests==2.28.0",
"requests==2.28.1",
"GitPython==3.1.27",
"PyYAML==5.4.1",
"packaging==21.3",
"python-debian==0.1.39",
"python-debian==0.1.48",
"python-iptables==1.0.0",
"MarkupSafe==2.0.1",
"PyYAML==6.0",
"MarkupSafe==2.1.1",
],
python_requires='>=3.6,<4',
extras_require=extras_require,
Expand Down
6 changes: 3 additions & 3 deletions tests/core_checks_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ def test_checks_swap(server_req):


def test_checks_network(server_req):
checker = MachineChecker(server_req, 'test-disk')
checker = MachineChecker(server_req, 'test-disk', network_timeout=10)
r = checker.network()
assert r.status == 'ok'
assert r.status == 'ok', r.info
assert r.name == 'network'


Expand All @@ -135,7 +135,7 @@ def test_checks_disk(server_req):


def test_checks_machine_check(server_req):
checker = MachineChecker(server_req, 'test-disk')
checker = MachineChecker(server_req, 'test-disk', network_timeout=10)
result = checker.check()
assert not all([r.status == 'ok' for r in result])

Expand Down

0 comments on commit 7b69d2a

Please sign in to comment.