merged upstream
This commit is contained in:
@@ -136,6 +136,22 @@ class CloudTestCase(test.TestCase):
|
||||
db.instance_destroy(self.context, inst['id'])
|
||||
db.floating_ip_destroy(self.context, address)
|
||||
|
||||
def test_describe_security_groups(self):
|
||||
"""Makes sure describe_security_groups works and filters results."""
|
||||
sec = db.security_group_create(self.context,
|
||||
{'project_id': self.context.project_id,
|
||||
'name': 'test'})
|
||||
result = self.cloud.describe_security_groups(self.context)
|
||||
# NOTE(vish): should have the default group as well
|
||||
self.assertEqual(len(result['securityGroupInfo']), 2)
|
||||
result = self.cloud.describe_security_groups(self.context,
|
||||
group_name=[sec['name']])
|
||||
self.assertEqual(len(result['securityGroupInfo']), 1)
|
||||
self.assertEqual(
|
||||
result['securityGroupInfo'][0]['groupName'],
|
||||
sec['name'])
|
||||
db.security_group_destroy(self.context, sec['id'])
|
||||
|
||||
def test_describe_volumes(self):
|
||||
"""Makes sure describe_volumes works and filters results."""
|
||||
vol1 = db.volume_create(self.context, {})
|
||||
@@ -294,19 +310,6 @@ class CloudTestCase(test.TestCase):
|
||||
LOG.debug(_("Terminating instance %s"), instance_id)
|
||||
rv = self.compute.terminate_instance(instance_id)
|
||||
|
||||
def test_describe_instances(self):
|
||||
"""Makes sure describe_instances works."""
|
||||
instance1 = db.instance_create(self.context, {'host': 'host2'})
|
||||
comp1 = db.service_create(self.context, {'host': 'host2',
|
||||
'availability_zone': 'zone1',
|
||||
'topic': "compute"})
|
||||
result = self.cloud.describe_instances(self.context)
|
||||
self.assertEqual(result['reservationSet'][0]
|
||||
['instancesSet'][0]
|
||||
['placement']['availabilityZone'], 'zone1')
|
||||
db.instance_destroy(self.context, instance1['id'])
|
||||
db.service_destroy(self.context, comp1['id'])
|
||||
|
||||
@staticmethod
|
||||
def _fake_set_image_description(ctxt, image_id, description):
|
||||
from nova.objectstore import handler
|
||||
|
30
run_tests.py
30
run_tests.py
@@ -38,7 +38,22 @@
|
||||
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
"""Unittest runner for Nova.
|
||||
|
||||
To run all tests
|
||||
python run_tests.py
|
||||
|
||||
To run a single test:
|
||||
python run_tests.py test_compute:ComputeTestCase.test_run_terminate
|
||||
|
||||
To run a single test module:
|
||||
python run_tests.py test_compute
|
||||
|
||||
or
|
||||
|
||||
python run_tests.py api.test_wsgi
|
||||
|
||||
"""
|
||||
|
||||
import gettext
|
||||
import os
|
||||
@@ -49,14 +64,10 @@ from nose import config
|
||||
from nose import core
|
||||
from nose import result
|
||||
|
||||
from nova import flags
|
||||
from nova import log as logging
|
||||
from nova.tests import fake_flags
|
||||
|
||||
|
||||
FLAGS = flags.FLAGS
|
||||
|
||||
|
||||
class _AnsiColorizer(object):
|
||||
"""
|
||||
A colorizer is an object that loosely wraps around a stream, allowing
|
||||
@@ -265,6 +276,15 @@ class NovaTestRunner(core.TextTestRunner):
|
||||
|
||||
if __name__ == '__main__':
|
||||
logging.setup()
|
||||
# If any argument looks like a test name but doesn't have "nova.tests" in
|
||||
# front of it, automatically add that so we don't have to type as much
|
||||
argv = []
|
||||
for x in sys.argv:
|
||||
if x.startswith('test_'):
|
||||
argv.append('nova.tests.%s' % x)
|
||||
else:
|
||||
argv.append(x)
|
||||
|
||||
testdir = os.path.abspath(os.path.join("nova","tests"))
|
||||
c = config.Config(stream=sys.stdout,
|
||||
env=os.environ,
|
||||
@@ -275,4 +295,4 @@ if __name__ == '__main__':
|
||||
runner = NovaTestRunner(stream=c.stream,
|
||||
verbosity=c.verbosity,
|
||||
config=c)
|
||||
sys.exit(not core.run(config=c, testRunner=runner))
|
||||
sys.exit(not core.run(config=c, testRunner=runner, argv=argv))
|
||||
|
Reference in New Issue
Block a user