def test_assert_valid_hook_call(self, mock_hook): task = CloudMemorystoreGetInstanceOperator( task_id=TEST_TASK_ID, location=TEST_LOCATION, instance=TEST_INSTANCE_NAME, project_id=TEST_PROJECT_ID, retry=TEST_RETRY, timeout=TEST_TIMEOUT, metadata=TEST_METADATA, gcp_conn_id=TEST_GCP_CONN_ID, impersonation_chain=TEST_IMPERSONATION_CHAIN, ) task.execute(mock.MagicMock()) mock_hook.assert_called_once_with( gcp_conn_id=TEST_GCP_CONN_ID, impersonation_chain=TEST_IMPERSONATION_CHAIN, ) mock_hook.return_value.get_instance.assert_called_once_with( location=TEST_LOCATION, instance=TEST_INSTANCE_NAME, project_id=TEST_PROJECT_ID, retry=TEST_RETRY, timeout=TEST_TIMEOUT, metadata=TEST_METADATA, )
) # [END howto_operator_create_instance_result] create_instance_2 = CloudMemorystoreCreateInstanceOperator( task_id="create-instance-2", location="europe-north1", instance_id=INSTANCE_NAME_2, instance=SECOND_INSTANCE, project_id=GCP_PROJECT_ID, ) # [START howto_operator_get_instance] get_instance = CloudMemorystoreGetInstanceOperator( task_id="get-instance", location="europe-north1", instance=INSTANCE_NAME, project_id=GCP_PROJECT_ID, do_xcom_push=True, ) # [END howto_operator_get_instance] # [START howto_operator_get_instance_result] get_instance_result = BashOperator( task_id="get-instance-result", bash_command="echo \"{{ task_instance.xcom_pull('get-instance') }}\"") # [END howto_operator_get_instance_result] # [START howto_operator_failover_instance] failover_instance = CloudMemorystoreFailoverInstanceOperator( task_id="failover-instance", location="europe-north1",