def poke(self, context): self.log.info( 'Poking for status : {self.target_status}\n' 'for cluster {self.cluster_identifier}'.format(**locals())) hook = RedshiftHook(aws_conn_id=self.aws_conn_id) return hook.cluster_status( self.cluster_identifier) == self.target_status
def test_create_cluster_snapshot_returns_snapshot_data(self): self._create_clusters() hook = RedshiftHook(aws_conn_id='aws_default') snapshot = hook.create_cluster_snapshot('test_snapshot_2', 'test_cluster') self.assertNotEqual(snapshot, None)
def test_restore_from_cluster_snapshot_returns_dict_with_cluster_data(self): hook = RedshiftHook(aws_conn_id='aws_default') hook.create_cluster_snapshot('test_snapshot', 'test_cluster') self.assertEqual( hook.restore_from_cluster_snapshot( 'test_cluster_3', 'test_snapshot' )['ClusterIdentifier'], 'test_cluster_3')
def test_restore_from_cluster_snapshot_returns_dict_with_cluster_data( self): hook = RedshiftHook(aws_conn_id='aws_default') hook.create_cluster_snapshot('test_snapshot', 'test_cluster') self.assertEqual( hook.restore_from_cluster_snapshot( 'test_cluster_3', 'test_snapshot')['ClusterIdentifier'], 'test_cluster_3')
def return_hook(conn_info): if conn_info['hook_type'] == 'postgres': return { 'type': 'db', 'db_type': conn_info['hook_type'], 'hook': PostgresHook(conn_info['conn_id']) } if conn_info['hook_type'] == 'redshift': return { 'type': 'db', 'db_type': conn_info['hook_type'], 'hook': RedshiftHook(conn_info['conn_id']) } return None
def test_cluster_status_returns_cluster_not_found(self): self._create_clusters() hook = RedshiftHook(aws_conn_id='aws_default') status = hook.cluster_status('test_cluster_not_here') self.assertEqual(status, 'cluster_not_found')
def test_delete_cluster_returns_a_dict_with_cluster_data(self): self._create_clusters() hook = RedshiftHook(aws_conn_id='aws_default') cluster = hook.delete_cluster('test_cluster_2') self.assertNotEqual(cluster, None)
def test_cluster_status_returns_available_cluster(self): self._create_clusters() hook = RedshiftHook(aws_conn_id='aws_default') status = hook.cluster_status('test_cluster') self.assertEqual(status, 'available')
def poke(self, context): self.log.info('Poking for status : %s\nfor cluster %s', self.target_status, self.cluster_identifier) hook = RedshiftHook(aws_conn_id=self.aws_conn_id) return hook.cluster_status( self.cluster_identifier) == self.target_status
def poke(self, context): self.log.info('Poking for status : %s\nfor cluster %s', self.target_status, self.cluster_identifier) hook = RedshiftHook(aws_conn_id=self.aws_conn_id) return hook.cluster_status(self.cluster_identifier) == self.target_status
def poke(self, context): self.log.info('Poking for status : {self.target_status}\n' 'for cluster {self.cluster_identifier}'.format(**locals())) hook = RedshiftHook(aws_conn_id=self.aws_conn_id) return hook.cluster_status(self.cluster_identifier) == self.target_status