From 20fce96b677b15d441466f5e2639d0c2bd99198d Mon Sep 17 00:00:00 2001 From: acn-sbuad Date: Wed, 10 Jan 2024 12:04:41 +0100 Subject: [PATCH 1/3] fixed code smells from sonarcloud #GCPActive --- .../JsonSerializerOptionsProvider.cs | 21 +++++++++++++++++++ src/Altinn.Notifications.Core/Models/Email.cs | 10 +-------- .../Notification/SendOperationResult.cs | 21 ++++--------------- .../Models/Orders/NotificationOrder.cs | 18 ++-------------- .../Services/NotificationSummaryService.cs | 2 +- .../Mappers/OrderMapper.cs | 2 +- src/Altinn.Notifications/Program.cs | 6 ++---- .../OrdersController/GetByIdTests.cs | 4 ++-- .../OrdersController/GetBySendersRefTests.cs | 8 +++---- .../OrdersController/GetWithStatusById.cs | 6 +++--- .../JwtCookiePostConfigureOptionsStub.cs | 4 +--- .../Mocks/Authentication/JwtTokenMock.cs | 2 +- 12 files changed, 43 insertions(+), 61 deletions(-) create mode 100644 src/Altinn.Notifications.Core/JsonSerializerOptionsProvider.cs diff --git a/src/Altinn.Notifications.Core/JsonSerializerOptionsProvider.cs b/src/Altinn.Notifications.Core/JsonSerializerOptionsProvider.cs new file mode 100644 index 00000000..58146671 --- /dev/null +++ b/src/Altinn.Notifications.Core/JsonSerializerOptionsProvider.cs @@ -0,0 +1,21 @@ +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Altinn.Notifications.Core +{ + /// + /// Provider class for JsonSerializerOptions + /// + public static class JsonSerializerOptionsProvider + { + /// + /// Standard serializer options + /// + public static JsonSerializerOptions Options { get; } = new() + { + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, + PropertyNamingPolicy = JsonNamingPolicy.CamelCase, + Converters = { new JsonStringEnumConverter() } + }; + } +} diff --git a/src/Altinn.Notifications.Core/Models/Email.cs b/src/Altinn.Notifications.Core/Models/Email.cs index 4f86765d..dcab68d8 100644 --- a/src/Altinn.Notifications.Core/Models/Email.cs +++ b/src/Altinn.Notifications.Core/Models/Email.cs @@ -1,5 +1,4 @@ using System.Text.Json; -using System.Text.Json.Serialization; using Altinn.Notifications.Core.Enums; @@ -58,13 +57,6 @@ public Email(Guid notificationId, string subject, string body, string fromAddres /// public string Serialize() { - return JsonSerializer.Serialize( - this, - new JsonSerializerOptions - { - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, - PropertyNamingPolicy = JsonNamingPolicy.CamelCase, - Converters = { new JsonStringEnumConverter() } - }); + return JsonSerializer.Serialize(this, JsonSerializerOptionsProvider.Options); } } diff --git a/src/Altinn.Notifications.Core/Models/Notification/SendOperationResult.cs b/src/Altinn.Notifications.Core/Models/Notification/SendOperationResult.cs index 4ce4523d..8749d454 100644 --- a/src/Altinn.Notifications.Core/Models/Notification/SendOperationResult.cs +++ b/src/Altinn.Notifications.Core/Models/Notification/SendOperationResult.cs @@ -1,13 +1,12 @@ using System.Text.Json; -using System.Text.Json.Serialization; + using Altinn.Notifications.Core.Enums; -using Altinn.Notifications.Core.Models.Orders; namespace Altinn.Notifications.Core.Models.Notification; /// /// A class representing a send operation update object -/// +/// public class SendOperationResult { /// @@ -30,14 +29,7 @@ public class SendOperationResult /// public string Serialize() { - return JsonSerializer.Serialize( - this, - new JsonSerializerOptions - { - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, - PropertyNamingPolicy = JsonNamingPolicy.CamelCase, - Converters = { new JsonStringEnumConverter() } - }); + return JsonSerializer.Serialize(this, JsonSerializerOptionsProvider.Options); } /// @@ -46,12 +38,7 @@ public string Serialize() public static SendOperationResult? Deserialize(string serializedString) { return JsonSerializer.Deserialize( - serializedString, - new JsonSerializerOptions() - { - PropertyNameCaseInsensitive = true, - Converters = { new JsonStringEnumConverter() } - }); + serializedString, JsonSerializerOptionsProvider.Options); } /// diff --git a/src/Altinn.Notifications.Core/Models/Orders/NotificationOrder.cs b/src/Altinn.Notifications.Core/Models/Orders/NotificationOrder.cs index 13e91c2e..2c053e67 100644 --- a/src/Altinn.Notifications.Core/Models/Orders/NotificationOrder.cs +++ b/src/Altinn.Notifications.Core/Models/Orders/NotificationOrder.cs @@ -1,5 +1,4 @@ using System.Text.Json; -using System.Text.Json.Serialization; using Altinn.Notifications.Core.Enums; using Altinn.Notifications.Core.Models.NotificationTemplate; @@ -67,14 +66,7 @@ internal NotificationOrder() /// public string Serialize() { - return JsonSerializer.Serialize( - this, - new JsonSerializerOptions - { - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, - PropertyNamingPolicy = JsonNamingPolicy.CamelCase, - Converters = { new JsonStringEnumConverter() } - }); + return JsonSerializer.Serialize(this, JsonSerializerOptionsProvider.Options); } /// @@ -82,13 +74,7 @@ public string Serialize() /// public static NotificationOrder? Deserialize(string serializedString) { - return JsonSerializer.Deserialize( - serializedString, - new JsonSerializerOptions() - { - PropertyNameCaseInsensitive = true, - Converters = { new JsonStringEnumConverter() } - }); + return JsonSerializer.Deserialize(serializedString, JsonSerializerOptionsProvider.Options); } /// diff --git a/src/Altinn.Notifications.Core/Services/NotificationSummaryService.cs b/src/Altinn.Notifications.Core/Services/NotificationSummaryService.cs index e618ce0e..3ead7772 100644 --- a/src/Altinn.Notifications.Core/Services/NotificationSummaryService.cs +++ b/src/Altinn.Notifications.Core/Services/NotificationSummaryService.cs @@ -49,7 +49,7 @@ public NotificationSummaryService(INotificationSummaryRepository summaryReposito return (null, new ServiceError(404)); } - if (summary.Notifications.Any()) + if (summary.Notifications.Count != 0) { ProcessNotificationResults(summary); } diff --git a/src/Altinn.Notifications/Mappers/OrderMapper.cs b/src/Altinn.Notifications/Mappers/OrderMapper.cs index 266248ff..f964c0ec 100644 --- a/src/Altinn.Notifications/Mappers/OrderMapper.cs +++ b/src/Altinn.Notifications/Mappers/OrderMapper.cs @@ -84,7 +84,7 @@ public static NotificationOrderWithStatusExt MapToNotificationOrderWithStatusExt StatusDescription = order.ProcessingStatus.StatusDescription }; - if (order.NotificationStatuses.Any()) + if (order.NotificationStatuses.Count != 0) { orderExt.NotificationsStatusSummary = new(); foreach (var entry in order.NotificationStatuses) diff --git a/src/Altinn.Notifications/Program.cs b/src/Altinn.Notifications/Program.cs index 01ec9456..ba86ccee 100644 --- a/src/Altinn.Notifications/Program.cs +++ b/src/Altinn.Notifications/Program.cs @@ -187,13 +187,11 @@ void ConfigureServices(IServiceCollection services, IConfiguration config) void AddAuthorizationRulesAndHandlers(IServiceCollection services, IConfiguration config) { - services.AddAuthorization(options => - { - options.AddPolicy(AuthorizationConstants.POLICY_CREATE_SCOPE_OR_PLATFORM_ACCESS, policy => + services.AddAuthorizationBuilder() + .AddPolicy(AuthorizationConstants.POLICY_CREATE_SCOPE_OR_PLATFORM_ACCESS, policy => { policy.Requirements.Add(new CreateScopeOrAccessTokenRequirement(AuthorizationConstants.SCOPE_NOTIFICATIONS_CREATE)); }); - }); services.AddTransient(); diff --git a/test/Altinn.Notifications.IntegrationTests/Notifications/OrdersController/GetByIdTests.cs b/test/Altinn.Notifications.IntegrationTests/Notifications/OrdersController/GetByIdTests.cs index 3ae2159f..221acf47 100644 --- a/test/Altinn.Notifications.IntegrationTests/Notifications/OrdersController/GetByIdTests.cs +++ b/test/Altinn.Notifications.IntegrationTests/Notifications/OrdersController/GetByIdTests.cs @@ -1,9 +1,9 @@ using System.Net; using System.Net.Http.Headers; using System.Text.Json; -using System.Text.Json.Serialization; using Altinn.Common.AccessToken.Services; +using Altinn.Notifications.Core; using Altinn.Notifications.Core.Models.Orders; using Altinn.Notifications.IntegrationTests.Utils; using Altinn.Notifications.Mappers; @@ -93,7 +93,7 @@ public async Task GetById_SingleMatchInDb_ReturnsOk() // Act HttpResponseMessage response = await client.SendAsync(httpRequestMessage); string resString = await response.Content.ReadAsStringAsync(); - NotificationOrderExt? actual = JsonSerializer.Deserialize(resString, new JsonSerializerOptions { Converters = { new JsonStringEnumConverter() } }); + NotificationOrderExt? actual = JsonSerializer.Deserialize(resString, JsonSerializerOptionsProvider.Options); // Assert Assert.Equal(HttpStatusCode.OK, response.StatusCode); diff --git a/test/Altinn.Notifications.IntegrationTests/Notifications/OrdersController/GetBySendersRefTests.cs b/test/Altinn.Notifications.IntegrationTests/Notifications/OrdersController/GetBySendersRefTests.cs index 4079d504..5a46ac53 100644 --- a/test/Altinn.Notifications.IntegrationTests/Notifications/OrdersController/GetBySendersRefTests.cs +++ b/test/Altinn.Notifications.IntegrationTests/Notifications/OrdersController/GetBySendersRefTests.cs @@ -1,9 +1,9 @@ using System.Net; using System.Net.Http.Headers; using System.Text.Json; -using System.Text.Json.Serialization; using Altinn.Common.AccessToken.Services; +using Altinn.Notifications.Core; using Altinn.Notifications.Core.Models.Orders; using Altinn.Notifications.IntegrationTests.Utils; using Altinn.Notifications.Models; @@ -49,7 +49,7 @@ public async Task GetBySendersRef_NoMatchInDb_ReturnsOK_EmptyList() // Act HttpResponseMessage response = await client.SendAsync(httpRequestMessage); string resString = await response.Content.ReadAsStringAsync(); - NotificationOrderListExt actual = JsonSerializer.Deserialize(resString, new JsonSerializerOptions { Converters = { new JsonStringEnumConverter() } })!; + NotificationOrderListExt actual = JsonSerializer.Deserialize(resString, JsonSerializerOptionsProvider.Options)!; // Assert Assert.Equal(HttpStatusCode.OK, response.StatusCode); @@ -73,7 +73,7 @@ public async Task GetBySendersRef_SingleMatchInDb_ReturnsOk_SingleElementInlList // Act HttpResponseMessage response = await client.SendAsync(httpRequestMessage); string resString = await response.Content.ReadAsStringAsync(); - NotificationOrderListExt actual = JsonSerializer.Deserialize(resString, new JsonSerializerOptions { Converters = { new JsonStringEnumConverter() } })!; + NotificationOrderListExt actual = JsonSerializer.Deserialize(resString, JsonSerializerOptionsProvider.Options)!; // Assert Assert.Equal(HttpStatusCode.OK, response.StatusCode); @@ -100,7 +100,7 @@ public async Task GetBySendersRef_MultipleMatchInDb_ReturnsOk_MultipleElementInl // Act HttpResponseMessage response = await client.SendAsync(httpRequestMessage); string resString = await response.Content.ReadAsStringAsync(); - NotificationOrderListExt actual = JsonSerializer.Deserialize(resString, new JsonSerializerOptions { Converters = { new JsonStringEnumConverter() } })!; + NotificationOrderListExt actual = JsonSerializer.Deserialize(resString, JsonSerializerOptionsProvider.Options)!; // Assert Assert.Equal(HttpStatusCode.OK, response.StatusCode); diff --git a/test/Altinn.Notifications.IntegrationTests/Notifications/OrdersController/GetWithStatusById.cs b/test/Altinn.Notifications.IntegrationTests/Notifications/OrdersController/GetWithStatusById.cs index 45fbe880..a105fb39 100644 --- a/test/Altinn.Notifications.IntegrationTests/Notifications/OrdersController/GetWithStatusById.cs +++ b/test/Altinn.Notifications.IntegrationTests/Notifications/OrdersController/GetWithStatusById.cs @@ -1,9 +1,9 @@ using System.Net; using System.Net.Http.Headers; using System.Text.Json; -using System.Text.Json.Serialization; using Altinn.Common.AccessToken.Services; +using Altinn.Notifications.Core; using Altinn.Notifications.Core.Models.Orders; using Altinn.Notifications.IntegrationTests.Utils; using Altinn.Notifications.Models; @@ -98,7 +98,7 @@ public async Task GetWithStatusById_SingleMatchInDbAndOneEmail_ReturnsOk() // Act HttpResponseMessage response = await client.SendAsync(httpRequestMessage); string resString = await response.Content.ReadAsStringAsync(); - NotificationOrderWithStatusExt? actual = JsonSerializer.Deserialize(resString, new JsonSerializerOptions { Converters = { new JsonStringEnumConverter() } }); + NotificationOrderWithStatusExt? actual = JsonSerializer.Deserialize(resString, JsonSerializerOptionsProvider.Options); // Assert Assert.Equal(HttpStatusCode.OK, response.StatusCode); @@ -137,7 +137,7 @@ public async Task GetWithStatusById_SingleMatchInDb_ReturnsOk() // Act HttpResponseMessage response = await client.SendAsync(httpRequestMessage); string resString = await response.Content.ReadAsStringAsync(); - NotificationOrderWithStatusExt? actual = JsonSerializer.Deserialize(resString, new JsonSerializerOptions { Converters = { new JsonStringEnumConverter() } }); + NotificationOrderWithStatusExt? actual = JsonSerializer.Deserialize(resString, JsonSerializerOptionsProvider.Options); // Assert Assert.Equal(HttpStatusCode.OK, response.StatusCode); diff --git a/test/Altinn.Notifications.Tests/Notifications/Mocks/Authentication/JwtCookiePostConfigureOptionsStub.cs b/test/Altinn.Notifications.Tests/Notifications/Mocks/Authentication/JwtCookiePostConfigureOptionsStub.cs index 2fe01f6d..f81f4e0b 100644 --- a/test/Altinn.Notifications.Tests/Notifications/Mocks/Authentication/JwtCookiePostConfigureOptionsStub.cs +++ b/test/Altinn.Notifications.Tests/Notifications/Mocks/Authentication/JwtCookiePostConfigureOptionsStub.cs @@ -1,5 +1,3 @@ -using System; - using AltinnCore.Authentication.JwtCookie; using Microsoft.AspNetCore.Authentication.Cookies; @@ -22,7 +20,7 @@ public void PostConfigure(string? name, JwtCookieOptions options) options.CookieManager ??= new ChunkingCookieManager(); - if (!string.IsNullOrEmpty(options.MetadataAddress) && !options.MetadataAddress.EndsWith("/", StringComparison.Ordinal)) + if (!string.IsNullOrEmpty(options.MetadataAddress) && !options.MetadataAddress.EndsWith('/')) { options.MetadataAddress += "/"; } diff --git a/test/Altinn.Notifications.Tests/Notifications/Mocks/Authentication/JwtTokenMock.cs b/test/Altinn.Notifications.Tests/Notifications/Mocks/Authentication/JwtTokenMock.cs index e181c04f..10f55706 100644 --- a/test/Altinn.Notifications.Tests/Notifications/Mocks/Authentication/JwtTokenMock.cs +++ b/test/Altinn.Notifications.Tests/Notifications/Mocks/Authentication/JwtTokenMock.cs @@ -35,7 +35,7 @@ public static string GenerateToken(ClaimsPrincipal principal, TimeSpan tokenExip return tokenstring; } - private static SigningCredentials GetSigningCredentials(string issuer) + private static X509SigningCredentials GetSigningCredentials(string issuer) { string certPath = "jwtselfsignedcert.pfx"; if (!issuer.Equals("UnitTest")) From e1be02b99df4169753c729eb4190da6d0df33d1e Mon Sep 17 00:00:00 2001 From: acn-sbuad Date: Wed, 10 Jan 2024 12:24:29 +0100 Subject: [PATCH 2/3] new notation for exclusions from analysis --- .github/workflows/build-and-analyze.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-analyze.yml b/.github/workflows/build-and-analyze.yml index 783426e8..c69e1e0a 100644 --- a/.github/workflows/build-and-analyze.yml +++ b/.github/workflows/build-and-analyze.yml @@ -63,7 +63,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} run: | - dotnet-sonarscanner begin /k:"Altinn_altinn-notifications" /o:"altinn" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="**/coverage.opencover.xml" /d:sonar.cpd.exclusions="src/Altinn.Notifications.Persistence/Migration/**/*.sql" /d:sonar.coverage.exclusions="src/Altinn.Notifications.Persistence/Migration/" + dotnet-sonarscanner begin /k:"Altinn_altinn-notifications" /o:"altinn" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="**/coverage.opencover.xml" /d:sonar.exclusions="src/Altinn.Notifications.Persistence/Migration/**/*" dotnet build Altinn.Notifications.sln -v q From 2e955c39295cecc5b2fd6f279c4f791ce944208d Mon Sep 17 00:00:00 2001 From: acn-sbuad Date: Mon, 15 Jan 2024 14:03:37 +0100 Subject: [PATCH 3/3] no docker in k6 task + regression workflow --- .github/workflows/regression-test-ATX.yaml | 40 +++++++++++++++++++++ .github/workflows/regression-test-PROD.yaml | 36 +++++++++++++++++++ .github/workflows/regression-test-TT02.yaml | 36 +++++++++++++++++++ .github/workflows/use-case-ATX.yaml | 7 ++-- .github/workflows/use-case-PROD.yaml | 7 ++-- .github/workflows/use-case-TT02.yaml | 7 ++-- 6 files changed, 124 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/regression-test-ATX.yaml create mode 100644 .github/workflows/regression-test-PROD.yaml create mode 100644 .github/workflows/regression-test-TT02.yaml diff --git a/.github/workflows/regression-test-ATX.yaml b/.github/workflows/regression-test-ATX.yaml new file mode 100644 index 00000000..992e8a05 --- /dev/null +++ b/.github/workflows/regression-test-ATX.yaml @@ -0,0 +1,40 @@ +name: Regression test - AT + +on: + workflow_dispatch: + schedule: + - cron: '0 12 * * 1-5' + +jobs: + test: + strategy: + fail-fast: false + matrix: + environment: [AT21, AT22, AT23, AT24] + environment: ${{ matrix.environment }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Run email notification order regression tests + uses: grafana/k6-action@v0.3.1 + with: + filename: test/k6/src/tests/orders_email.js + flags: -e runFullTestSet=true -e env=${{ vars.ENV }} -e tokenGeneratorUserName=${{ secrets.TOKENGENERATOR_USERNAME }} -e tokenGeneratorUserPwd=${{ secrets.TOKENGENERATOR_USERPASSWORD }} -e emailRecipient=${{ secrets.AUTOMATEDTEST_EMAILRECIPIENT }} + - name: Build failure report + if: failure() + run: | + report=":warning: Notifications regression test failure in ${{ matrix.environment }} :warning: \n" + report+="\n Workflow available here: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" + echo "stepreport="$report >> $GITHUB_ENV + - name: Report failure to Slack + if: failure() + id: slack + uses: slackapi/slack-github-action@v1.24.0 + with: + payload: | + { + "text": "${{ env.stepreport }}" + } + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_TEST }} + diff --git a/.github/workflows/regression-test-PROD.yaml b/.github/workflows/regression-test-PROD.yaml new file mode 100644 index 00000000..54c78914 --- /dev/null +++ b/.github/workflows/regression-test-PROD.yaml @@ -0,0 +1,36 @@ +name: Regression test - PROD + +on: + workflow_dispatch: + schedule: + - cron: '0 12 * * 1-5' + +jobs: + test: + environment: Prod + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Run email notification order regression tests + uses: grafana/k6-action@v0.3.1 + with: + filename: test/k6/src/tests/orders_email.js + flags: -e runFullTestSet=true k6 run /src/tests/orders_email.js -e env=${{ vars.ENV }} -e emailRecipient=${{ secrets.AUTOMATEDTEST_EMAILRECIPIENT }} -e mpClientId=${{ secrets.MP_CLIENT_ID }} -e mpKid=${{ secrets.MP_KID }} -e encodedJwk=${{ secrets.MP_ENCODEDJWK }} + - name: Build failure report + if: failure() + run: | + report=":warning: Notifications regression test failure in ${{ vars.ENV }} :warning: \n" + report+="\n Workflow available here: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" + echo "stepreport="$report >> $GITHUB_ENV + - name: Report failure to Slack + if: failure() + id: slack + uses: slackapi/slack-github-action@v1.24.0 + with: + payload: | + { + "text": "${{ env.stepreport }}" + } + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_PROD }} + diff --git a/.github/workflows/regression-test-TT02.yaml b/.github/workflows/regression-test-TT02.yaml new file mode 100644 index 00000000..86b98873 --- /dev/null +++ b/.github/workflows/regression-test-TT02.yaml @@ -0,0 +1,36 @@ +name: Regression test - TT02 + +on: + workflow_dispatch: + schedule: + - cron: '0 12 * * 1-5' + +jobs: + test: + environment: TT02 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Run email notification order regression tests + uses: grafana/k6-action@v0.3.1 + with: + filename: test/k6/src/tests/orders_email.js + flags: -e runFullTestSet=true -e env=${{ vars.ENV }} -e emailRecipient=${{ secrets.AUTOMATEDTEST_EMAILRECIPIENT }} -e mpClientId=${{ secrets.MP_CLIENT_ID }} -e mpKid=${{ secrets.MP_KID }} -e encodedJwk=${{ secrets.MP_ENCODEDJWK }} + - name: Build failure report + if: failure() + run: | + report=":warning: Notifications regression test failure in ${{ vars.ENV }} :warning: \n" + report+="\n Workflow available here: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" + echo "stepreport="$report >> $GITHUB_ENV + - name: Report failure to Slack + if: failure() + id: slack + uses: slackapi/slack-github-action@v1.24.0 + with: + payload: | + { + "text": "${{ env.stepreport }}" + } + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_PROD }} + diff --git a/.github/workflows/use-case-ATX.yaml b/.github/workflows/use-case-ATX.yaml index e3f4f98e..44191b09 100644 --- a/.github/workflows/use-case-ATX.yaml +++ b/.github/workflows/use-case-ATX.yaml @@ -16,9 +16,10 @@ jobs: steps: - uses: actions/checkout@v4 - name: Run email notification order use case tests - run: | - cd test/k6 - docker-compose run k6 run /src/tests/orders_email.js -e env=${{ vars.ENV }} -e tokenGeneratorUserName=${{ secrets.TOKENGENERATOR_USERNAME }} -e tokenGeneratorUserPwd=${{ secrets.TOKENGENERATOR_USERPASSWORD }} -e emailRecipient=${{ secrets.AUTOMATEDTEST_EMAILRECIPIENT }} + uses: grafana/k6-action@v0.3.1 + with: + filename: test/k6/src/tests/orders_email.js + flags: -e env=${{ vars.ENV }} -e tokenGeneratorUserName=${{ secrets.TOKENGENERATOR_USERNAME }} -e tokenGeneratorUserPwd=${{ secrets.TOKENGENERATOR_USERPASSWORD }} -e emailRecipient=${{ secrets.AUTOMATEDTEST_EMAILRECIPIENT }} - name: Build failure report if: failure() run: | diff --git a/.github/workflows/use-case-PROD.yaml b/.github/workflows/use-case-PROD.yaml index 35760fbd..9ed0886e 100644 --- a/.github/workflows/use-case-PROD.yaml +++ b/.github/workflows/use-case-PROD.yaml @@ -12,9 +12,10 @@ jobs: steps: - uses: actions/checkout@v4 - name: Run email notification order use case tests - run: | - cd test/k6 - docker-compose run k6 run /src/tests/orders_email.js -e env=${{ vars.ENV }} -e emailRecipient=${{ secrets.AUTOMATEDTEST_EMAILRECIPIENT }} -e mpClientId=${{ secrets.MP_CLIENT_ID }} -e mpKid=${{ secrets.MP_KID }} -e encodedJwk=${{ secrets.MP_ENCODEDJWK }} + uses: grafana/k6-action@v0.3.1 + with: + filename: test/k6/src/tests/orders_email.js + flags: k6 run /src/tests/orders_email.js -e env=${{ vars.ENV }} -e emailRecipient=${{ secrets.AUTOMATEDTEST_EMAILRECIPIENT }} -e mpClientId=${{ secrets.MP_CLIENT_ID }} -e mpKid=${{ secrets.MP_KID }} -e encodedJwk=${{ secrets.MP_ENCODEDJWK }} - name: Build failure report if: failure() run: | diff --git a/.github/workflows/use-case-TT02.yaml b/.github/workflows/use-case-TT02.yaml index 394c7464..51d963e1 100644 --- a/.github/workflows/use-case-TT02.yaml +++ b/.github/workflows/use-case-TT02.yaml @@ -12,9 +12,10 @@ jobs: steps: - uses: actions/checkout@v4 - name: Run email notification order use case tests - run: | - cd test/k6 - docker-compose run k6 run /src/tests/orders_email.js -e env=${{ vars.ENV }} -e emailRecipient=${{ secrets.AUTOMATEDTEST_EMAILRECIPIENT }} -e mpClientId=${{ secrets.MP_CLIENT_ID }} -e mpKid=${{ secrets.MP_KID }} -e encodedJwk=${{ secrets.MP_ENCODEDJWK }} + uses: grafana/k6-action@v0.3.1 + with: + filename: test/k6/src/tests/orders_email.js + flags: -e env=${{ vars.ENV }} -e emailRecipient=${{ secrets.AUTOMATEDTEST_EMAILRECIPIENT }} -e mpClientId=${{ secrets.MP_CLIENT_ID }} -e mpKid=${{ secrets.MP_KID }} -e encodedJwk=${{ secrets.MP_ENCODEDJWK }} - name: Build failure report if: failure() run: |