Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PPANTT-196] feat: introducing int tests #6

Merged
merged 10 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/code_review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ jobs:
# export CANARY=${{ inputs.canary }}
# export CUCUMBER_PUBLISH_TOKEN=${{ secrets.CUCUMBER_PUBLISH_TOKEN }}
# export SUBKEY=${{ secrets.SUBKEY }}
# export GPD_SUBKEY='${{ secrets.GPD_SUBKEY }}'
#
# cd ./integration-test
# chmod +x ./run_integration_test.sh
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/integration_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ jobs:
export SUBKEY=${{ secrets.SUBKEY }}
export CANARY=${{ inputs.canary }}
export CUCUMBER_PUBLISH_TOKEN=${{ secrets.CUCUMBER_PUBLISH_TOKEN }}
export GPD_SUBKEY='${{ secrets.GPD_SUBKEY }}'

cd ./integration-test
chmod +x ./run_integration_test.sh
Expand Down
5 changes: 5 additions & 0 deletions .identity/00_data.tf
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ data "azurerm_key_vault_secret" "key_vault_integration_test_subkey" {
key_vault_id = data.azurerm_key_vault.key_vault.id
}

data "azurerm_key_vault_secret" "key_vault_gpd_api_key" {
name = "gpd-api-key"
key_vault_id = data.azurerm_key_vault.key_vault.id
}

data "azurerm_user_assigned_identity" "workload_identity_clientid" {
name = "ebollo-workload-identity"
resource_group_name = "pagopa-${var.env_short}-itn-${var.env}-aks-rg"
Expand Down
6 changes: 6 additions & 0 deletions .identity/01_github_environment.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ locals {
"TENANT_ID" : data.azurerm_client_config.current.tenant_id,
"SUBSCRIPTION_ID" : data.azurerm_subscription.current.subscription_id,
"SUBKEY" : data.azurerm_key_vault_secret.key_vault_integration_test_subkey.value,
"GPD_SUBKEY" : data.azurerm_key_vault_secret.key_vault_gpd_api_key.value

}
env_variables = {
"CONTAINER_APP_ENVIRONMENT_NAME" : local.container_app_environment.name,
Expand All @@ -48,6 +50,10 @@ locals {
"key" : "${upper(var.env)}_SUBKEY",
"value" : data.azurerm_key_vault_secret.key_vault_integration_test_subkey.value
},
"GPD_SUBKEY" : {
"key" : "${upper(var.env)}_GPD_SUBKEY",
"value" : data.azurerm_key_vault_secret.key_vault_gpd_api_key.value
},
}
}

Expand Down
4 changes: 2 additions & 2 deletions helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ apiVersion: v2
name: pagopa-mbd-service
description: Microservice that handles services for eBollo
type: application
version: 0.102.0
appVersion: 1.2.3
version: 0.104.0
appVersion: 1.2.3-2-PPANTT-196-feat-introducing-int-tests
dependencies:
- name: microservice-chart
version: 7.1.1
Expand Down
4 changes: 2 additions & 2 deletions helm/values-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ microservice-chart:
fullnameOverride: "pagopa-mbd-service"
image:
repository: ghcr.io/pagopa/pagopa-mbd-service
tag: "1.2.3"
tag: "1.2.3-2-PPANTT-196-feat-introducing-int-tests"
pullPolicy: Always
livenessProbe:
handlerType: httpGet
Expand Down Expand Up @@ -79,7 +79,7 @@ microservice-chart:
MBD_BASE_URL: 'https://api.dev.platform.pagopa.it/pagopa-mbd-service/v1'
MBD_ID_PSP: 'ABI50004'
MBD_ID_BROKER_PSP: '99999000011'
MBD_CHANNEL_ID: '99999000011_03'
MBD_CHANNEL_ID: '99999000011_02'
ENV: 'azure-dev'
CORS_CONFIGURATION: '{"origins": ["*"], "methods": ["*"]}'
OTEL_SERVICE_NAME: "pagopa-mbd-service"
Expand Down
2 changes: 1 addition & 1 deletion helm/values-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ microservice-chart:
fullnameOverride: "pagopa-mbd-service"
image:
repository: ghcr.io/pagopa/pagopa-mbd-service
tag: "1.2.3"
tag: "1.2.3-2-PPANTT-196-feat-introducing-int-tests"
pullPolicy: Always
livenessProbe:
handlerType: httpGet
Expand Down
2 changes: 1 addition & 1 deletion helm/values-uat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ microservice-chart:
fullnameOverride: "pagopa-mbd-service"
image:
repository: ghcr.io/pagopa/pagopa-mbd-service
tag: "1.2.3"
tag: "1.2.3-2-PPANTT-196-feat-introducing-int-tests"
pullPolicy: Always
livenessProbe:
handlerType: httpGet
Expand Down
1 change: 0 additions & 1 deletion infra/04_apim_api.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
locals {
apim_mbd = {
// GPD Payments Pull
display_name = "Marca da Bollo Digitale"
description = "API for eBollo 2.0"
path = "pagopa-mbd-service"
Expand Down
4 changes: 0 additions & 4 deletions integration-test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ To run the integration tests on docker, you can run from this directory the scri
sh ./run_integration_test.sh <local|dev|uat|prod> <sub-key>
```

ℹ️ _Note_: for **PagoPa ACR** is **required** the login `az acr login -n <acr-name>`

If you use dev, uat or prod **you test the images on Azure ACR**

---
💻 If you want to test your local branch,

Expand Down
Empty file modified integration-test/run_integration_test.sh
100644 → 100755
Empty file.
9 changes: 8 additions & 1 deletion integration-test/src/config/.env.dev
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
APP_HOST=https://host
SERVICE_URI=https://api.dev.platform.pagopa.it/pagopa-gps-mbd-service/v1
SUBKEY=<SUBKEY>

GPD_SERVICE_URI=https://api.dev.platform.pagopa.it/gpd/api/v1/
GPD_SUBKEY=<SUBKEY>

FISCAL_CODE_EC=99999000013
CORRECT_NAV=348173447377455101
11 changes: 10 additions & 1 deletion integration-test/src/config/.env.local
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
APP_HOST=http://localhost:8080
ENVIRONMENT=local

SERVICE_URI=https://api.dev.platform.pagopa.it/pagopa-mbd-service/v1
SUBKEY=<SUBKEY>

GPD_SERVICE_URI=https://api.dev.platform.pagopa.it/gpd/api/v1
GPD_SUBKEY=<GPD_SUBKEY>

FISCAL_CODE_EC=99999000013
CORRECT_NAV=348173447377455101
8 changes: 7 additions & 1 deletion integration-test/src/config/.env.prod
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
APP_HOST=https://host
SERVICE_URI=https://api.prod.platform.pagopa.it/receipts/service/v1/messages
SUBKEY=<SUBKEY>

GPD_SERVICE_URI=https://api.prod.platform.pagopa.it/gpd/debt-positions-service/v1/
GPD_SUBKEY=<SUBKEY>

FISCAL_CODE_EC=777777777
9 changes: 8 additions & 1 deletion integration-test/src/config/.env.uat
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
APP_HOST=https://host
SERVICE_URI=https://api.uat.platform.pagopa.it/receipts/service/v1/messages
SUBKEY=<SUBKEY>

GPD_SERVICE_URI=https://api.uat.platform.pagopa.it/gpd/debt-positions-service/v1/
GPD_SUBKEY=<SUBKEY>

FISCAL_CODE_EC=99999000013
CORRECT_NAV=348173447377455101
16 changes: 0 additions & 16 deletions integration-test/src/features/example.feature

This file was deleted.

29 changes: 29 additions & 0 deletions integration-test/src/features/mbd_service.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Feature: Get MBD

Scenario: Execute a request to getMDB service with invalid content
When an Http GET request is sent to the mdb-service getMDB with "missing_fiscal_code"
Then response has a 400 Http status

Scenario: Execute a request to getMDB service with invalid content
When an Http GET request is sent to the mdb-service getMDB with "wrong_hash_document"
Then response has a 400 Http status

Scenario: Execute a request to getMDB service with valid content
When an Http GET request is sent to the mdb-service getMDB with "valid_content"
Then response has a 200 Http status
And response body contains checkoutUrl
And response contains mdb link
And response contains mdb nav

Scenario: Execute a request to getMDB Receipt service with valid content
Given a receipt of the former MDB payment being payed
When an Http GET request is sent to the mdb-service getMDBReceipt with "correct"
Then response has a 200 Http status

Scenario: Execute a request to getMDBReceipt service with wrong data
When an Http GET request is sent to the mdb-service getMDBReceipt with "wrong_ec"
Then response has a 500 Http status

Scenario: Execute a request to getMDBReceipt service with wrong data
When an Http GET request is sent to the mdb-service getMDBReceipt with "wrong_nav"
Then response has a 500 Http status
8 changes: 6 additions & 2 deletions integration-test/src/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "your-project-name", // TODO: set your name
"name": "pagopa-receipt-pdf-service",
"license": "MIT",
"version": "1.0.0",
"version": "0.0.1",
"scripts": {
"test:local": "dotenv -e ./config/.env.local yarn cucumber",
"test:dev": "dotenv -e ./config/.env.dev yarn cucumber",
Expand All @@ -15,5 +15,9 @@
"dotenv": "^16.0.2",
"dotenv-cli": "^3.2.0",
"npx": "^10.2.2"
},
"devDependencies": {
"@azure/cosmos": "^3.17.3",
"@azure/storage-blob": "^12.15.0"
}
}
Loading
Loading