Example #1
0
class CinderDAOTest(TestCase):
    """The test cases for cinder database operations"""

    def setUp(self):
        self.cinder_dao =\
                CinderDAO("mysql+pymysql://root:^[email protected]/cinder")

    def test_init(self):
        """Test the initialization of CinderDAO"""
        cinder_dao = CinderDAO("test url")
        self.assertIsNotNone(cinder_dao)

    def test_get_volumes(self):
        """Test retrieving the volumes belonging to the project"""

        # TODO move project id to configuration file
        result_set =  self.cinder_dao.get_volumes(
                "18fb285bfa4f4ddaaebb7512683b6a52")

        self.assertGreater(len(result_set), 0)

    def test_get_snapshots(self):
        """test retrieving the snapshots of the given project"""
        snapshots = self.cinder_dao.get_snapshots(
                "18fb285bfa4f4ddaaebb7512683b6a52")
        self.assertGreater(len(snapshots), 0)
Example #2
0
 def setUpClass(cls):
     """
     setup the volume resource whose billing data will be checked for testing shared across
     all of the test cases
     """
     cinder_dao = CinderDAO("mysql+pymysql://root:^[email protected]/cinder")
     # TODO move project id to configuration file
     volume = cinder_dao.get_volumes("18fb285bfa4f4ddaaebb7512683b6a52")[0]
     GringottsDAOTest.RESOURCE_ID = volume.id
Example #3
0
def verify_snapshot_biil(project):
    cinder_dao = CinderDAO("mysql+pymysql://root:^[email protected]/cinder")
    snapshots = cinder_dao.get_snapshots(project.id)

    for snapshot in snapshots:
        LOG.info("++++++++++++++++++++++++++++++++++++++++++++++++++")
        LOG.info("snapshot")
        LOG.info("\tid: " + snapshot.id)
        LOG.info("\tvolume_id: " + snapshot.volume_id)
        LOG.info("\tstatus: " + snapshot.status)

        verify_billing(snapshot.id, "snapshot")

    LOG.info("++++++++++++++++++++++++++++++++++++++++++++++++++")
Example #4
0
def verify_volume_biil(project):
    cinder_dao = CinderDAO("mysql+pymysql://root:^[email protected]/cinder")
    volumes = cinder_dao.get_volumes(project.id)

    for volume in volumes:
        LOG.info("++++++++++++++++++++++++++++++++++++++++++++++++++")
        LOG.info("Volume")
        LOG.info("\tname: %s" % volume.display_name)
        LOG.info("\tid: " + volume.id)
        LOG.info("\tstatus: " + volume.status)

        verify_billing(volume.id, "volume")

    LOG.info("++++++++++++++++++++++++++++++++++++++++++++++++++")
Example #5
0
 def setUp(self):
     self.cinder_dao =\
             CinderDAO("mysql+pymysql://root:^[email protected]/cinder")