Skip to content

Commit 6d78950

Browse files
authored
Merge branch 'master' into VED-787-OAS-Update
2 parents 49561d6 + 12ecaec commit 6d78950

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+320
-294
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ updates:
5858
- "/filenameprocessor"
5959
- "/mesh_processor"
6060
- "/recordprocessor"
61-
- "/redis_sync"
61+
- "/lambdas/redis_sync"
6262
- "/lambdas/id_sync"
6363
- "/lambdas/shared"
6464
- "/mns_subscription"

.github/workflows/sonarcloud.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,15 +135,15 @@ jobs:
135135
poetry run coverage xml -o ../mns_subscription-coverage.xml
136136
137137
- name: Run unittest with redis_sync
138-
working-directory: redis_sync
138+
working-directory: lambdas/redis_sync
139139
id: redis_sync
140140
env:
141-
PYTHONPATH: ${{ github.workspace }}/redis_sync/src:${{ github.workspace }}/redis_sync/tests
141+
PYTHONPATH: ${{ env.LAMBDA_PATH }}/redis_sync/src:${{ env.SHARED_PATH }}/src
142142
continue-on-error: true
143143
run: |
144144
poetry install
145-
poetry run coverage run -m unittest discover || echo "redis_sync tests failed" >> ../failed_tests.txt
146-
poetry run coverage xml -o ../redis_sync-coverage.xml
145+
poetry run coverage run --source=src -m unittest discover || echo "redis_sync tests failed" >> ../../failed_tests.txt
146+
poetry run coverage xml -o ../../redis_sync-coverage.xml
147147
148148
- name: Run unittest with shared
149149
working-directory: lambdas/shared

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
SHELL=/usr/bin/env bash -euo pipefail
22

3-
PYTHON_PROJECT_DIRS_WITH_UNIT_TESTS = ack_backend backend batch_processor_filter delta_backend filenameprocessor mesh_processor recordprocessor redis_sync lambdas/id_sync lambdas/shared mns_subscription
3+
PYTHON_PROJECT_DIRS_WITH_UNIT_TESTS = ack_backend backend batch_processor_filter delta_backend filenameprocessor mesh_processor recordprocessor lambdas/redis_sync lambdas/id_sync lambdas/shared mns_subscription
44
PYTHON_PROJECT_DIRS = e2e e2e_batch $(PYTHON_PROJECT_DIRS_WITH_UNIT_TESTS)
55

66
#Installs dependencies using poetry.

immunisation-fhir-api.code-workspace

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"path": "e2e_batch"
2929
},
3030
{
31-
"path": "redis_sync"
31+
"path": "lambdas/redis_sync"
3232
},
3333
{
3434
"path": "mns_subscription"

lambdas/id_sync/src/id_sync.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
"""
77

88
from typing import Any, Dict
9+
from common.aws_lambda_event import AwsLambdaEvent
910
from common.clients import logger, STREAM_NAME
1011
from common.log_decorator import logging_decorator
11-
from common.aws_lambda_event import AwsLambdaEvent
1212
from exceptions.id_sync_exception import IdSyncException
1313
from record_processor import process_record
1414

lambdas/id_sync/src/pds_details.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
Operations related to PDS (Patient Demographic Service)
33
'''
44
import tempfile
5-
from common.clients import logger, secrets_manager_client
6-
from common.cache import Cache
75
from os_vars import get_pds_env
8-
from common.pds_service import PdsService
96
from common.authentication import AppRestrictedAuth, Service
7+
from common.cache import Cache
8+
from common.clients import logger, secrets_manager_client
9+
from common.pds_service import PdsService
1010
from exceptions.id_sync_exception import IdSyncException
1111

1212
pds_env = get_pds_env()
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"python.analysis.extraPaths": [
3+
"./src"
4+
],
5+
"python.testing.unittestArgs": [
6+
"-v",
7+
"-s",
8+
"./",
9+
"-p",
10+
"test_*.py"
11+
],
12+
"python.testing.pytestEnabled": false,
13+
"python.testing.unittestEnabled": true,
14+
"pylint.args": [
15+
"--init-hook",
16+
"import sys; sys.path.append('./src')"
17+
],
18+
"[makefile]": {
19+
"editor.insertSpaces": false,
20+
"editor.detectIndentation": false
21+
},
22+
"files.trimTrailingWhitespace": true,
23+
"[python]": {
24+
"files.trimTrailingWhitespace": true
25+
},
26+
"files.insertFinalNewline": true
27+
}
Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,34 @@ RUN mkdir -p /home/appuser && \
66
echo 'appuser:x:1001:' >> /etc/group && \
77
chown -R 1001:1001 /home/appuser && pip install "poetry~=2.1.4"
88

9-
# Install Poetry as root
10-
COPY poetry.lock pyproject.toml README.md ./
9+
# Install Poetry dependencies
10+
# Copy redis_sync Poetry files
11+
COPY ./redis_sync/poetry.lock ./redis_sync/pyproject.toml ./
12+
COPY ./shared/src/common ./src/common
13+
14+
RUN echo "Listing /var/task after source code copy:" && ls -R /var/task
15+
16+
# Install redis_sync dependencies
17+
WORKDIR /var/task
1118
RUN poetry config virtualenvs.create false && poetry install --no-interaction --no-ansi --no-root --only main
12-
# -----------------------------
13-
FROM base AS test
14-
COPY src src
15-
COPY tests tests
16-
RUN poetry install --no-interaction --no-ansi --no-root && \
17-
pytest --disable-warnings tests
1819

1920
# -----------------------------
2021
FROM base AS build
21-
COPY src .
22+
23+
# Set working directory back to Lambda task root
24+
WORKDIR /var/task
25+
26+
# Copy shared source code
27+
COPY ./shared/src/common ./common
28+
29+
# Copy redis_sync source code
30+
COPY ./redis_sync/src .
31+
32+
# Set correct permissions
2233
RUN chmod 644 $(find . -type f) && chmod 755 $(find . -type d)
34+
2335
# Build as non-root user
2436
USER 1001:1001
37+
38+
# Set the Lambda handler
2539
CMD ["redis_sync.handler"]

lambdas/redis_sync/Makefile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
TEST_ENV := @PYTHONPATH=src:tests:../shared/src
2+
3+
test:
4+
$(TEST_ENV) python -m unittest
5+
6+
coverage-run:
7+
$(TEST_ENV) coverage run -m unittest discover -v
8+
9+
coverage-report:
10+
$(TEST_ENV) coverage report -m
11+
12+
coverage-html:
13+
$(TEST_ENV) coverage html
14+
15+
16+
.PHONY: build package
File renamed without changes.

0 commit comments

Comments
 (0)