예제 #1
0
파일: factory.py 프로젝트: conare/shelvery
 def get_shelvery_instance(cls, type: str) -> ShelveryEngine:
     if type == 'ebs':
         return ShelveryEBSBackup()
     
     if type == 'rds':
         return ShelveryRDSBackup()
     
     if type == 'ami':
         raise Exception("AMIs not supported yet")
예제 #2
0
    def test_Cleanup(self):
        print(f"rds - Running cleanup test")
        rds_backups_engine = ShelveryRDSBackup()
        backups = initCleanup(rds_backups_engine)
        rds_client = AwsHelper.boto3_client('rds')

        valid = False
        for backup in backups:
            valid = instanceCleanupBackups(self=self,
                                           backup=backup,
                                           backup_engine=rds_backups_engine,
                                           service_client=rds_client)

        self.assertTrue(valid)
    def test_PullRdsBackup(self):
        os.environ['SHELVERY_MONO_THREAD'] = '1'
        cleanRdsSnapshots()

        source_aws_id = source_account
        os.environ["shelvery_source_aws_account_ids"] = str(source_aws_id)

        print(f"rds - Running pull shared backups test")
    
        rds_client = AwsHelper.boto3_client('rds', region_name='ap-southeast-2')
        rds_backup_engine = ShelveryRDSBackup()


        print("Pulling shared backups")
        rds_backup_engine.pull_shared_backups()

        #Get post-pull snapshot count
        pulled_snapshot = rds_client.describe_db_snapshots(
            DBInstanceIdentifier='shelvery-test-rds',
            SnapshotType='Manual'
        )

        print("PULLED:" + str(pulled_snapshot))
        self.assertTrue(len(pulled_snapshot['DBSnapshots']) == 1)
예제 #4
0
    def test_shareRdsBackup(self):

        print(f"rds - Running share backup test")
        rds_backups_engine = ShelveryRDSBackup()

        backups = initShareBackups(rds_backups_engine, str(self.share_with_id))

        print("Shared backups created")

        valid = False
        # validate there is
        for backup in backups:
            valid = instanceShareBackups(self=self, backup=backup)

        self.assertTrue(valid)
예제 #5
0
    def get_shelvery_instance(cls, type: str) -> ShelveryEngine:
        if type == 'ebs':
            return ShelveryEBSBackup()

        if type == 'rds':
            return ShelveryRDSBackup()

        if type == 'rds_cluster':
            return ShelveryRDSClusterBackup()

        if type == 'ec2ami':
            return ShelveryEC2AMIBackup()

        if type == 'redshift':
            return ShelveryRedshiftBackup()
예제 #6
0
    def test_CreateRdsBackup(self):
        print(f"rds - Running backup test")

        rds_backup_engine = ShelveryRDSBackup()
        print(f"rds - Shelvery backup initialised")

        backups = initCreateBackups(rds_backup_engine)
        print("Created RDS backups")

        valid = False

        # validate there is
        for backup in backups:
            valid = compareBackups(self=self,
                                   backup=backup,
                                   backup_engine=rds_backup_engine)
        self.assertTrue(valid)