Skip to content

Commit

Permalink
Update with tag field for elastic
Browse files Browse the repository at this point in the history
  • Loading branch information
dkosteck committed Dec 6, 2023
1 parent 15d27c8 commit d2fba95
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 30 deletions.
5 changes: 0 additions & 5 deletions sriov/common/configtestdata.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 = ""

Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand Down
18 changes: 1 addition & 17 deletions sriov/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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"])

Expand Down

0 comments on commit d2fba95

Please sign in to comment.