Skip to content

Commit b978130

Browse files
committed
Merge branch 'VED-81-Number-Update' into VED-480-Number-Update-terraform
2 parents 34828b5 + 0dd5778 commit b978130

File tree

7 files changed

+44
-10
lines changed

7 files changed

+44
-10
lines changed

.github/workflows/sonarcloud.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,13 @@ jobs:
145145
poetry install
146146
poetry run coverage run -m unittest discover || echo "shared tests failed" >> ../../failed_tests.txt
147147
poetry run coverage xml -o ../../shared-coverage.xml
148+
ls ../../shared-coverage.xml
149+
# show director of ../.. as absolute path
150+
echo "Parent directory of shared-coverage.xml: $(pwd)/../../"
151+
#check files created
152+
if [ ! -f ../../shared-coverage.xml ]; then
153+
echo "shared-coverage.xml not found"
154+
fi
148155
149156
- name: Run unittest with id_sync
150157
working-directory: lambdas/id_sync
@@ -168,6 +175,7 @@ jobs:
168175
run: |
169176
echo "Checking for test failures..."
170177
ls *-coverage.xml
178+
cat shared-coverage.xml || echo "shared-coverage.xml not found"
171179
if [ -s failed_tests.txt ]; then
172180
echo "The following tests failed:"
173181
cat failed_tests.txt

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@ openapi.json
3131
devtools/volume/
3232
backend/tests/.coverage
3333
redis_sync/.vscode/settings.json.default
34+
lambdas/shared/.coverage

lambdas/shared/.coverage

0 Bytes
Binary file not shown.

lambdas/shared/Makefile

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
1-
21
test:
3-
@PYTHONPATH=src python -m unittest discover -s tests -p "test_*.py" -v
2+
@PYTHONPATH=src python -m unittest discover -s tests -p "test_*.py" -v
43

54
test-list:
6-
@PYTHONPATH=src:tests:tests python -m unittest discover -s tests/common -p "test_*.py" --verbose | grep test_
5+
@PYTHONPATH=src:tests python -m unittest discover -s tests -p "test_*.py" --verbose | grep test_
76

87
coverage-run:
9-
@PYTHONPATH=src:tests coverage run -m unittest discover -v
8+
@PYTHONPATH=src coverage run --source=src -m unittest discover -s tests -p "test_*.py" -v
109

1110
coverage-report:
12-
coverage report -m
11+
@PYTHONPATH=src coverage report -m
1312

1413
coverage-html:
15-
coverage html
14+
@PYTHONPATH=src coverage html
15+
16+
coverage: coverage-run coverage-report
17+
18+
coverage-full: coverage-run coverage-report coverage-html
1619

17-
.PHONY: build package test
20+
.PHONY: build package test test-list coverage-run coverage-report coverage-html coverage coverage-full

lambdas/shared/pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ description = ""
1313
authors = ["s.wates <[email protected]>"]
1414
readme = "README.md"
1515
packages = [
16-
{include = "common", from = "src"},
17-
{include = "aws", from = "src"}
16+
{include = "common", from = "src"}
1817
]
1918

2019
[tool.poetry.dependencies]

lambdas/shared/tests/test_common/test_sqs_event_record.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,28 @@ def test_repr(self):
4242
self.assertIn("abc-123", repr(record))
4343
self.assertTrue(repr(record).startswith("<SQSEventRecord"))
4444

45+
def test_initialization(self):
46+
record = SQSEventRecord(
47+
message_id="test-id",
48+
receipt_handle="test-handle",
49+
body="{}",
50+
attributes={},
51+
message_attributes={},
52+
md5_of_body="test-md5",
53+
event_source="aws:sqs",
54+
event_source_arn="my-arn",
55+
aws_region="us-east-1"
56+
)
57+
self.assertEqual(record.message_id, "test-id")
58+
self.assertEqual(record.receipt_handle, "test-handle")
59+
self.assertEqual(record.body, "{}")
60+
self.assertEqual(record.attributes, {})
61+
self.assertEqual(record.message_attributes, {})
62+
self.assertEqual(record.md5_of_body, "test-md5")
63+
self.assertEqual(record.event_source, "aws:sqs")
64+
self.assertEqual(record.event_source_arn, "my-arn")
65+
self.assertEqual(record.aws_region, "us-east-1")
66+
4567

4668
if __name__ == '__main__':
4769
unittest.main()

sonar-project.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ sonar.projectKey=NHSDigital_immunisation-fhir-api
33
sonar.organization=nhsdigital
44
sonar.host.url=https://sonarcloud.io
55
sonar.python.version=3.11
6-
sonar.exclusions=**/e2e/**,**/e2e_batch/**,**/temporary_sandbox/**,**/devtools/**,**/proxies/**,**/scripts/**,**/terraform/**,**/tests/**,lambdas/redis_sync/src/log_decorator.py,lambdas/shared/src/common/log_decorator.py,lambdas/shared/src/common/clients.py,lambdas/id_sync/src/id_sync.py
6+
sonar.spd.exclusions=lambdas/redis_sync/src/log_decorator.py,lambdas/shared/src/common/log_decorator.py,lambdas/shared/src/common/clients.py,lambdas/id_sync/src/id_sync.py
7+
sonar.exclusions=**/e2e/**,**/e2e_batch/**,**/temporary_sandbox/**,**/devtools/**,**/proxies/**,**/scripts/**,**/terraform/**,**/tests/**
78
sonar.python.coverage.reportPaths=backend-coverage.xml,delta-coverage.xml,ack-lambda-coverage.xml,filenameprocessor-coverage.xml,recordforwarder-coverage.xml,recordprocessor-coverage.xml,mesh_processor-coverage.xml,redis_sync-coverage.xml,id_sync-coverage.xml,shared-coverage.xml
89
sonar.issue.ignore.multicriteria=exclude_snomed_urls,exclude_hl7_urls
910
sonar.issue.ignore.multicriteria.exclude_snomed_urls.ruleKey=python:S5332

0 commit comments

Comments
 (0)