From: Waldemar Kozaczuk <jwkozac...@gmail.com>
Committer: Nadav Har'El <n...@scylladb.com>
Branch: master
Fixed httpserver module tests
This patch fixes httpserver module tests by correcting 2 issues:
- tests/basetest.py was incorrectly loading jvm.json file
- the format of timestamp returned by os/date API call must have changed at
some point to include 'UTC' and corresponding test was not adjusted
Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com>
Message-Id: <1502301584-3838-1-git-send-email-jwkozac...@gmail.com>
---
diff --git a/modules/httpserver/tests/api/testos.py
b/modules/httpserver/tests/api/testos.py
--- a/modules/httpserver/tests/api/testos.py
+++ b/modules/httpserver/tests/api/testos.py
@@ -19,7 +19,7 @@ def test_os_uptime(self):
def test_os_date(self):
path = self.path_by_nick(self.os_api, "os_date")
val = self.curl(path).encode('ascii', 'ignore')
-
self.assertRegexpMatches(val, "...\\s+...\\s+\\d+\\s+\\d\\d:\\d\\d:\\d\\d\\s+20..",
path)
+
self.assertRegexpMatches(val, "...\\s+...\\s+\\d+\\s+\\d\\d:\\d\\d:\\d\\d\\s+UTC\\s+20..",
path)
def test_os_total_memory(self):
path = self.path_by_nick(self.os_api, "os_memory_total")
diff --git a/modules/httpserver/tests/basetest.py
b/modules/httpserver/tests/basetest.py
--- a/modules/httpserver/tests/basetest.py
+++ b/modules/httpserver/tests/basetest.py
@@ -25,7 +25,11 @@ def get_url(cls, uri):
@classmethod
def get_json_api(cls, name):
- json_data = open(os.path.join(cls.config.jsondir, name))
+ return cls.get_json_api_from_directory(cls.config.jsondir,name)
+
+ @classmethod
+ def get_json_api_from_directory(cls, directory, name):
+ json_data = open(os.path.join(directory, name))
data = json.load(json_data)
json_data.close()
return data
@@ -145,7 +149,8 @@ def shutdown(cls):
@classmethod
def start_image(cls):
- cls.jvm_api = cls.get_json_api("jvm.json")
+ jvm_plugin_api_listings_path =
os.path.join(os.path.realpath(os.path.dirname(__file__)),'../../httpserver-jvm-plugin/api-doc/listings')
+ cls.jvm_api =
cls.get_json_api_from_directory(jvm_plugin_api_listings_path,"jvm.json")
cls.os_api = cls.get_json_api("os.json")
if not cls.config.connect:
cls.os_process = cls.exec_os()
--
You received this message because you are subscribed to the Google Groups "OSv
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.