diff --git a/sriov/common/configtestdata.py b/sriov/common/configtestdata.py index 00423a8..316880c 100644 --- a/sriov/common/configtestdata.py +++ b/sriov/common/configtestdata.py @@ -1,11 +1,7 @@ from sriov.common.config import Config -import json class ConfigTestData: - def to_json(self): - return json.dumps(self) - def __init__(self, settings: Config) -> None: """Init the testdata object @@ -63,4 +59,3 @@ def __init__(self, settings: Config) -> None: # track testpmd and trafficgen container IDs from SR_IOV_Performance for cleanup self.testpmd_id = "" self.trafficgen_id = "" - diff --git a/sriov/tests/SR_IOV_Sanity_Performance/test_SR_IOV_Sanity_Performance.py b/sriov/tests/SR_IOV_Sanity_Performance/test_SR_IOV_Sanity_Performance.py index 1f08b64..894c44c 100644 --- a/sriov/tests/SR_IOV_Sanity_Performance/test_SR_IOV_Sanity_Performance.py +++ b/sriov/tests/SR_IOV_Sanity_Performance/test_SR_IOV_Sanity_Performance.py @@ -24,7 +24,7 @@ def test_SRIOV_Sanity_Performance(dut, trafficgen, settings, testdata): # noqa: testdata: testdata obj execution_number: execution_number parameter """ - '''dut_pfs = list(testdata.pfs.keys()) + dut_pfs = list(testdata.pfs.keys()) assert set_pipefail(dut) @@ -189,21 +189,20 @@ def test_SRIOV_Sanity_Performance(dut, trafficgen, settings, testdata): # noqa: client_cmd, 0, cmd_timeout=60 * settings.config["trafficgen_timeout"], - )''' - results = "" #json.loads(outs[0][0]) + ) + results = json.loads(outs[0][0]) if settings.config["log_performance"]: print(json.dumps(results)) if settings.config["log_performance_elastic"]: - log_elastic() + log_elastic(results) # Compare trafficgen results to config - #assert results["0"]["rx_l1_bps"] >= settings.config["trafficgen_rx_bps_limit"] + assert results["0"]["rx_l1_bps"] >= settings.config["trafficgen_rx_bps_limit"] -def log_elastic(): +def log_elastic(results): elastic.elastic_index = "test-perf-index" - elastic.elastic_doc = {} - #elastic.elastic_doc["rx_l1_bps"] = results["0"]["rx_l1_bps"] + elastic.elastic_doc["rx_l1_bps"] = results["0"]["rx_l1_bps"] elastic.elastic_doc["timestamp"] = datetime.now() print(elastic.elastic_index) diff --git a/sriov/tests/conftest.py b/sriov/tests/conftest.py index 07e29f2..e7deb54 100644 --- a/sriov/tests/conftest.py +++ b/sriov/tests/conftest.py @@ -182,19 +182,6 @@ def _cleanup( if settings.config["log_performance_elastic"]: elastic_push(settings, testdata) - '''es = Elasticsearch( - f'https://{settings.config["elastic_host"]}:{settings.config["elastic_port"]}', - verify_certs=False, - # ca_certs=settings.config["elastic_ca_cert_path"], - basic_auth=( - settings.config["elastic_username"], - settings.config["elastic_password"], - ), - ) - es.info() - print("elastic index: ", elastic.elastic_index) - resp = es.index(index=elastic.elastic_index, document=elastic.elastic_doc) - print(resp["result"])''' def pytest_configure(config: Config) -> None: @@ -312,7 +299,7 @@ def _report_extras(extra, request, settings, testdata, monkeypatch) -> None: if git_tag: elastic.elastic_doc["tag"] = str(git_tag) elif sha: - elastic.elastic_doc["tag"] = str(sha) + elastic.elastic_doc["tag"] = str(sha.hexsha) extra.append( extras.html( @@ -368,9 +355,6 @@ def elastic_push(settings, testdata): ) es.info() - #elastic.elastic_doc["testdata"] = testdata.to_json() - elastic.elastic_doc["settings"] = settings - resp = es.index(index=elastic.elastic_index, document=elastic.elastic_doc) print(resp["result"])