Skip to content

Commit

Permalink
Merge branch 'main' into chore/sql-script-generator-for-yt01
Browse files Browse the repository at this point in the history
  • Loading branch information
oskogstad authored Jan 14, 2025
2 parents dd8c484 + 8f5ce91 commit 65335a9
Show file tree
Hide file tree
Showing 36 changed files with 582 additions and 260 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/ci-cd-yt01.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,6 @@ jobs:
secrets:
TOKEN_GENERATOR_USERNAME: ${{ secrets.TOKEN_GENERATOR_USERNAME }}
TOKEN_GENERATOR_PASSWORD: ${{ secrets.TOKEN_GENERATOR_PASSWORD }}
K6_CLOUD_TOKEN: ${{ secrets.K6_CLOUD_TOKEN }}
K6_CLOUD_PROJECT_ID: ${{ secrets.K6_CLOUD_PROJECT_ID }}

strategy:
max-parallel: 1
matrix:
Expand All @@ -150,8 +147,6 @@ jobs:
apiVersion: v1
vus: 1
duration: 30s
tokens: both
numberOfTokens: 100
testSuitePath: ${{ matrix.files }}
permissions:
checks: write
Expand Down
14 changes: 1 addition & 13 deletions .github/workflows/dispatch-k6-performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,6 @@ on:
- test
- staging
- yt01
tokens:
description: 'Tokens to generate; for create dialog, search, none, or both'
required: true
default: 'both'
type: choice
options:
- both
- enterprise
- personal
- none
tag:
description: 'tag the performance test'
required: true
Expand All @@ -52,6 +42,7 @@ on:
- 'tests/k6/tests/serviceowner/performance/serviceowner-search.js'
- 'tests/k6/tests/enduser/performance/enduser-search.js'
- 'tests/k6/tests/graphql/performance/graphql-search.js'
- 'tests/k6/tests/serviceowner/performance/create-transmissions.js'

run-name: ${{ inputs.tag }} vus ${{ inputs.vus }} duration ${{ inputs.duration }}
jobs:
Expand All @@ -61,13 +52,10 @@ jobs:
secrets:
TOKEN_GENERATOR_USERNAME: ${{ secrets.TOKEN_GENERATOR_USERNAME }}
TOKEN_GENERATOR_PASSWORD: ${{ secrets.TOKEN_GENERATOR_PASSWORD }}
K6_CLOUD_TOKEN: ${{ secrets.K6_CLOUD_TOKEN }}
K6_CLOUD_PROJECT_ID: ${{ secrets.K6_CLOUD_PROJECT_ID }}
with:
environment: ${{ inputs.environment }}
apiVersion: ${{ inputs.apiVersion }}
testSuitePath: ${{ inputs.testSuitePath }}
vus: ${{ fromJson(inputs.vus) }}
duration: ${{ inputs.duration }}
tokens: ${{ inputs.tokens }}

19 changes: 0 additions & 19 deletions .github/workflows/workflow-run-k6-performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,11 @@ on:
duration:
required: true
type: string
tokens:
required: true
type: string
numberOfTokens:
required: false
type: number
default: 0
ttl:
required: false
type: number
default: 3600
secrets:
TOKEN_GENERATOR_USERNAME:
required: true
TOKEN_GENERATOR_PASSWORD:
required: true
K6_CLOUD_TOKEN:
required: true
K6_CLOUD_PROJECT_ID:
required: true

jobs:
k6-test:
runs-on: ubuntu-latest
Expand All @@ -53,7 +37,6 @@ jobs:
uses: grafana/setup-k6-action@v1
- name: Run K6 tests (${{ inputs.testSuitePath }})
run: |
./tests/k6/tests/scripts/generate_tokens.sh ./tests/k6/tests/performancetest_data ${{ inputs.tokens }} ${{ inputs.numberOfTokens }} ${{ inputs.ttl }}
echo "Running k6 test suite ${{ inputs.testSuitePath }} with ${{ inputs.vus }} VUs for ${{ inputs.duration }}"
k6 run ${{ inputs.testSuitePath }} --quiet --log-output=stdout --include-system-env-vars \
--vus=${{ inputs.vus }} --duration=${{ inputs.duration }} --out csv=./results.csv
Expand All @@ -63,5 +46,3 @@ jobs:
API_VERSION: ${{ inputs.apiVersion }}
TOKEN_GENERATOR_USERNAME: ${{ secrets.TOKEN_GENERATOR_USERNAME }}
TOKEN_GENERATOR_PASSWORD: ${{ secrets.TOKEN_GENERATOR_PASSWORD }}
K6_CLOUD_TOKEN: ${{ secrets.K6_CLOUD_TOKEN }}
K6_CLOUD_PROJECT_ID: ${{ secrets.K6_CLOUD_PROJECT_ID }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ dotnet ef migrations add TestMigration

Besides ordinary unit and integration tests, there are test suites for both functional and non-functional end-to-end tests implemented with [K6](https://k6.io/).

See `tests/k6/README.md` for more information.
See [tests/k6/README.md](tests/k6/README.md) for more information.

## Health Checks

Expand Down
20 changes: 16 additions & 4 deletions docs/schema/V1/schema.verified.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -304,20 +304,32 @@ input SetSystemLabelInput {
}

enum ActivityType {
"Refers to a dialog that has been created."
"Indicates that a dialog has been created."
DIALOG_CREATED
"Refers to a dialog that has been closed."
"Indicates that a dialog has been closed."
DIALOG_CLOSED
"Information from the service provider, not (directly) related to any transmission."
INFORMATION
"Refers to a transmission that has been opened."
"Indicates that a transmission has been opened."
TRANSMISSION_OPENED
"Indicates that payment has been made."
PAYMENT_MADE
"Indicates that a signature has been provided."
SIGNATURE_PROVIDED
"Refers to a dialog that has been opened."
"Indicates that a dialog has been opened."
DIALOG_OPENED
"Indicates that a dialog has been deleted."
DIALOG_DELETED
"Indicates that a dialog has been restored."
DIALOG_RESTORED
"Indicates that a dialog has been sent to signing."
SENT_TO_SIGNING
"Indicates that a dialog has been sent to form fill."
SENT_TO_FORM_FILL
"Indicates that a dialog has been sent to send in."
SENT_TO_SEND_IN
"Indicates that a dialog has been sent to payment."
SENT_TO_PAYMENT
}

enum ActorType {
Expand Down
28 changes: 24 additions & 4 deletions docs/schema/V1/swagger.verified.json
Original file line number Diff line number Diff line change
Expand Up @@ -2094,6 +2094,13 @@
},
"nullable": true,
"type": "array"
},
"id": {
"description": "A self-defined UUIDv7 may be provided to support idempotent creation of Api Actions. If not provided, a new UUIDv7 will be generated.",
"example": "01913cd5-784f-7d3b-abef-4c77b1f0972d",
"format": "guid",
"nullable": true,
"type": "string"
}
},
"type": "object"
Expand Down Expand Up @@ -2161,6 +2168,12 @@
"nullable": true,
"type": "array"
},
"id": {
"description": "A self-defined UUIDv7 may be provided to support idempotent creation of attachments. If not provided, a new UUIDv7 will be generated.",
"format": "guid",
"nullable": true,
"type": "string"
},
"urls": {
"description": "The URLs associated with the attachment, each referring to a different representation of the attachment.",
"items": {
Expand Down Expand Up @@ -2432,6 +2445,13 @@
}
]
},
"id": {
"description": "A self-defined UUIDv7 may be provided to support idempotent creation of Gui Actions. If not provided, a new UUIDv7 will be generated.",
"example": "01913cd5-784f-7d3b-abef-4c77b1f0972d",
"format": "guid",
"nullable": true,
"type": "string"
},
"isDeleteDialogAction": {
"description": "Indicates whether the action results in the dialog being deleted. Used by frontends to implement custom UX\nfor delete actions.",
"type": "boolean"
Expand Down Expand Up @@ -2710,7 +2730,7 @@
"type": "array"
},
"id": {
"description": "A UUIDv7 used for merging existing data, unknown IDs will be ignored as this entity does not support user-defined IDs.",
"description": "A self-defined UUIDv7 may be provided to support idempotent additions of Api Actions. If not provided, a new UUIDv7 will be generated.",
"example": "01913cd5-784f-7d3b-abef-4c77b1f0972d",
"format": "guid",
"nullable": true,
Expand Down Expand Up @@ -2790,7 +2810,7 @@
"type": "array"
},
"id": {
"description": "A UUIDv7 used for merging existing data, unknown IDs will be ignored as this entity does not support user-defined IDs.",
"description": "A self-defined UUIDv7 may be provided to support idempotent additions of attachments. If not provided, a new UUIDv7 will be generated.",
"example": "01913cd5-784f-7d3b-abef-4c77b1f0972d",
"format": "guid",
"nullable": true,
Expand Down Expand Up @@ -3027,7 +3047,7 @@
]
},
"id": {
"description": "A UUIDv7 used for merging existing data, unknown IDs will be ignored as this entity does not support user-defined IDs.",
"description": "A self-defined UUIDv7 may be provided to support idempotent additions of Gui Actions. If not provided, a new UUIDv7 will be generated.",
"example": "01913cd5-784f-7d3b-abef-4c77b1f0972d",
"format": "guid",
"nullable": true,
Expand Down Expand Up @@ -3160,7 +3180,7 @@
"type": "array"
},
"id": {
"description": "A self-defined UUIDv7 may be provided to support idempotent creation of transmission attachments. If not provided, a new UUIDv7 will be generated.",
"description": "A self-defined UUIDv7 may be provided to support idempotent additions of transmission attachments. If not provided, a new UUIDv7 will be generated.",
"example": "01913cd5-784f-7d3b-abef-4c77b1f0972d",
"format": "guid",
"nullable": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Digdir.Domain.Dialogporten.Domain.Actors;
using Digdir.Domain.Dialogporten.Domain.Common;
using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities;
using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Actions;
using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Activities;
using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions;
using Digdir.Domain.Dialogporten.Domain.Parties;
Expand All @@ -20,7 +21,6 @@
namespace Digdir.Domain.Dialogporten.Application.Features.V1.ServiceOwner.Dialogs.Commands.Create;

public sealed class CreateDialogCommand : CreateDialogDto, IRequest<CreateDialogResult>;

public sealed record CreateDialogSuccess(Guid DialogId, Guid Revision);

[GenerateOneOf]
Expand Down Expand Up @@ -145,5 +145,23 @@ private async Task EnsureNoExistingUserDefinedIds(DialogEntity dialog, Cancellat
{
_domainContext.AddError(DomainFailure.EntityExists<DialogTransmissionAttachment>(existingTransmissionAttachmentIds));
}

var existingAttachmentIds = await _db.GetExistingIds(dialog.Attachments, cancellationToken);
if (existingAttachmentIds.Count != 0)
{
_domainContext.AddError(DomainFailure.EntityExists<DialogAttachment>(existingAttachmentIds));
}

var existingGuiActionIds = await _db.GetExistingIds(dialog.GuiActions, cancellationToken);
if (existingGuiActionIds.Count != 0)
{
_domainContext.AddError(DomainFailure.EntityExists<DialogGuiAction>(existingGuiActionIds));
}

var existingApiActionIds = await _db.GetExistingIds(dialog.ApiActions, cancellationToken);
if (existingApiActionIds.Count != 0)
{
_domainContext.AddError(DomainFailure.EntityExists<DialogApiAction>(existingApiActionIds));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,9 @@ public CreateDialogDialogAttachmentDtoValidator(
IValidator<IEnumerable<LocalizationDto>> localizationsValidator,
IValidator<AttachmentUrlDto> urlValidator)
{
RuleFor(x => x.Id)
.IsValidUuidV7()
.UuidV7TimestampIsInPast();
RuleFor(x => x.DisplayName)
.SetValidator(localizationsValidator);
RuleFor(x => x.Urls)
Expand Down Expand Up @@ -336,6 +339,9 @@ internal sealed class CreateDialogDialogGuiActionDtoValidator : AbstractValidato
public CreateDialogDialogGuiActionDtoValidator(
IValidator<IEnumerable<LocalizationDto>> localizationsValidator)
{
RuleFor(x => x.Id)
.IsValidUuidV7()
.UuidV7TimestampIsInPast();
RuleFor(x => x.Action)
.NotEmpty()
.MaximumLength(Constants.DefaultMaxStringLength);
Expand Down Expand Up @@ -365,6 +371,9 @@ internal sealed class CreateDialogDialogApiActionDtoValidator : AbstractValidato
public CreateDialogDialogApiActionDtoValidator(
IValidator<ApiActionEndpointDto> apiActionEndpointValidator)
{
RuleFor(x => x.Id)
.IsValidUuidV7()
.UuidV7TimestampIsInPast();
RuleFor(x => x.Action)
.NotEmpty()
.MaximumLength(Constants.DefaultMaxStringLength);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,12 @@ public sealed class ActivityDto

public sealed class ApiActionDto
{
/// <summary>
/// A self-defined UUIDv7 may be provided to support idempotent creation of Api Actions. If not provided, a new UUIDv7 will be generated.
/// </summary>
/// <example>01913cd5-784f-7d3b-abef-4c77b1f0972d</example>
public Guid? Id { get; set; }

/// <summary>
/// String identifier for the action, corresponding to the "action" attributeId used in the XACML service policy,
/// which by default is the policy belonging to the service referred to by "serviceResource" in the dialog.
Expand Down Expand Up @@ -393,6 +399,12 @@ public sealed class ApiActionEndpointDto

public sealed class GuiActionDto
{
/// <summary>
/// A self-defined UUIDv7 may be provided to support idempotent creation of Gui Actions. If not provided, a new UUIDv7 will be generated.
/// </summary>
/// <example>01913cd5-784f-7d3b-abef-4c77b1f0972d</example>
public Guid? Id { get; set; }

/// <summary>
/// The action identifier for the action, corresponding to the "action" attributeId used in the XACML service policy.
/// </summary>
Expand Down Expand Up @@ -455,6 +467,11 @@ public sealed class GuiActionDto

public sealed class AttachmentDto
{
/// <summary>
/// A self-defined UUIDv7 may be provided to support idempotent creation of attachments. If not provided, a new UUIDv7 will be generated.
/// </summary>
public Guid? Id { get; set; }

/// <summary>
/// The display name of the attachment that should be used in GUIs.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ public class ActivityDto
public sealed class ApiActionDto
{
/// <summary>
/// A UUIDv7 used for merging existing data, unknown IDs will be ignored as this entity does not support user-defined IDs.
/// A self-defined UUIDv7 may be provided to support idempotent additions of Api Actions. If not provided, a new UUIDv7 will be generated.
/// </summary>
/// <example>01913cd5-784f-7d3b-abef-4c77b1f0972d</example>
public Guid? Id { get; set; }
Expand Down Expand Up @@ -353,7 +353,7 @@ public sealed class ApiActionEndpointDto
public sealed class GuiActionDto
{
/// <summary>
/// A UUIDv7 used for merging existing data, unknown IDs will be ignored as this entity does not support user-defined IDs.
/// A self-defined UUIDv7 may be provided to support idempotent additions of Gui Actions. If not provided, a new UUIDv7 will be generated.
/// </summary>
/// <example>01913cd5-784f-7d3b-abef-4c77b1f0972d</example>
public Guid? Id { get; set; }
Expand Down Expand Up @@ -421,7 +421,7 @@ public sealed class GuiActionDto
public sealed class AttachmentDto
{
/// <summary>
/// A UUIDv7 used for merging existing data, unknown IDs will be ignored as this entity does not support user-defined IDs.
/// A self-defined UUIDv7 may be provided to support idempotent additions of attachments. If not provided, a new UUIDv7 will be generated.
/// </summary>
/// <example>01913cd5-784f-7d3b-abef-4c77b1f0972d</example>
public Guid? Id { get; set; }
Expand Down Expand Up @@ -468,7 +468,7 @@ public sealed class AttachmentUrlDto
public sealed class TransmissionAttachmentDto
{
/// <summary>
/// A self-defined UUIDv7 may be provided to support idempotent creation of transmission attachments. If not provided, a new UUIDv7 will be generated.
/// A self-defined UUIDv7 may be provided to support idempotent additions of transmission attachments. If not provided, a new UUIDv7 will be generated.
/// </summary>
/// <example>01913cd5-784f-7d3b-abef-4c77b1f0972d</example>
public Guid? Id { get; set; }
Expand Down
Loading

0 comments on commit 65335a9

Please sign in to comment.