Skip to content

Commit 65276a0

Browse files
author
Sam Ainsworth
authored
Revert today (#125)
* Revert "Renovate Update dependency flake8 to v7" This reverts commit ee2a56b. * Revert "UML-2734 automate integration tests (#119)" This reverts commit d34ec22.
1 parent b53fd42 commit 65276a0

File tree

14 files changed

+73
-123
lines changed

14 files changed

+73
-123
lines changed

.github/workflows/build.yml

+4-16
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ jobs:
1616
- uses: actions/checkout@v4
1717
- uses: actions/setup-python@v5
1818
with:
19-
python-version: '3.10'
19+
python-version: '3.8'
2020
- uses: unfor19/install-aws-cli-action@v1
2121

2222
- name: Install flake8
2323
run: pip3 install flake8
2424

25-
- name: Run Flake8
25+
- name: Run Flask8
2626
run: |
2727
flake8 --ignore Q000,W503 lambda_functions
2828
@@ -38,7 +38,7 @@ jobs:
3838
run: |
3939
for i in $(ls -d lambda_functions/*/ | awk -F'/' '{print $2}' | grep '^v[1-9]\+')
4040
do
41-
export LAYER_PATH=lambda_functions/"${i}"/lambda_layers/python/lib/python3.10/site-packages
41+
export LAYER_PATH=lambda_functions/"${i}"/lambda_layers/python/lib/python3.8/site-packages
4242
pip3 install -r lambda_functions/"${i}"/requirements/requirements.txt --target ./$LAYER_PATH/
4343
done
4444
@@ -156,11 +156,9 @@ jobs:
156156
# --git_commit_provider="${GIT_COMMIT_PROVIDER}" || echo "Failed but because consumer pacts not set up yet"
157157

158158
ephemeral_environment:
159-
name: Create Ephemeral Environment and run Integration Tests
159+
name: Create Ephemeral Environment
160160
runs-on: "ubuntu-latest"
161161
needs: [build_and_test, terraform_checks]
162-
outputs:
163-
branch_name: ${{ steps.extract_branch.outputs.branch_formatted }}
164162
steps:
165163
- uses: actions/checkout@v4
166164
- uses: hashicorp/setup-terraform@v3
@@ -206,13 +204,3 @@ jobs:
206204
env:
207205
TF_WORKSPACE: ${{ steps.extract_branch.outputs.branch_formatted }}
208206
run: terraform-workspace-manager -register-workspace=$TF_WORKSPACE -time-to-protect=4 -aws-account-id=288342028542 -aws-iam-role=integrations-ci
209-
210-
integration_tests:
211-
name: Integration Tests
212-
needs: [ephemeral_environment]
213-
uses: ./.github/workflows/sub-task-integration-tests.yml
214-
with:
215-
branch_name: ${{ needs.ephemeral_environment.outputs.branch_name }}
216-
secrets:
217-
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID_ACTIONS }}
218-
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY_ACTIONS }}

.github/workflows/sub-task-integration-tests.yml

-62
This file was deleted.

integration_tests/v1/conftest.py

+32-14
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,51 @@
88
from jsonschema import validate, exceptions
99
from requests_aws4auth import AWS4Auth
1010

11-
BRANCH_NAME = os.getenv("BRANCH_NAME")
12-
DATA_LPA_URL_ROOT = f"https://{BRANCH_NAME}.dev.lpa.api.opg.service.justice.gov.uk/v1"
13-
HEALTHCHECK_URL = f"{DATA_LPA_URL_ROOT}/healthcheck"
14-
ONLINE_TOOL_URL = f"{DATA_LPA_URL_ROOT}/lpa-online-tool/lpas"
15-
USE_AN_LPA_URL = f"{DATA_LPA_URL_ROOT}/use-an-lpa/lpas"
16-
REQUEST_CODE_URL = f"{DATA_LPA_URL_ROOT}/use-an-lpa/lpas/requestCode"
11+
opg_sirius_api_gateway_dev_aws = {
12+
"name": "original collections api on aws dev",
13+
"online_tool_endpoint": {
14+
"url": "https://dev.lpa.api.opg.service.justice.gov.uk/v1/lpa-online-tool/lpas",
15+
"method": "GET",
16+
"valid_lpa_online_tool_ids": ["A33718377316"],
17+
"invalid_lpa_online_tool_ids": ["banana"],
18+
},
19+
"use_an_lpa_endpoint": {
20+
"url": "https://dev.lpa.api.opg.service.justice.gov.uk/v1/use-an-lpa/lpas",
21+
"method": "GET",
22+
"valid_sirius_uids": ["700000000013"],
23+
"invalid_sirius_uids": ["9"],
24+
},
25+
"request_code_endpoint": {
26+
"url": "https://dev.lpa.api.opg.service.justice.gov.uk/v1/lpas/requestCode",
27+
"method": "POST",
28+
"valid_sirius_lpas": [
29+
{"caseUid": 700000000013, "actorUid": 700000000997},
30+
{"caseUid": 700000000013, "actorUid": 700000000971},
31+
],
32+
},
33+
}
34+
1735

1836
opg_data_lpa_dev_aws = {
1937
"name": "new collections api on aws dev",
2038
"healthcheck_endpoint": {
21-
"url": HEALTHCHECK_URL,
39+
"url": "https://uml-XXXX.dev.lpa.api.opg.service.justice.gov.uk/v1/healthcheck",
2240
"method": "GET",
2341
},
2442
"online_tool_endpoint": {
25-
"url": ONLINE_TOOL_URL,
43+
"url": "https://uml-XXXX.dev.lpa.api.opg.service.justice.gov.uk/v1/lpa-online-tool/lpas",
2644
"method": "GET",
2745
"valid_lpa_online_tool_ids": ["A33718377316"],
2846
"invalid_lpa_online_tool_ids": ["banana"],
2947
},
3048
"use_an_lpa_endpoint": {
31-
"url": USE_AN_LPA_URL,
49+
"url": "https://uml-XXXX.dev.lpa.api.opg.service.justice.gov.uk/v1/use-an-lpa/lpas",
3250
"method": "GET",
3351
"valid_sirius_uids": ["700000000047"],
3452
"invalid_sirius_uids": ["9"],
3553
},
3654
"request_code_endpoint": {
37-
"url": REQUEST_CODE_URL,
55+
"url": "https://uml-XXXX.dev.lpa.api.opg.service.justice.gov.uk/v1/use-an-lpa/lpas/requestCode",
3856
"method": "POST",
3957
"valid_sirius_lpas": [
4058
{"caseUid": 700000000013, "actorUid": 700000000997},
@@ -47,23 +65,23 @@
4765
opg_data_lpa_local_mock = {
4866
"name": "new collections api local mock",
4967
"healthcheck_endpoint": {
50-
"url": "http://127.0.0.1:4343/v1/healthcheck",
68+
"url": "http://0.0.0.0:4343/v1/healthcheck",
5169
"method": "GET",
5270
},
5371
"online_tool_endpoint": {
54-
"url": "http://127.0.0.1:4343/v1/lpa-online-tool/lpas",
72+
"url": "http://0.0.0.0:4343/v1/lpa-online-tool/lpas",
5573
"method": "GET",
5674
"valid_lpa_online_tool_ids": ["A39721583862"],
5775
"invalid_lpa_online_tool_ids": ["banana"],
5876
},
5977
"use_an_lpa_endpoint": {
60-
"url": "http://127.0.01:4343/v1/use-an-lpa/lpas",
78+
"url": "http://0.0.0.0:4343/v1/use-an-lpa/lpas",
6179
"method": "GET",
6280
"valid_sirius_uids": ["700000000138"],
6381
"invalid_sirius_uids": ["9"],
6482
},
6583
"request_code_endpoint": {
66-
"url": "http://127.0.0.1:4343/v1/use-an-lpa/lpas/requestCode",
84+
"url": "http://0.0.0.0:4343/v1/use-an-lpa/lpas/requestCode",
6785
"method": "POST",
6886
"valid_sirius_lpas": [
6987
{"caseUid": 700000000138, "actorUid": 700000000997},

integration_tests/v1/requirements.txt

+7-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
pytest==8.1.1
2-
pytest-env==1.1.3
3-
pytest-xdist==3.5.0
4-
pytest-html==4.1.1
5-
requests_aws4auth==1.2.3
6-
boto3==1.34.87
7-
jsonschema==4.21.1
8-
fakeredis==2.21.3
9-
flask==3.0.3
1+
pytest
2+
pytest-env
3+
pytest-xdist
4+
pytest-html
5+
requests_aws4auth
6+
boto3
7+
jsonschema

integration_tests/v1/test_healthcheck.py

+2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66
@pytest.mark.smoke_test
77
@pytest.mark.parametrize("test_config", configs_to_test)
88
def test_healthcheck_route(test_config):
9+
910
if test_config["name"] == "original collections api on aws dev":
1011
print("Healthcheck does not exist on original collections api on aws dev")
1112
pass
1213
else:
14+
1315
status, response = send_a_request(
1416
test_config=test_config,
1517
url=f"{test_config['healthcheck_endpoint']['url']}",

integration_tests/v1/test_lpa_online_tool.py

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
@pytest.mark.smoke_test
77
@pytest.mark.parametrize("test_config", configs_to_test)
88
def test_online_tool_route(test_config):
9+
910
for valid_id in test_config["online_tool_endpoint"]["valid_lpa_online_tool_ids"]:
1011
status, response = send_a_request(
1112
test_config=test_config,
@@ -22,6 +23,7 @@ def test_online_tool_route(test_config):
2223
@pytest.mark.smoke_test
2324
@pytest.mark.parametrize("test_config", configs_to_test)
2425
def test_online_tool_route_invalid_id(test_config):
26+
2527
for valid_id in test_config["online_tool_endpoint"]["invalid_lpa_online_tool_ids"]:
2628
status, response = send_a_request(
2729
test_config=test_config,

integration_tests/v1/test_request_code.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
@pytest.mark.smoke_test
77
@pytest.mark.parametrize("test_config", configs_to_test)
88
def test_request_code_route(test_config):
9+
910
for lpa in test_config["request_code_endpoint"]["valid_sirius_lpas"]:
1011
status, response = send_a_request(
1112
test_config=test_config,
1213
url=f"{test_config['request_code_endpoint']['url']}",
1314
method=test_config["request_code_endpoint"]["method"],
14-
payload={"case_uid": lpa["caseUid"], "actor_uid": lpa["actorUid"]},
15+
payload={"case_uid": lpa['caseUid'], "actor_uid": lpa['actorUid']}
1516
)
1617

17-
assert status == 204
18+
assert status == 204

integration_tests/v1/test_use_an_lpa.py

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
@pytest.mark.smoke_test
77
@pytest.mark.parametrize("test_config", configs_to_test)
88
def test_use_an_lpa_route(test_config):
9+
910
for valid_id in test_config["use_an_lpa_endpoint"]["valid_sirius_uids"]:
1011
status, response = send_a_request(
1112
test_config=test_config,
@@ -23,6 +24,7 @@ def test_use_an_lpa_route(test_config):
2324
@pytest.mark.smoke_test
2425
@pytest.mark.parametrize("test_config", configs_to_test)
2526
def test_use_an_lpa_route_invalid_id(test_config):
27+
2628
for valid_id in test_config["use_an_lpa_endpoint"]["invalid_sirius_uids"]:
2729
status, response = send_a_request(
2830
test_config=test_config,

lambda_functions/v1/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.10-slim
1+
FROM python:3.8-slim-buster
22
WORKDIR /var/www/lambda_functions/v1
33

44
# Install Python Dependencies

lambda_functions/v1/Dockerfile-tests

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.12-slim
1+
FROM python:3.8.17-slim-buster
22
ARG FUNCTION_DIR="lpa_data/lambda_functions/v1"
33

44
# Create function directory
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
connexion==2.14.2
2-
fakeredis==2.21.3
3-
flake8==7.0.0
1+
connexion==2.7.0
2+
fakeredis==1.4.5
3+
flake8==3.8.4
44
flake8-quotes==3.2.0
5-
hypothesis==6.100.1
6-
moto~=5.0.0
7-
pytest==8.1.1
8-
pytest-cov==5.0.0
9-
pytest-env==1.1.3
10-
pytest-html==4.1.1
11-
tenacity==8.2.3
12-
validators==0.23.1
13-
yarl==1.9.4
14-
importlib-metadata==7.0.2
5+
hypothesis==6.0.0
6+
moto~=4.1
7+
pytest==6.2.1
8+
pytest-cov==2.10.1
9+
pytest-env==0.6.2
10+
pytest-html==3.1.1
11+
tenacity==6.3.1
12+
validators==0.18.2
13+
yarl==1.6.3
14+
importlib-metadata==4.13.0
1515
opg-sirius-service==2.1.1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#Update this date to trigger update of layers: 20230619
2-
Flask==3.0.2
2+
Flask==2.2.5
33
markupsafe==2.1.1
4-
localstack-client==2.5
4+
localstack-client==1.39
55
redis==4.4.4
66
requests==2.31.0
77
Werkzeug==3.0.1
8+
requests-aws4auth==1.0.1
89
opg-sirius-service==2.1.1

mock_sirius_backend/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# our base image
2-
FROM python:3.10-slim
2+
FROM python:3.8-slim
33

44
WORKDIR /var/www/
55
COPY requirements.txt .

terraform/environment/modules/lambda/lambda.tf

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ resource "aws_lambda_function" "lambda_function" {
1313
function_name = local.lambda
1414
role = aws_iam_role.lambda_role.arn
1515
handler = var.handler
16-
runtime = "python3.10"
16+
runtime = "python3.8"
1717
timeout = 15
1818
depends_on = [aws_cloudwatch_log_group.lambda]
1919
layers = [aws_lambda_layer_version.lambda_layer.arn]
@@ -58,7 +58,7 @@ resource "aws_lambda_layer_version" "lambda_layer" {
5858
source_code_hash = data.archive_file.lambda_layer_archive.output_base64sha256
5959
layer_name = "lpa_requirements_${var.environment}"
6060

61-
compatible_runtimes = ["python3.10"]
61+
compatible_runtimes = ["python3.8"]
6262

6363
lifecycle {
6464
ignore_changes = [

0 commit comments

Comments
 (0)