diff options
author | hcpp <hcpp@ydb.tech> | 2023-11-08 12:09:41 +0300 |
---|---|---|
committer | hcpp <hcpp@ydb.tech> | 2023-11-08 12:56:14 +0300 |
commit | a361f5b98b98b44ea510d274f6769164640dd5e1 (patch) | |
tree | c47c80962c6e2e7b06798238752fd3da0191a3f6 /library/recipes/tvmtool/examples/ut_with_roles/test.py | |
parent | 9478806fde1f4d40bd5a45e7cbe77237dab613e9 (diff) | |
download | ydb-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.py | 26 |
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 |