-
Notifications
You must be signed in to change notification settings - Fork 671
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make check_port an async function (#4677)
* Make check_port asyncio This requires to change the ingress_port property to a async method. * Avoid using wait_for * Add missing async * Really await * Set dynamic ingress port on add-on installation/update * Fix pytest issue * Rename async_check_port back to check_port * Raise RuntimeError in case port is not set * Make sure port gets set on add-on restore * Drop unnecessary async * Simplify check_port by using asyncio.get_running_loop()
- Loading branch information
Showing
6 changed files
with
49 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
"""Check ports.""" | ||
from ipaddress import ip_address | ||
|
||
from supervisor.utils import check_port | ||
|
||
|
||
def test_exists_open_port(): | ||
"""Test a exists network port.""" | ||
assert check_port(ip_address("8.8.8.8"), 53) | ||
|
||
|
||
def test_not_exists_port(): | ||
"""Test a not exists network service.""" | ||
assert not check_port(ip_address("192.0.2.1"), 53) | ||
"""Check ports.""" | ||
from ipaddress import ip_address | ||
|
||
from supervisor.coresys import CoreSys | ||
from supervisor.utils import check_port | ||
|
||
|
||
async def test_exists_open_port(coresys: CoreSys): | ||
"""Test a exists network port.""" | ||
assert await check_port(ip_address("8.8.8.8"), 53) | ||
|
||
|
||
async def test_not_exists_port(coresys: CoreSys): | ||
"""Test a not exists network service.""" | ||
assert not await check_port(ip_address("192.0.2.1"), 53) |