def test_assert_valid_hook_call(self, mock_hook): task = CloudMemorystoreScaleInstanceOperator( task_id=TEST_TASK_ID, memory_size_gb=TEST_INSTANCE_SIZE, location=TEST_LOCATION, instance_id=TEST_INSTANCE_ID, 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.update_instance.assert_called_once_with( update_mask={"paths": ["memory_size_gb"]}, instance={"memory_size_gb": 4}, location=TEST_LOCATION, instance_id=TEST_INSTANCE_ID, project_id=TEST_PROJECT_ID, retry=TEST_RETRY, timeout=TEST_TIMEOUT, metadata=TEST_METADATA, )
task_id="create-instance-and-import", location="europe-north1", instance_id=INSTANCE_NAME_3, instance=FIRST_INSTANCE, input_config={"gcs_source": { "uri": EXPORT_GCS_URL }}, project_id=GCP_PROJECT_ID, ) # [START howto_operator_create_instance_and_import] # [START howto_operator_scale_instance] scale_instance = CloudMemorystoreScaleInstanceOperator( task_id="scale-instance", location="europe-north1", instance_id=INSTANCE_NAME_3, project_id=GCP_PROJECT_ID, memory_size_gb=3, ) # [END howto_operator_scale_instance] # [END howto_operator_export_and_delete_instance] export_and_delete_instance = CloudMemorystoreExportAndDeleteInstanceOperator( task_id="export-and-delete-instance", location="europe-north1", instance=INSTANCE_NAME_3, output_config={"gcs_destination": { "uri": EXPORT_GCS_URL }}, project_id=GCP_PROJECT_ID, )