aboutsummaryrefslogtreecommitdiffstats
path: root/behave_tests
diff options
context:
space:
mode:
authorGwenael Lambrouin <gwenael.lambrouin@orange.com>2021-07-19 10:45:15 +0200
committerGwenael Lambrouin <gwenael.lambrouin@orange.com>2021-07-22 17:08:18 +0200
commit6e15b62fa75d1d000317beb0ab5244924a3f6ca7 (patch)
tree8c718bd2aa5be1aa4cf05173cc141dda9adf7461 /behave_tests
parent9648dd03880896d643c271c79ed2f87fd9f742f7 (diff)
behave_tests: log nfvbench API test
Change-Id: I67bfba22393f2f324b3c052b443b24c520231172 Signed-off-by: Gwenael Lambrouin <gwenael.lambrouin@orange.com>
Diffstat (limited to 'behave_tests')
-rw-r--r--behave_tests/features/steps/steps.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/behave_tests/features/steps/steps.py b/behave_tests/features/steps/steps.py
index 7be8241..76ed12d 100644
--- a/behave_tests/features/steps/steps.py
+++ b/behave_tests/features/steps/steps.py
@@ -143,10 +143,11 @@ def start_server(context, host_ip: Optional[str]=None, port: Optional[int]=None)
if port is not None:
context.port = port
+ nfvbench_test_url = "http://{ip}:{port}/status".format(ip=context.host_ip, port=context.port)
+
try:
# check if API is already available
- requests.get(
- "http://{host_ip}:{port}/status".format(host_ip=context.host_ip, port=context.port))
+ requests.get(nfvbench_test_url)
except RequestException:
cmd = ["nfvbench", "-c", context.data['config'], "--server"]
if context.host_ip != "127.0.0.1":
@@ -158,7 +159,8 @@ def start_server(context, host_ip: Optional[str]=None, port: Optional[int]=None)
subprocess.Popen(cmd, stdout=DEVNULL, stderr=subprocess.STDOUT)
- test_nfvbench_api(context)
+ context.logger.info("start_server: test nfvbench API: " + nfvbench_test_url)
+ test_nfvbench_api(nfvbench_test_url)
"""Then steps."""
@@ -330,9 +332,9 @@ def push_result_database(context):
@retry(AssertionError, tries=24, delay=5.0, logger=None)
-def test_nfvbench_api(context):
+def test_nfvbench_api(nfvbench_test_url: str):
try:
- r = requests.get("http://{ip}:{port}/status".format(ip=context.host_ip, port=context.port))
+ r = requests.get(nfvbench_test_url)
assert r.status_code == 200
assert json.loads(r.text)["error_message"] == "no pending NFVbench run"
except RequestException as exc: