Merge "Adding duration header to rally verify list query"
This commit is contained in:
commit
b5da99ac60
@ -86,8 +86,12 @@ class VerifyCommands(object):
|
|||||||
"""Display all verifications table, started and finished."""
|
"""Display all verifications table, started and finished."""
|
||||||
|
|
||||||
fields = ["UUID", "Deployment UUID", "Set name", "Tests", "Failures",
|
fields = ["UUID", "Deployment UUID", "Set name", "Tests", "Failures",
|
||||||
"Created at", "Status"]
|
"Created at", "Duration", "Status"]
|
||||||
verifications = db.verification_list()
|
verifications = db.verification_list()
|
||||||
|
|
||||||
|
for el in verifications:
|
||||||
|
el["duration"] = el["updated_at"] - el["created_at"]
|
||||||
|
|
||||||
if verifications:
|
if verifications:
|
||||||
common_cliutils.print_list(verifications, fields,
|
common_cliutils.print_list(verifications, fields,
|
||||||
sortby_index=fields.index("Created at"))
|
sortby_index=fields.index("Created at"))
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import datetime as date
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
@ -96,10 +97,16 @@ class VerifyCommandsTestCase(test.TestCase):
|
|||||||
@mock.patch("rally.db.verification_list")
|
@mock.patch("rally.db.verification_list")
|
||||||
def test_list(self, mock_db_verification_list, mock_print_list):
|
def test_list(self, mock_db_verification_list, mock_print_list):
|
||||||
fields = ["UUID", "Deployment UUID", "Set name", "Tests", "Failures",
|
fields = ["UUID", "Deployment UUID", "Set name", "Tests", "Failures",
|
||||||
"Created at", "Status"]
|
"Created at", "Duration", "Status"]
|
||||||
verifications = {"dummy": []}
|
verifications = [{"created_at": date.datetime.now(),
|
||||||
|
"updated_at": date.datetime.now()}]
|
||||||
mock_db_verification_list.return_value = verifications
|
mock_db_verification_list.return_value = verifications
|
||||||
self.verify.list()
|
self.verify.list()
|
||||||
|
|
||||||
|
for row in verifications:
|
||||||
|
self.assertEqual(row["updated_at"] - row["created_at"],
|
||||||
|
row["duration"])
|
||||||
|
|
||||||
mock_db_verification_list.assert_called_once_with()
|
mock_db_verification_list.assert_called_once_with()
|
||||||
mock_print_list.assert_called_once_with(verifications, fields,
|
mock_print_list.assert_called_once_with(verifications, fields,
|
||||||
sortby_index=fields.index(
|
sortby_index=fields.index(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user