-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into refactor/liblogger-vlogf-vstring-function
- Loading branch information
Showing
19 changed files
with
194 additions
and
92 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,3 @@ runs: | |
shell: bash | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get upgrade -y |
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
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import os | ||
import pytest | ||
import subprocess | ||
import glob | ||
|
||
from utils import discovered_service_has_clients, is_responsive | ||
from time import sleep | ||
|
||
|
||
def pytest_addoption(parser): | ||
parser.addoption("--discovery_path", action="store", help="Path to eBPF Discovery binary") | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def discovery_path(pytestconfig): | ||
discovery_path = pytestconfig.getoption("discovery_path") | ||
assert discovery_path, "Path to eBPF discovery needs to be provided via --discovery_path" | ||
return discovery_path | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def run_ebpf_discovery(discovery_path): | ||
args = (discovery_path, "--interval", "2") | ||
discovery = subprocess.Popen(args, stdout=subprocess.PIPE) | ||
yield discovery | ||
|
||
discovery.terminate() | ||
while discovery.poll() is None: | ||
sleep(0.5) | ||
exit_code = discovery.returncode | ||
assert not exit_code, "Discovery returned exit code: {}".format(exit_code) | ||
|
||
discovery_root_dir = os.path.dirname(os.path.realpath(discovery_path)) | ||
log_files = glob.glob(discovery_root_dir+'/*.log') | ||
assert log_files == [], "Discovery produced log files on exit: {}".format(log_files) | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def http_service(docker_ip, docker_services, run_ebpf_discovery): | ||
port = docker_services.port_for("httpbin", 80) | ||
url = "http://{}:{}/".format(docker_ip, port) | ||
docker_services.wait_until_responsive( | ||
timeout=30.0, pause=0.1, check=lambda: is_responsive(url) | ||
) | ||
assert discovered_service_has_clients(run_ebpf_discovery, url, 1, 0) | ||
return url |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
pytest~=7.4.3 | ||
pytest-docker~=2.0.0 | ||
requests~=2.31.0 |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from utils import discovered_service_has_clients, send_http_requests | ||
|
||
|
||
def test_service_discovery(run_ebpf_discovery, http_service): | ||
url = http_service + "some/url" | ||
requests_num = 5 | ||
send_http_requests(url, requests_num) | ||
assert discovered_service_has_clients(run_ebpf_discovery, url, requests_num, 0) | ||
|
||
url = http_service + "other/url" | ||
requests_num = 10 | ||
send_http_requests(url, requests_num) | ||
assert discovered_service_has_clients(run_ebpf_discovery, url, requests_num, 0) |
Oops, something went wrong.