From 34d1ab192e805642741953e96a5b1713a2d44204 Mon Sep 17 00:00:00 2001 From: James Gu Date: Wed, 10 Jan 2018 16:06:03 -0800 Subject: [PATCH] Add test case for listing Statistics without end time Statisics api fails when no end time is present with Casssandra. Added a test case that queries statistics without specifying end time. Change-Id: I627c4e461a755ae982dcd78cf22d754c33480b71 story: 2001461 task: 6176 --- monasca_tempest_tests/tests/api/test_statistics.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/monasca_tempest_tests/tests/api/test_statistics.py b/monasca_tempest_tests/tests/api/test_statistics.py index 26e1d6a..18599c4 100644 --- a/monasca_tempest_tests/tests/api/test_statistics.py +++ b/monasca_tempest_tests/tests/api/test_statistics.py @@ -1,5 +1,5 @@ # (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP -# (C) Copyright 2017 SUSE LLC +# (C) Copyright 2017-2018 SUSE LLC # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain @@ -121,11 +121,20 @@ class TestStatistics(base.BaseMonascaTest): @decorators.attr(type="gate") def test_list_statistics(self): + self._test_list_statistic(with_end_time=True) + + @decorators.attr(type="gate") + def test_list_statistics_with_no_end_time(self): + self._test_list_statistic(with_end_time=False) + + def _test_list_statistic(self, with_end_time=True): query_parms = '?name=' + str(self._test_name) + \ '&statistics=' + urlparse.quote('avg,sum,min,max,count') + \ '&start_time=' + str(self._start_time_iso) + \ - '&end_time=' + str(self._end_time_iso) + \ '&merge_metrics=true' + '&period=100000' + if with_end_time is True: + query_parms += '&end_time=' + str(self._end_time_iso) + resp, response_body = self.monasca_client.list_statistics( query_parms) self.assertEqual(200, resp.status)