Skip to content

Commit

Permalink
[PAGOPA-2066] fix(utility): Update extractMetadataAsString (#36)
Browse files Browse the repository at this point in the history
* [PAGOPA-2066] fix: Add key suffix when GenericPair is 1

* Bump to version 0.2.7-1-PAGOPA-2066 [skip ci]

* Bump to version 0.2.7-2-PAGOPA-2066 [skip ci]

* [PAGOPA-2066] fix deploy_with_github_runner.yml

---------

Co-authored-by: pagopa-github-bot <[email protected]>
  • Loading branch information
cap-ang and pagopa-github-bot authored Sep 2, 2024
1 parent 25bbf9f commit 4f8a13b
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy_with_github_runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
container_app_environment_name: ${{ vars.CONTAINER_APP_ENVIRONMENT_NAME }}
resource_group_name: ${{ vars.CONTAINER_APP_ENVIRONMENT_RESOURCE_GROUP_NAME }} # RG of the runner
pat_token: ${{ secrets.BOT_TOKEN_GITHUB }}

self_hosted_runner_image_tag: "latest"
deploy:
needs: [ create_runner ]
runs-on: [ self-hosted, "${{ needs.create_runner.outputs.runner_name }}" ]
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-shared-platform-authorizer
description: Microservice handling authorization caching for the Authorizer system
type: application
version: 0.110.0
appVersion: 0.2.8
version: 0.111.0
appVersion: 0.2.7-2-PAGOPA-2066
dependencies:
- name: microservice-chart
version: 2.8.0
Expand Down
2 changes: 1 addition & 1 deletion helm/values-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ microservice-chart:
fullnameOverride: ""
image:
repository: ghcr.io/pagopa/pagopa-platform-authorizer
tag: "0.2.8"
tag: "0.2.7-2-PAGOPA-2066"
pullPolicy: Always
# https://github.com/Azure/azure-functions-host/blob/dev/src/WebJobs.Script.WebHost/Controllers/HostController.cs
livenessProbe:
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: ""
image:
repository: ghcr.io/pagopa/pagopa-platform-authorizer
tag: "0.2.8"
tag: "0.2.7-2-PAGOPA-2066"
pullPolicy: Always
# https://github.com/Azure/azure-functions-host/blob/dev/src/WebJobs.Script.WebHost/Controllers/HostController.cs
livenessProbe:
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: ""
image:
repository: ghcr.io/pagopa/pagopa-platform-authorizer
tag: "0.2.8"
tag: "0.2.7-2-PAGOPA-2066"
pullPolicy: Always
# https://github.com/Azure/azure-functions-host/blob/dev/src/WebJobs.Script.WebHost/Controllers/HostController.cs
livenessProbe:
Expand Down
2 changes: 1 addition & 1 deletion openapi/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"openapi": "3.0.1",
"info": {
"title": "OpenAPI definition - Enrolled EC",
"version": "0.2.8"
"version": "0.2.7-2-PAGOPA-2066"
},
"servers": [
{
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>it.gov.pagopa.authorizer</groupId>
<artifactId>platform-authorizer</artifactId>
<version>0.2.8</version>
<version>0.2.7-2-PAGOPA-2066</version>
<packaging>jar</packaging>

<name>Azure Authorizer cache Fn</name>
Expand Down
1 change: 1 addition & 0 deletions src/main/java/it/gov/pagopa/authorizer/util/Utility.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public static String extractMetadataAsString(@NonNull List<Metadata> metadata) {
List<GenericPair> content = singleMetadata.getContent();
if (content.size() == 1) {
GenericPair metadataPair = content.get(0);
builder.append(metadataPair.getKey()).append(":");
builder.append(getMetadataValueAsString(metadataPair));
} else {
Iterator<GenericPair> it = content.iterator();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ class CacheServiceTest {
@SneakyThrows
@ParameterizedTest
@CsvSource(delimiterString = "/", value = {
"0/{\"key\":\"domain_1\",\"value\":\"entity1#entity2#entity3\",\"metadata\":\"_o=pagoPA;;\"}",
"1/{\"key\":\"domain_1\",\"value\":\"entity1#entity2|sub-entity\",\"metadata\":\"_o=pagoPA;;\"}",
"0/{\"key\":\"domain_1\",\"value\":\"entity1#entity2#entity3\",\"metadata\":\"_o=not-visible-key:pagoPA;;\"}",
"1/{\"key\":\"domain_1\",\"value\":\"entity1#entity2|sub-entity\",\"metadata\":\"_o=not-visible-key:pagoPA;;\"}",
"3/{\"key\":\"domain_1\",\"value\":\"entity1#entity2#entity3\",\"metadata\":\"\"}"
})
void addAuthConfigurationToAPIMAuthorizer_OK(int id, String subkeyDomainAsString) {

// Mocking passed values
SubscriptionKeyDomain subkeyDomain = getSubscriptionKeyDomains().get(id);
//String subkeyDomainAsString = "{\"key\":\"domain_1\",\"value\":\"entity1#entity2#entity3\",\"metadata\":\"_o=pagoPA;;\"}";
//String subkeyDomainAsString = "{\"key\":\"domain_1\",\"value\":\"entity1#entity2#entity3\",\"metadata\":\"_o=not-visible-key:pagoPA;;\"}";
MockHttpResponse mockedHttpResponse = MockHttpResponse.builder().statusCode(200).uri(new URI("")).build();

// Mocking execution for service's internal component
Expand All @@ -76,7 +76,7 @@ void addAuthConfigurationToAPIMAuthorizer_OK_noAuthorizationEntities() {
// Mocking passed values
SubscriptionKeyDomain subkeyDomain = getSubscriptionKeyDomains().get(0);
subkeyDomain.setAuthorizedEntities(List.of());
String subkeyDomainAsString = "{\"key\":\"domain_1\",\"value\":\"\",\"metadata\":\"_o=pagoPA;;\"}";
String subkeyDomainAsString = "{\"key\":\"domain_1\",\"value\":\"\",\"metadata\":\"_o=not-visible-key:pagoPA;;\"}";
MockHttpResponse mockedHttpResponse = MockHttpResponse.builder().statusCode(200).uri(new URI("")).build();

// Mocking execution for service's internal component
Expand All @@ -98,7 +98,7 @@ void addAuthConfigurationToAPIMAuthorizer_KO_communicationError() {

// Mocking passed values
SubscriptionKeyDomain subkeyDomain = getSubscriptionKeyDomains().get(0);
String subkeyDomainAsString = "{\"key\":\"domain_1\",\"value\":\"entity1#entity2#entity3\",\"metadata\":\"_o=pagoPA;;\"}";
String subkeyDomainAsString = "{\"key\":\"domain_1\",\"value\":\"entity1#entity2#entity3\",\"metadata\":\"_o=not-visible-key:pagoPA;;\"}";

// Mocking execution for service's internal component
HttpClient realHttpClient = spy(HttpClient.newHttpClient());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void convertListToString_KO_nullParameter() {

@Test
void extractMetadataAsString_OK() {
String expectedResult = "_md1=single-value;;_md2=value1,value2;;_md3=multiple-object-1:single-value;multiple-object-2:value1,value2;;";
String expectedResult = "_md1=single-object:single-value;;_md2=single-object-with-multiple-values:value1,value2;;_md3=multiple-object-1:single-value;multiple-object-2:value1,value2;;";
String result = Utility.extractMetadataAsString(getMetadataList());
assertEquals(expectedResult, result);
}
Expand Down

0 comments on commit 4f8a13b

Please sign in to comment.