Merge pull request #76 from meysamhadeli/feat/add-test-pipline

feat: Add Test pipeline to ci-cd
This commit is contained in:
Meysam Hadeli 2023-01-12 01:34:32 +03:30 committed by GitHub
commit c4a9f95279
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 431 additions and 419 deletions

View File

@ -1,14 +1,14 @@
version: 2
updates:
- package-ecosystem: nuget
directory: '/'
schedule:
interval: monthly
reviewers:
- meysamhadeli
assignees:
- meysamhadeli
ignore:
- dependency-name: '*'
versions:
version: 2
updates:
- package-ecosystem: nuget
directory: '/'
schedule:
interval: monthly
reviewers:
- meysamhadeli
assignees:
- meysamhadeli
ignore:
- dependency-name: '*'
versions:
- '>= 0'

View File

@ -1,39 +1,39 @@
<!-- Type of change
Please label this PR with one of the existing labels, depending on the scope of your change.
-->
## What does this PR do?
<!-- Mandatory
Explain here the changes you made on the PR. Please explain the WHAT: patterns used, algorithms implemented, design architecture, etc.
-->
## Why is it important?
<!-- Mandatory
Explain here the WHY, or the rationale / motivation for the changes.
-->
## Related issues
<!-- Recommended
Link related issues below. Insert the issue link or reference after the word "Closes" if merging this should automatically close it.
- Closes #123
- Relates #123
- Requires #123
- Supersedes #123
-->
-
<!-- Recommended
## How to test this PR
Explain here how this PR will be tested by the reviewer: commands, dependencies, steps, etc.
-->
<!-- Optional
## Follow-ups
Add here any thought that you consider could be identified as an actionable step once this PR is merged.
<!-- Type of change
Please label this PR with one of the existing labels, depending on the scope of your change.
-->
## What does this PR do?
<!-- Mandatory
Explain here the changes you made on the PR. Please explain the WHAT: patterns used, algorithms implemented, design architecture, etc.
-->
## Why is it important?
<!-- Mandatory
Explain here the WHY, or the rationale / motivation for the changes.
-->
## Related issues
<!-- Recommended
Link related issues below. Insert the issue link or reference after the word "Closes" if merging this should automatically close it.
- Closes #123
- Relates #123
- Requires #123
- Supersedes #123
-->
-
<!-- Recommended
## How to test this PR
Explain here how this PR will be tested by the reviewer: commands, dependencies, steps, etc.
-->
<!-- Optional
## Follow-ups
Add here any thought that you consider could be identified as an actionable step once this PR is merged.
-->

View File

@ -1,99 +1,99 @@
# https://johanneskonings.dev/github/2021/02/28/github_automatic_releases_and-changelog/
# https://tiagomichaelsousa.dev/articles/stop-writing-your-changelogs-manually
# https://github.com/release-drafter/release-drafter/issues/551
# https://github.com/release-drafter/release-drafter/pull/1013
# https://github.com/release-drafter/release-drafter/issues/139
# https://github.com/atk4/data/blob/develop/.github/release-drafter.yml
# This release drafter follows the conventions from https://keepachangelog.com, https://common-changelog.org/
# https://www.conventionalcommits.org
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
template: |
## What Changed 👀
$CHANGES
**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION
categories:
- title: 🚀 Features
labels:
- feature
- title: 🐛 Bug Fixes
labels:
- fix
- bug
- title: ♻️ Changes
labels:
- changed
- enhancement
- refactor
- title: ⛔️ Deprecated
labels:
- deprecated
- title: 🗑 Removed
labels:
- removed
- title: 🔐 Security
labels:
- security
- title: 📄 Documentation
labels:
- docs
- documentation
- title: 🧩 Dependency Updates
labels:
- deps
- dependencies
- title: 🧰 Maintenance
label: 'chore'
- title: 🧺 Miscellaneous #Everything except ABAP
label: misc
- title: 📝 Other changes
## putting no labels pr to `Other Changes` category with no label - https://github.com/release-drafter/release-drafter/issues/139#issuecomment-480473934
# https://www.trywilco.com/post/wilco-ci-cd-github-heroku
# https://github.com/release-drafter/release-drafter#autolabeler
# https://github.com/fuxingloh/multi-labeler
# Using regex for defining rules - https://regexr.com/ - https://regex101.com/
autolabeler:
- label: 'chore'
branch:
- '/(chore)\/.*/'
title:
- '/^chore: .*/'
- label: 'docs'
branch:
- '/(docs)\/.*/'
title:
- '/^docs: .*/'
- label: 'bug'
branch:
- '/(fix)\/.*/'
title:
- '/^fix: .*/'
- label: 'feature'
branch:
- '/(feat)\/.*/'
title:
- '/^feat: .*/'
body:
- '/JIRA-[0-9]{1,4}/'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
version-resolver:
major:
labels:
- major
minor:
labels:
- minor
patch:
labels:
- patch
default: patch
exclude-labels:
- skip-changelog
# https://johanneskonings.dev/github/2021/02/28/github_automatic_releases_and-changelog/
# https://tiagomichaelsousa.dev/articles/stop-writing-your-changelogs-manually
# https://github.com/release-drafter/release-drafter/issues/551
# https://github.com/release-drafter/release-drafter/pull/1013
# https://github.com/release-drafter/release-drafter/issues/139
# https://github.com/atk4/data/blob/develop/.github/release-drafter.yml
# This release drafter follows the conventions from https://keepachangelog.com, https://common-changelog.org/
# https://www.conventionalcommits.org
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
template: |
## What Changed 👀
$CHANGES
**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION
categories:
- title: 🚀 Features
labels:
- feature
- title: 🐛 Bug Fixes
labels:
- fix
- bug
- title: ♻️ Changes
labels:
- changed
- enhancement
- refactor
- title: ⛔️ Deprecated
labels:
- deprecated
- title: 🗑 Removed
labels:
- removed
- title: 🔐 Security
labels:
- security
- title: 📄 Documentation
labels:
- docs
- documentation
- title: 🧩 Dependency Updates
labels:
- deps
- dependencies
- title: 🧰 Maintenance
label: 'chore'
- title: 🧺 Miscellaneous #Everything except ABAP
label: misc
- title: 📝 Other changes
## putting no labels pr to `Other Changes` category with no label - https://github.com/release-drafter/release-drafter/issues/139#issuecomment-480473934
# https://www.trywilco.com/post/wilco-ci-cd-github-heroku
# https://github.com/release-drafter/release-drafter#autolabeler
# https://github.com/fuxingloh/multi-labeler
# Using regex for defining rules - https://regexr.com/ - https://regex101.com/
autolabeler:
- label: 'chore'
branch:
- '/(chore)\/.*/'
title:
- '/^chore: .*/'
- label: 'docs'
branch:
- '/(docs)\/.*/'
title:
- '/^docs: .*/'
- label: 'bug'
branch:
- '/(fix)\/.*/'
title:
- '/^fix: .*/'
- label: 'feature'
branch:
- '/(feat)\/.*/'
title:
- '/^feat: .*/'
body:
- '/JIRA-[0-9]{1,4}/'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
version-resolver:
major:
labels:
- major
minor:
labels:
- minor
patch:
labels:
- patch
default: patch
exclude-labels:
- skip-changelog

94
.github/release.yml vendored
View File

@ -1,47 +1,47 @@
# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes
# https://github.com/bcoe/conventional-release-labels
# https://dev.to/github/how-to-automatically-generate-release-notes-for-your-project-2ng8
# https://www.conventionalcommits.org/en/v1.0.0/
# github release pre-defined template
changelog:
exclude:
labels:
- ignore-for-release
categories:
- title: 🚀 Features
labels:
- feature
- title: 🐛 Bug Fixes
labels:
- fix
- bug
- title: ♻️ Changes
labels:
- changed
- enhancement
- refactor
- title: ⛔️ Deprecated
labels:
- deprecated
- title: 🗑 Removed
labels:
- removed
- title: 🔐 Security
labels:
- security
- title: 📄 Documentation
labels:
- docs
- documentation
- title: 🧩 Dependency Updates
labels:
- deps
- dependencies
- title: 🧰 Maintenance
label: 'chore'
- title: 🧺 Miscellaneous #Everything except ABAP
label: misc
- title: Other Changes
labels:
- "*"
# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes
# https://github.com/bcoe/conventional-release-labels
# https://dev.to/github/how-to-automatically-generate-release-notes-for-your-project-2ng8
# https://www.conventionalcommits.org/en/v1.0.0/
# github release pre-defined template
changelog:
exclude:
labels:
- ignore-for-release
categories:
- title: 🚀 Features
labels:
- feature
- title: 🐛 Bug Fixes
labels:
- fix
- bug
- title: ♻️ Changes
labels:
- changed
- enhancement
- refactor
- title: ⛔️ Deprecated
labels:
- deprecated
- title: 🗑 Removed
labels:
- removed
- title: 🔐 Security
labels:
- security
- title: 📄 Documentation
labels:
- docs
- documentation
- title: 🧩 Dependency Updates
labels:
- deps
- dependencies
- title: 🧰 Maintenance
label: 'chore'
- title: 🧺 Miscellaneous #Everything except ABAP
label: misc
- title: Other Changes
labels:
- "*"

View File

@ -1,33 +1,33 @@
# https://github.com/amannn/action-semantic-pull-request
# https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/configuring-commit-squashing-for-pull-requests
name: Conventional Commits Checks
on:
workflow_run:
workflows: ["Release Drafter Auto Labeler"]
types:
- completed
#concurrency:
# group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
# cancel-in-progress: true
jobs:
check-conventional-commits-labels:
name: Check conventional commits labels
runs-on: [ self-hosted ]
steps:
- uses: danielchabr/pr-labels-checker@v3.1
with:
hasSome: feature,fix,changed,deprecated,removed,security,docs,dependencies
githubToken: ${{ secrets.GITHUB_TOKEN }}
validate-pull-request-title:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# https://github.com/amannn/action-semantic-pull-request
# https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/configuring-commit-squashing-for-pull-requests
name: Conventional Commits Checks
on:
workflow_run:
workflows: ["Release Drafter Auto Labeler"]
types:
- completed
#concurrency:
# group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
# cancel-in-progress: true
jobs:
check-conventional-commits-labels:
name: Check conventional commits labels
runs-on: [ self-hosted ]
steps:
- uses: danielchabr/pr-labels-checker@v3.1
with:
hasSome: feature,fix,changed,deprecated,removed,security,docs,dependencies
githubToken: ${{ secrets.GITHUB_TOKEN }}
validate-pull-request-title:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -1,38 +1,38 @@
name: CodeQL
on:
push:
branches: [ develop, main ]
pull_request:
branches: [ develop, main ]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.sha }}
cancel-in-progress: true
jobs:
analyze:
strategy:
fail-fast: false
matrix:
language: [ csharp ]
permissions:
security-events: write
runs-on: ubuntu-22.04
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
- name: Autobuild
uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
name: CodeQL
on:
push:
branches: [ develop, main ]
pull_request:
branches: [ develop, main ]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.sha }}
cancel-in-progress: true
jobs:
analyze:
strategy:
fail-fast: false
matrix:
language: [ csharp ]
permissions:
security-events: write
runs-on: ubuntu-22.04
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
- name: Autobuild
uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2

View File

@ -1,21 +1,21 @@
name: Release Drafter Auto Labeler
on:
pull_request:
types:
- opened
- synchronize
- reopened
- labeled
- unlabeled
jobs:
auto-labeler:
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v5
with:
config-name: release-drafter.yml
disable-releaser: true # only run auto-labeler for PRs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
name: Release Drafter Auto Labeler
on:
pull_request:
types:
- opened
- synchronize
- reopened
- labeled
- unlabeled
jobs:
auto-labeler:
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v5
with:
config-name: release-drafter.yml
disable-releaser: true # only run auto-labeler for PRs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -1,20 +1,20 @@
# https://johanneskonings.dev/github/2021/02/28/github_automatic_releases_and-changelog/
# https://tiagomichaelsousa.dev/articles/stop-writing-your-changelogs-manually
name: Release Drafter
on:
push:
branches:
- develop
- main
jobs:
update_release_draft:
name: Release drafter
runs-on: ubuntu-latest
steps:
- name: Update Release Draft
uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# https://johanneskonings.dev/github/2021/02/28/github_automatic_releases_and-changelog/
# https://tiagomichaelsousa.dev/articles/stop-writing-your-changelogs-manually
name: Release Drafter
on:
push:
branches:
- develop
- main
jobs:
update_release_draft:
name: Release drafter
runs-on: ubuntu-latest
steps:
- name: Update Release Draft
uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -1,30 +1,30 @@
on:
release:
types:
- released
push:
branches:
- main
# Every push to main will create a new release and deploy to production.
jobs:
update:
name: Update Changelog
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Update Changelog
uses: stefanzweifel/changelog-updater-action@v1
with:
latest-version: ${{ github.event.release.name }}
release-notes: ${{ github.event.release.body }}
- name: Commit updated Changelog
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: main
commit_message: 'docs(changelog): update changelog'
file_pattern: CHANGELOG.md
on:
release:
types:
- released
push:
branches:
- main
# Every push to main will create a new release and deploy to production.
jobs:
update:
name: Update Changelog
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Update Changelog
uses: stefanzweifel/changelog-updater-action@v1
with:
latest-version: ${{ github.event.release.name }}
release-notes: ${{ github.event.release.body }}
- name: Commit updated Changelog
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: main
commit_message: 'docs(changelog): update changelog'
file_pattern: CHANGELOG.md

View File

@ -236,13 +236,13 @@ services:
- EVENTSTORE_CLUSTER_SIZE=1
- EVENTSTORE_RUN_PROJECTIONS=All
- EVENTSTORE_START_STANDARD_PROJECTIONS=true
- EVENTSTORE_EXT_TCP_PORT=1010
- EVENTSTORE_EXT_TCP_PORT=1113
- EVENTSTORE_EXT_HTTP_PORT=2113
- EVENTSTORE_INSECURE=true
- EVENTSTORE_ENABLE_EXTERNAL_TCP=true
- EVENTSTORE_ENABLE_ATOM_PUB_OVER_HTTP=true
ports:
- '1010:1113'
- '1113:1113'
- '2113:2113'
networks:
- booking

View File

@ -76,13 +76,13 @@ services:
- EVENTSTORE_CLUSTER_SIZE=1
- EVENTSTORE_RUN_PROJECTIONS=All
- EVENTSTORE_START_STANDARD_PROJECTIONS=true
- EVENTSTORE_EXT_TCP_PORT=1010
- EVENTSTORE_EXT_TCP_PORT=1113
- EVENTSTORE_EXT_HTTP_PORT=2113
- EVENTSTORE_INSECURE=true
- EVENTSTORE_ENABLE_EXTERNAL_TCP=true
- EVENTSTORE_ENABLE_ATOM_PUB_OVER_HTTP=true
ports:
- '1010:1113'
- '1113:1113'
- '2113:2113'
networks:
- booking

View File

@ -7,6 +7,9 @@
"LogTemplate": "{Timestamp:HH:mm:ss} [{Level:u4}] {Message:lj}{NewLine}{Exception}",
"ElasticUri": "http://localhost:9200"
},
"HealthOptions": {
"Enabled": false
},
"Yarp": {
"routes": {
"identity": {

View File

@ -1,3 +1,4 @@
using Booking;
using Booking.Extensions.Infrastructure;
using BuildingBlocks.Web;
@ -11,7 +12,7 @@ builder.Host.UseDefaultServiceProvider((context, options) =>
options.ValidateOnBuild = true;
});
builder.AddMinimalEndpoints();
builder.AddMinimalEndpoints(assemblies:typeof(BookingRoot).Assembly);
builder.AddInfrastructure();
var app = builder.Build();
@ -19,6 +20,8 @@ var app = builder.Build();
app.MapMinimalEndpoints();
app.UseAuthentication();
app.UseAuthorization();
app.UseRouting();
app.UseHttpsRedirection();
app.UseInfrastructure();
app.Run();

View File

@ -99,10 +99,8 @@ public static class InfrastructureExtensions
options.EnrichDiagnosticContext = LogEnrichHelper.EnrichFromRequest;
});
app.UseCorrelationId();
app.UseRouting();
app.UseHttpMetrics();
app.UseMigration<PersistMessageDbContext>(env);
app.UseHttpsRedirection();
app.UseCustomHealthCheck();
app.MapMetrics();
app.MapGet("/", x => x.Response.WriteAsync(appOptions.Name));

View File

@ -19,72 +19,74 @@ using Passenger;
using Xunit;
using GetByIdRequest = Flight.GetByIdRequest;
namespace Integration.Test.Booking.Features;
public class CreateBookingTests : BookingIntegrationTestBase
namespace Integration.Test.Booking.Features
{
public CreateBookingTests(TestReadFixture<Program, BookingReadDbContext> integrationTestFixture) : base(
integrationTestFixture)
{
}
protected override void RegisterTestsServices(IServiceCollection services)
{
MockFlightGrpcServices(services);
MockPassengerGrpcServices(services);
}
// todo: add support test for event-store
[Fact]
public async Task should_create_booking_to_event_store_currectly()
{
// Arrange
var command = new FakeCreateBookingCommand().Generate();
// Act
var response = await Fixture.SendAsync(command);
// Assert
response.Should().BeGreaterOrEqualTo(0);
(await Fixture.WaitForPublishing<BookingCreated>()).Should().Be(true);
}
private void MockPassengerGrpcServices(IServiceCollection services)
{
services.Replace(ServiceDescriptor.Singleton(x =>
{
var mockPassenger = Substitute.For<PassengerGrpcService.PassengerGrpcServiceClient>();
mockPassenger.GetByIdAsync(Arg.Any<Passenger.GetByIdRequest>())
.Returns(TestCalls.AsyncUnaryCall(Task.FromResult(new FakePassengerResponse().Generate()),
Task.FromResult(new Metadata()), () => Status.DefaultSuccess, () => new Metadata(), () => { }));
return mockPassenger;
}));
}
private void MockFlightGrpcServices(IServiceCollection services)
{
services.Replace(ServiceDescriptor.Singleton(x =>
{
var mockFlight = Substitute.For<FlightGrpcService.FlightGrpcServiceClient>();
mockFlight.GetByIdAsync(Arg.Any<GetByIdRequest>())
.Returns(TestCalls.AsyncUnaryCall(Task.FromResult(new FakeFlightResponse().Generate()),
Task.FromResult(new Metadata()), () => Status.DefaultSuccess, () => new Metadata(), () => { }));
mockFlight.GetAvailableSeatsAsync(Arg.Any<GetAvailableSeatsRequest>())
.Returns(TestCalls.AsyncUnaryCall(Task.FromResult(FakeSeatsResponse.Generate()),
Task.FromResult(new Metadata()), () => Status.DefaultSuccess, () => new Metadata(), () => { }));
mockFlight.ReserveSeatAsync(Arg.Any<ReserveSeatRequest>())
.Returns(TestCalls.AsyncUnaryCall(Task.FromResult(FakeSeatsResponse.Generate()?.Items?.First()),
Task.FromResult(new Metadata()), () => Status.DefaultSuccess, () => new Metadata(), () => { }));
return mockFlight;
}));
}
// todo: uncomment after event-store test-container is published.
// public class CreateBookingTests : BookingIntegrationTestBase
// {
// public CreateBookingTests(TestReadFixture<Program, BookingReadDbContext> integrationTestFixture) : base(
// integrationTestFixture)
// {
// }
//
// protected override void RegisterTestsServices(IServiceCollection services)
// {
// MockFlightGrpcServices(services);
// MockPassengerGrpcServices(services);
// }
//
// // todo: add support test for event-store
// [Fact]
// public async Task should_create_booking_to_event_store_currectly()
// {
// // Arrange
// var command = new FakeCreateBookingCommand().Generate();
//
// // Act
//
// var response = await Fixture.SendAsync(command);
//
// // Assert
// response.Should().BeGreaterOrEqualTo(0);
//
// (await Fixture.WaitForPublishing<BookingCreated>()).Should().Be(true);
// }
//
//
// private void MockPassengerGrpcServices(IServiceCollection services)
// {
// services.Replace(ServiceDescriptor.Singleton(x =>
// {
// var mockPassenger = Substitute.For<PassengerGrpcService.PassengerGrpcServiceClient>();
//
// mockPassenger.GetByIdAsync(Arg.Any<Passenger.GetByIdRequest>())
// .Returns(TestCalls.AsyncUnaryCall(Task.FromResult(new FakePassengerResponse().Generate()),
// Task.FromResult(new Metadata()), () => Status.DefaultSuccess, () => new Metadata(), () => { }));
//
// return mockPassenger;
// }));
// }
//
// private void MockFlightGrpcServices(IServiceCollection services)
// {
// services.Replace(ServiceDescriptor.Singleton(x =>
// {
// var mockFlight = Substitute.For<FlightGrpcService.FlightGrpcServiceClient>();
//
// mockFlight.GetByIdAsync(Arg.Any<GetByIdRequest>())
// .Returns(TestCalls.AsyncUnaryCall(Task.FromResult(new FakeFlightResponse().Generate()),
// Task.FromResult(new Metadata()), () => Status.DefaultSuccess, () => new Metadata(), () => { }));
//
// mockFlight.GetAvailableSeatsAsync(Arg.Any<GetAvailableSeatsRequest>())
// .Returns(TestCalls.AsyncUnaryCall(Task.FromResult(FakeSeatsResponse.Generate()),
// Task.FromResult(new Metadata()), () => Status.DefaultSuccess, () => new Metadata(), () => { }));
//
// mockFlight.ReserveSeatAsync(Arg.Any<ReserveSeatRequest>())
// .Returns(TestCalls.AsyncUnaryCall(Task.FromResult(FakeSeatsResponse.Generate()?.Items?.First()),
// Task.FromResult(new Metadata()), () => Status.DefaultSuccess, () => new Metadata(), () => { }));
//
// return mockFlight;
// }));
// }
// }
}

View File

@ -1,4 +1,5 @@
using BuildingBlocks.Web;
using Flight;
using Flight.Extensions.Infrastructure;
var builder = WebApplication.CreateBuilder(args);
@ -11,7 +12,7 @@ builder.Host.UseDefaultServiceProvider((context, options) =>
options.ValidateOnBuild = true;
});
builder.AddMinimalEndpoints();
builder.AddMinimalEndpoints(assemblies:typeof(FlightRoot).Assembly);
builder.AddInfrastructure();
var app = builder.Build();
@ -20,6 +21,8 @@ var app = builder.Build();
app.MapMinimalEndpoints();
app.UseAuthentication();
app.UseAuthorization();
app.UseRouting();
app.UseHttpsRedirection();
app.UseInfrastructure();
app.Run();

View File

@ -108,7 +108,6 @@ public static class InfrastructureExtensions
app.UseCorrelationId();
app.UseHttpMetrics();
app.UseMigration<FlightDbContext>(env);
app.UseHttpsRedirection();
app.MapMetrics();
app.UseCustomHealthCheck();
app.MapGrpcService<FlightGrpcServices>();

View File

@ -1,4 +1,5 @@
using BuildingBlocks.Web;
using Identity;
using Identity.Extensions.Infrastructure;
var builder = WebApplication.CreateBuilder(args);
@ -11,7 +12,7 @@ builder.Host.UseDefaultServiceProvider((context, options) =>
options.ValidateOnBuild = true;
});
builder.AddMinimalEndpoints();
builder.AddMinimalEndpoints(assemblies:typeof(IdentityRoot).Assembly);
builder.AddInfrastructure();
var app = builder.Build();
@ -19,6 +20,8 @@ var app = builder.Build();
app.MapMinimalEndpoints();
app.UseAuthentication();
app.UseAuthorization();
app.UseRouting();
app.UseHttpsRedirection();
app.UseInfrastructure();
app.Run();

View File

@ -93,7 +93,6 @@ public static class InfrastructureExtensions
app.UseCorrelationId();
app.UseHttpMetrics();
app.UseProblemDetails();
app.UseHttpsRedirection();
app.UseCustomHealthCheck();
app.UseIdentityServer();
app.MapMetrics();

View File

@ -1,4 +1,5 @@
using BuildingBlocks.Web;
using Passenger;
using Passenger.Extensions.Infrastructure;
var builder = WebApplication.CreateBuilder(args);
@ -11,7 +12,7 @@ builder.Host.UseDefaultServiceProvider((context, options) =>
options.ValidateOnBuild = true;
});
builder.AddMinimalEndpoints();
builder.AddMinimalEndpoints(assemblies:typeof(PassengerRoot).Assembly);
builder.AddInfrastructure();
var app = builder.Build();
@ -19,6 +20,8 @@ var app = builder.Build();
app.MapMinimalEndpoints();
app.UseAuthentication();
app.UseAuthorization();
app.UseRouting();
app.UseHttpsRedirection();
app.UseInfrastructure();
app.Run();

View File

@ -99,7 +99,6 @@ public static class InfrastructureExtensions
app.UseMigration<PassengerDbContext>(env);
app.UseCorrelationId();
app.UseHttpMetrics();
app.UseHttpsRedirection();
app.UseCustomHealthCheck();
app.MapMetrics();
app.MapGrpcService<PassengerGrpcServices>();