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> --- modules/httpserver/tests/api/testos.py | 2 +- modules/httpserver/tests/basetest.py | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/httpserver/tests/api/testos.py b/modules/httpserver/tests/api/testos.py index 92e21b2..0208de7 100755 --- a/modules/httpserver/tests/api/testos.py +++ b/modules/httpserver/tests/api/testos.py @@ -19,7 +19,7 @@ class testos(basetest.Basetest): 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 index df6d166..c3a5b70 100755 --- a/modules/httpserver/tests/basetest.py +++ b/modules/httpserver/tests/basetest.py @@ -25,7 +25,11 @@ class Basetest(unittest.TestCase): @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 @@ class Basetest(unittest.TestCase): @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() -- 2.7.4 -- 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.