aboutsummaryrefslogtreecommitdiffstats
path: root/library/recipes/tvmtool/examples/ut_with_roles/test.py
diff options
context:
space:
mode:
authorhcpp <hcpp@ydb.tech>2023-11-08 12:09:41 +0300
committerhcpp <hcpp@ydb.tech>2023-11-08 12:56:14 +0300
commita361f5b98b98b44ea510d274f6769164640dd5e1 (patch)
treec47c80962c6e2e7b06798238752fd3da0191a3f6 /library/recipes/tvmtool/examples/ut_with_roles/test.py
parent9478806fde1f4d40bd5a45e7cbe77237dab613e9 (diff)
downloadydb-a361f5b98b98b44ea510d274f6769164640dd5e1.tar.gz
metrics have been added
Diffstat (limited to 'library/recipes/tvmtool/examples/ut_with_roles/test.py')
-rw-r--r--library/recipes/tvmtool/examples/ut_with_roles/test.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/library/recipes/tvmtool/examples/ut_with_roles/test.py b/library/recipes/tvmtool/examples/ut_with_roles/test.py
new file mode 100644
index 0000000000..4a976bc228
--- /dev/null
+++ b/library/recipes/tvmtool/examples/ut_with_roles/test.py
@@ -0,0 +1,26 @@
+import os
+import os.path
+import requests
+
+TVMTOOL_PORT_FILE = "tvmtool.port"
+TVMTOOL_AUTHTOKEN_FILE = "tvmtool.authtoken"
+
+
+def _get_tvmtool_params():
+ port = int(open(TVMTOOL_PORT_FILE).read())
+ authtoken = open(TVMTOOL_AUTHTOKEN_FILE).read()
+ return port, authtoken
+
+
+def test_tvmtool():
+ assert os.path.isfile(TVMTOOL_PORT_FILE)
+ assert os.path.isfile(TVMTOOL_AUTHTOKEN_FILE)
+
+ port, authtoken = _get_tvmtool_params()
+
+ r = requests.get("http://localhost:%d/tvm/ping" % port)
+ assert r.text == 'OK'
+ assert r.status_code == 200
+
+ r = requests.get("http://localhost:%d/v2/roles?self=me" % port, headers={'Authorization': authtoken})
+ assert r.status_code == 200, r.text