Skip to content

Commit 65c8145

Browse files
authored
VED-81 NHS number change notification Lambda (#653)
* lambda, terraform, lambda & shared folder
1 parent 2aea793 commit 65c8145

Some content is hidden

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

60 files changed

+5750
-13
lines changed

.github/dependabot.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ updates:
5858
- "/mesh_processor"
5959
- "/recordprocessor"
6060
- "/redis_sync"
61+
- "/lambdas/id_sync"
62+
- "/lambdas/shared"
6163
schedule:
6264
interval: "daily"
6365
open-pull-requests-limit: 1

.github/workflows/sonarcloud.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ on:
77
pull_request:
88
types: [labeled, opened, synchronize, reopened, unlabeled]
99

10+
env:
11+
SHARED_PATH: ${{ github.workspace }}/lambdas/shared
12+
LAMBDA_PATH: ${{ github.workspace }}/lambdas
13+
1014
jobs:
1115
sonarcloud:
1216
name: SonarCloud
@@ -126,6 +130,30 @@ jobs:
126130
poetry run coverage run -m unittest discover || echo "redis_sync tests failed" >> ../failed_tests.txt
127131
poetry run coverage xml -o ../redis_sync-coverage.xml
128132
133+
- name: Run unittest with shared
134+
working-directory: lambdas/shared
135+
id: shared
136+
env:
137+
PYTHONPATH: ${{ env.SHARED_PATH }}/src
138+
continue-on-error: true
139+
run: |
140+
poetry env use 3.11
141+
poetry install
142+
poetry run coverage run --rcfile=.coveragerc --source=src -m unittest discover -s tests -p "test_*.py" -v || echo "shared tests failed" >> ../../failed_tests.txt
143+
poetry run coverage xml -o ../../shared-coverage.xml
144+
145+
- name: Run unittest with id_sync
146+
working-directory: lambdas/id_sync
147+
id: id_sync
148+
env:
149+
PYTHONPATH: ${{ env.LAMBDA_PATH }}/id_sync/src:${{ env.SHARED_PATH }}/src
150+
continue-on-error: true
151+
run: |
152+
poetry env use 3.11
153+
poetry install
154+
poetry run coverage run --rcfile=.coveragerc --source=src -m unittest discover || echo "id_sync tests failed" >> ../../failed_tests.txt
155+
poetry run coverage xml -o ../../id_sync-coverage.xml
156+
129157
- name: Run Test Failure Summary
130158
id: check_failure
131159
run: |

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ openapi.json
2929
!**/.vscode/settings.json.default
3030

3131
devtools/volume/
32-
backend/tests/.coverage
32+
**/.coverage

Makefile

Lines changed: 2 additions & 2 deletions
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 delta_backend filenameprocessor mesh_processor recordprocessor redis_sync mns_subscription
3+
PYTHON_PROJECT_DIRS_WITH_UNIT_TESTS = ack_backend backend delta_backend filenameprocessor mesh_processor recordprocessor 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.
@@ -41,7 +41,7 @@ build-proxy:
4141
scripts/build_proxy.sh
4242

4343
#Files to loop over in release
44-
_dist_include="pytest.ini poetry.lock poetry.toml pyproject.toml Makefile build/. specification sandbox terraform scripts $(PYTHON_PROJECT_DIRS)"
44+
_dist_include="pytest.ini poetry.lock poetry.toml pyproject.toml Makefile build/. specification sandbox terraform scripts $(PYTHON_PROJECT_DIRS) $(PYTHON_LAMBDA_DEPENDENCIES)"
4545

4646

4747
#Create /dist/ sub-directory and copy files into directory

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ See https://nhsd-confluence.digital.nhs.uk/display/APM/Glossary.
2424
| `mesh_processor` | **Imms Batch** – MESH-specific batch processing functionality. |
2525
| `recordprocessor` | **Imms Batch** – Handles batch record processing. |
2626
| `redis_sync` | **Imms Redis** – Handles sync s3 to REDIS. |
27+
| `id_sync` | **Imms Redis** – Handles sync SQS to IEDS. |
28+
| `shared` | **Imms Redis** – Not a lambda but Shared Code for lambdas |
2729
---
2830

2931
### Pipelines

azure/templates/deploy-stage.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ parameters:
1616
default: ''
1717
- name: proxy_path
1818
type: string
19-
default: 'internal-dev'
19+
default: 'internal-dev'
2020
- name: secret_file_ids
2121
type: object
2222
default: []
@@ -150,10 +150,9 @@ jobs:
150150
echo "##vso[task.setvariable variable=FULLY_QUALIFIED_SERVICE_NAME]${FULLY_QUALIFIED_SERVICE_NAME}"
151151
fi
152152
displayName: Override FULLY_QUALIFIED_SERVICE_NAME
153-
153+
154154
- checkout: self
155155
path: "s/${{ parameters.service_name }}"
156-
submodules: true
157156

158157
- task: UsePythonVersion@0
159158
displayName: "Use Python ${{ parameters.python_version }}"
@@ -174,4 +173,4 @@ jobs:
174173
parameters:
175174
state: failure
176175
on_failure: true
177-
description: "Deploy failed"
176+
description: "Deploy failed"

immunisation-fhir-api.code-workspace

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,13 @@
3232
},
3333
{
3434
"path": "mns_subscription"
35-
}
35+
},
36+
{
37+
"path": "lambdas/id_sync"
38+
},
39+
{
40+
"path": "lambdas/shared"
41+
}
3642
],
37-
"settings": {},
43+
"settings": {}
3844
}

lambdas/.coveragerc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[report]
2+
omit =
3+
shared/tests/*
4+
shared/tests/*/*
5+
shared/tests/*/*/*
6+
id_sync/tests/*
7+
id_sync/tests/*/*
8+
id_sync/tests/*/*/*

lambdas/id_sync/.coveragerc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[report]
2+
omit =
3+
tests/*
4+
tests/*/*
5+
tests/*/*/*
6+
tests/test_*.py
7+
tests/*/test_*.py
8+
tests/*/*/test_*.py
9+
id_sync/tests/*
10+
id_sync/tests/*/*
11+
id_sync/tests/*/*/*
12+
../shared/tests/*
13+
../shared/tests/*/*
14+
../shared/tests/*/*/*
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+
}

0 commit comments

Comments
 (0)