mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-12 13:29:04 +00:00
abri_api not abri
This commit is contained in:
parent
1085384f21
commit
c0e444fccb
10 changed files with 26 additions and 26 deletions
2
.github/workflows/deploy_terraform.yml
vendored
2
.github/workflows/deploy_terraform.yml
vendored
|
|
@ -718,7 +718,7 @@ jobs:
|
|||
# ============================================================
|
||||
# Deploy Abri Lambda
|
||||
# ============================================================
|
||||
abri_lambda:
|
||||
abri_api_lambda:
|
||||
needs: [abri_image, determine_stage]
|
||||
uses: ./.github/workflows/_deploy_lambda.yml
|
||||
with:
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ from utilities.logger import setup_logger
|
|||
logger = setup_logger()
|
||||
|
||||
|
||||
@task_handler(task_source="abri", source=Source.HUBSPOT_DEAL)
|
||||
@task_handler(task_source="abri_api", source=Source.HUBSPOT_DEAL)
|
||||
def handler(body: dict[str, Any], context: Any) -> Dict[str, str]:
|
||||
request = AbriTriggerRequest.model_validate(body)
|
||||
|
||||
|
|
@ -53,5 +53,7 @@ def handler(body: dict[str, Any], context: Any) -> Dict[str, str]:
|
|||
)
|
||||
summary = dispatch_abri_flows(request, orchestrator, deal_database)
|
||||
|
||||
logger.info("Abri flows completed for deal %s: %s", request.hubspot_deal_id, summary)
|
||||
logger.info(
|
||||
"Abri flows completed for deal %s: %s", request.hubspot_deal_id, summary
|
||||
)
|
||||
return summary
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ locals {
|
|||
module "lambda" {
|
||||
source = "../../modules/lambda_with_sqs"
|
||||
|
||||
name = "abri"
|
||||
name = "abri_api"
|
||||
stage = var.stage
|
||||
|
||||
image_uri = local.image_uri
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
output "abri_queue_url" {
|
||||
output "abri_api_queue_url" {
|
||||
value = module.lambda.queue_url
|
||||
description = "URL of the Abri SQS queue"
|
||||
}
|
||||
|
||||
output "abri_queue_arn" {
|
||||
output "abri_api_queue_arn" {
|
||||
value = module.lambda.queue_arn
|
||||
description = "ARN of the Abri SQS queue"
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
variable "lambda_name" {
|
||||
type = string
|
||||
description = "Logical name of the lambda"
|
||||
default = "abri"
|
||||
default = "abri_api"
|
||||
}
|
||||
|
||||
variable "stage" {
|
||||
|
|
@ -25,10 +25,10 @@ data "terraform_remote_state" "magic_plan" {
|
|||
}
|
||||
}
|
||||
|
||||
data "terraform_remote_state" "abri" {
|
||||
data "terraform_remote_state" "abri_api" {
|
||||
backend = "s3"
|
||||
config = {
|
||||
bucket = "abri-terraform-state"
|
||||
bucket = "abri-api-terraform-state"
|
||||
key = "env:/${var.stage}/terraform.tfstate"
|
||||
region = "eu-west-2"
|
||||
}
|
||||
|
|
@ -68,7 +68,7 @@ module "hubspot_deal_etl" {
|
|||
|
||||
PASHUB_TO_ARA_SQS_URL = data.terraform_remote_state.pashub_to_ara.outputs.pashub_to_ara_queue_url
|
||||
MAGICPLAN_SQS_URL = data.terraform_remote_state.magic_plan.outputs.magic_plan_queue_url
|
||||
ABRI_SQS_URL = data.terraform_remote_state.abri.outputs.abri_queue_url
|
||||
ABRI_SQS_URL = data.terraform_remote_state.abri.outputs.abri_api_queue_url
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -118,7 +118,7 @@ module "hubspot_deal_etl_abri_sqs_policy" {
|
|||
policy_name = "hubspot-deal-etl-abri-sqs-send-${var.stage}"
|
||||
policy_description = "Allow HubSpot ETL Lambda to send messages to the Abri queue"
|
||||
actions = ["sqs:SendMessage"]
|
||||
resources = [data.terraform_remote_state.abri.outputs.abri_queue_arn]
|
||||
resources = [data.terraform_remote_state.abri.outputs.abri_api_queue_arn]
|
||||
}
|
||||
|
||||
resource "aws_iam_role_policy_attachment" "hubspot_deal_etl_abri_sqs_send" {
|
||||
|
|
|
|||
|
|
@ -898,13 +898,13 @@ output "modelling_e2e_ecr_url" {
|
|||
################################################
|
||||
# Abri OpenHousing – Lambda
|
||||
################################################
|
||||
module "abri_state_bucket" {
|
||||
module "abri_api_state_bucket" {
|
||||
source = "../modules/tf_state_bucket"
|
||||
bucket_name = "abri-terraform-state"
|
||||
}
|
||||
|
||||
module "abri_registry" {
|
||||
module "abri_api_registry" {
|
||||
source = "../modules/container_registry"
|
||||
name = "abri"
|
||||
name = "abri_api"
|
||||
stage = var.stage
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,10 +12,8 @@ DEAL_ID = "999"
|
|||
PASHUB_LINK = "https://pashub.example.com/deal/999"
|
||||
MAGICPLAN_QUEUE_URL = "https://sqs.eu-west-2.amazonaws.com/123/magic-plan-dev"
|
||||
PASHUB_QUEUE_URL = "https://sqs.test/pashub"
|
||||
ABRI_QUEUE_URL = "https://sqs.test/abri"
|
||||
ABRI_PROJECT_CODE = (
|
||||
"[Abri Stock Condition - Privately Funded - 062026 - 1247536318670]"
|
||||
)
|
||||
ABRI_API_QUEUE_URL = "https://sqs.test/abri"
|
||||
ABRI_PROJECT_CODE = "[Abri Stock Condition - Privately Funded - 062026 - 1247536318670]"
|
||||
PROJECT = {"project_id": "proj-1", "name": "Project One"}
|
||||
|
||||
|
||||
|
|
@ -63,7 +61,7 @@ def run_handler(
|
|||
mock_boto3.client.return_value = mock_sqs
|
||||
mock_settings.return_value.MAGICPLAN_SQS_URL = MAGICPLAN_QUEUE_URL
|
||||
mock_settings.return_value.PASHUB_TO_ARA_SQS_URL = PASHUB_QUEUE_URL
|
||||
mock_settings.return_value.ABRI_SQS_URL = ABRI_QUEUE_URL
|
||||
mock_settings.return_value.ABRI_SQS_URL = ABRI_API_QUEUE_URL
|
||||
|
||||
handler.__wrapped__({"hubspot_deal_id": DEAL_ID}, "")
|
||||
|
||||
|
|
@ -131,7 +129,9 @@ def test_existing_deal_surveyed_transition__sends_magicplan_sqs() -> None:
|
|||
listing = {"national_uprn": UPRN}
|
||||
|
||||
# Act
|
||||
mock_sqs, _ = run_handler(hubspot_deal=hubspot_deal, db_deal=db_deal, listing=listing)
|
||||
mock_sqs, _ = run_handler(
|
||||
hubspot_deal=hubspot_deal, db_deal=db_deal, listing=listing
|
||||
)
|
||||
|
||||
# Assert
|
||||
mock_sqs.send_message.assert_called_once_with(
|
||||
|
|
@ -241,9 +241,7 @@ def test_existing_deal_pashub_link_unchanged__no_pashub_sqs() -> None:
|
|||
|
||||
def test_existing_abri_deal_first_survey_date__sends_abri_sqs() -> None:
|
||||
# Arrange
|
||||
db_deal = make_db_deal(
|
||||
project_code=ABRI_PROJECT_CODE, confirmed_survey_date=None
|
||||
)
|
||||
db_deal = make_db_deal(project_code=ABRI_PROJECT_CODE, confirmed_survey_date=None)
|
||||
hubspot_deal = make_hubspot_deal(
|
||||
project_code=ABRI_PROJECT_CODE,
|
||||
confirmed_survey_date="2026-06-24",
|
||||
|
|
@ -258,7 +256,7 @@ def test_existing_abri_deal_first_survey_date__sends_abri_sqs() -> None:
|
|||
|
||||
# Assert
|
||||
mock_sqs.send_message.assert_called_once_with(
|
||||
QueueUrl=ABRI_QUEUE_URL,
|
||||
QueueUrl=ABRI_API_QUEUE_URL,
|
||||
MessageBody=json.dumps(
|
||||
{
|
||||
"hubspot_deal_id": DEAL_ID,
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ def test_task_handler_reports_an_ordinarily_failing_record_for_redelivery(
|
|||
) -> None:
|
||||
# Arrange
|
||||
@task_handler(
|
||||
task_source="abri",
|
||||
task_source="abri_api",
|
||||
source=Source.HUBSPOT_DEAL,
|
||||
orchestrator_cm=harness.factory,
|
||||
)
|
||||
|
|
@ -133,7 +133,7 @@ def test_task_handler_does_not_requeue_a_record_failing_non_retriably(
|
|||
) -> None:
|
||||
# Arrange
|
||||
@task_handler(
|
||||
task_source="abri",
|
||||
task_source="abri_api",
|
||||
source=Source.HUBSPOT_DEAL,
|
||||
orchestrator_cm=harness.factory,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue