From 170010c40758200bfeb8d6a0ad0cc3cd3211aecc Mon Sep 17 00:00:00 2001 From: liusheng Date: Fri, 16 Jun 2017 16:02:34 +0800 Subject: [PATCH] Fix gate broken by test_nodes_list The test_nodes_list test will test the node list get from Mogan api, but it may be a empty list, we need to check firstly. Change-Id: I60a31bd53e62a80cff2fd4be1a82ef330c4aef88 Closes-Bug: #1698316 --- mogan/tests/tempest/api/test_nodes.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mogan/tests/tempest/api/test_nodes.py b/mogan/tests/tempest/api/test_nodes.py index 788daeb7..4ed8b1b1 100644 --- a/mogan/tests/tempest/api/test_nodes.py +++ b/mogan/tests/tempest/api/test_nodes.py @@ -27,10 +27,10 @@ class BaremetalComputeAPINodesTest(base.BaseBaremetalComputeTest): def test_nodes_list(self): nodes = self.baremetal_compute_client.list_nodes() self.assertIsInstance(nodes, list) - node = nodes[0] - self.assertIn('node_uuid', node) - self.assertIn('hypervisor_type', node) - self.assertIn('extra_specs', node) - self.assertIn('availability_zone', node) - self.assertIn('availability_zone', node) - self.assertIn('resource_class', node) + if nodes: + node = nodes[0] + self.assertIn('node_uuid', node) + self.assertIn('hypervisor_type', node) + self.assertIn('extra_specs', node) + self.assertIn('availability_zone', node) + self.assertIn('resource_class', node)