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

Merge 'ThreeMammals:develop' into 'master' #1

Closed
wants to merge 148 commits into from

Conversation

raman-m
Copy link

@raman-m raman-m commented Feb 12, 2024

Please update your fork!
Or you can re-fork the head repo removing this one which is outdated.

raman-m and others added 20 commits November 21, 2023 20:05
Sync 'develop' to 'release/net8' (hotfix process)
…ngs.json (#1745)

* changing string parameter for IOcelotLogger function to Func<string>, modifying asp dot net logger, only one main method and verifying if LogLevel is enabled. If log level isn't enabled, then return.

    pick 847dac7 changing string parameter for IOcelotLogger function to Func<string>, modifying asp dot net logger, only one main method and verifying if LogLevel is enabled. If log level isn't enabled, then return.
    pick d7a8397 adding back the logger methods with string as parameter, avoiding calling the factory when plain string are used.
    pick d413201 simplify method calls

* adding back the logger methods with string as parameter, avoiding calling the factory when plain string are used.

* simplify method calls

* adding unit test case, If minimum log level not set then no logs are written

* adding logging benchmark

* code cleanup in steps and naming issues fixes

   pick c4f6dc9 adding loglevel acceptance tests, verifying that the logs are returned according to the minimum log level set in appsettings
   pick 478f139 enhanced unit tests, verifying 1) that the log method is only called when log level enabled 2) that the string function is only invoked when log level enabled

* adding loglevel acceptance tests, verifying that the logs are returned according to the minimum log level set in appsettings

* enhanced unit tests, verifying 1) that the log method is only called when log level enabled 2) that the string function is only invoked when log level enabled

* weird issue with the merge.

* adding comment

* Update src/Ocelot/ServiceDiscovery/ServiceDiscoveryProviderFactory.cs

Co-authored-by: Raman Maksimchuk <[email protected]>

* Update src/Ocelot/Claims/Middleware/ClaimsToClaimsMiddleware.cs

Co-authored-by: Raman Maksimchuk <[email protected]>

* Update src/Ocelot/Configuration/Repository/FileConfigurationPoller.cs

Co-authored-by: Raman Maksimchuk <[email protected]>

* Update src/Ocelot/DownstreamRouteFinder/Finder/DownstreamRouteProviderFactory.cs

Co-authored-by: Raman Maksimchuk <[email protected]>

* Update src/Ocelot/Logging/AspDotNetLogger.cs

Co-authored-by: Raman Maksimchuk <[email protected]>

* Update test/Ocelot.AcceptanceTests/LogLevelTests.cs

Co-authored-by: Raman Maksimchuk <[email protected]>

* Update src/Ocelot/Configuration/Repository/FileConfigurationPoller.cs

Co-authored-by: Raman Maksimchuk <[email protected]>

* As mentioned, using OcelotLogger instead of AspDotNeLogger as default logger name

* Some code refactoring and usage of factories in LogLevelTests

* Update src/Ocelot/Claims/Middleware/ClaimsToClaimsMiddleware.cs

Co-authored-by: Raman Maksimchuk <[email protected]>

* using overrided method WriteLog for strings, some changes as requested,

* code changes after review 2

    pick ad0e060 Update test/Ocelot.UnitTests/Middleware/OcelotPiplineBuilderTests.cs

* checking test cases

* adding ms logger benchmarks with console provider. Unfortunately, benchmark.net doesn't support "quiet" mode yet.

* 2 small adjustments

* Adding multi targets support for serilog

* Fix warnings

* Review new logger

* Fix unit tests

* The last change but not least

* Update logging.rst: Add draft

* Update logging.rst: Add RequestId section

* Update logging.rst: "Best Practices" section

* Update logging.rst: "Top Logging Performance?" subsection

* Update logging.rst: Rewrite "Request ID" section

* Update requestid.rst: Review and up to date

* Update logging.rst: "Run Benchmarks" section

---------

Co-authored-by: Raman Maksimchuk <[email protected]>
* #1783 More accurate logs for circuit breakers (and other "polly" exceptions)
Remove try/catch in PollyPoliciesDelegatingHandler and add a more generic AddPolly<T> to be able to use a specific PollyQoSProvider

* fix should_be_invalid_re_route_using_downstream_http_version UT

* fix remarks on PR

* arrange code

* fix UT

* merge with release/net8 branch

* switch benchmark to Net8

* Fix warnings

* Final review

---------

Co-authored-by: Ray <[email protected]>
Co-authored-by: raman-m <[email protected]>
* Revert #1172

* Remove Header

* Take actual version of caching.rst and remove Header info
Sync 'develop' to 'release/22.0'
* fix #1833, Default timeout(90s) of downstream requests is broken

* Fix test Should_log_warning_if_downstream_service_returns_internal_server_error

* Add unit tests

* Recover mixed line endings. Add docs

* Unit tests for HttpClientBuilder

* Add issue info

* Acceptance test

* Just formatting

---------

Co-authored-by: alvin huang <[email protected]>
Co-authored-by: Raman Maksimchuk <[email protected]>
Sync 'develop' to 'release/22.0'
* Changes related to test case of issue 649

* #649 test cases

---------

Co-authored-by: Raman Maksimchuk <[email protected]>
* using ArrayPool<byte> instead of memorystream CopyToAsync

* Maybe this could be a solution. It should be checked. Adding StreamHttpContent (yarp)

* little bit of cleanup here

* Avoiding ToLower() in IsSupportedHeader, using StringComparer.OrdinalIgnoreCase

* for smaller payloads, avoid allocating a buffer that is larger than the announced content length

* adding some unit tests for stream http content tests

* typo

* GivenThereIsAPossiblyBrokenServiceRunningOn

* Some code refactorings after code review. There are still some todos, but providing some more improvements, removing the exception handling from RequestMapper. It's handled in the middleware now, we will need to analyze this in detail.

* Some code cleanup

* removing some commented code bits

* adding more information in InvalidOperationException

* changing some methods signatures in request mapper, making them static.

* code review

* Update gotchas.rst

* Update notsupported.rst

* Update gotchas.rst

Add "Maximum request body size" notes

* With this fix, the system is able to handle content with size > 2 Gb

* adding new benchmarks, generating the payloads on the fly, from 1KB to 1024MB

* Review PayloadBenchmarks

* valid JSON

* should make sure the payloads directory exists

* Payloads folder name should match test method name

---------

Co-authored-by: Raman Maksimchuk <[email protected]>
* Cache by header value: a new Header property in (File)CacheOptions configuration of a route (#1172)

@EngRajabi, Mohsen Rajabi (7):
      add header to file cache option
      fix private set
      fix
      <none>
      <none>
      fix build fail
      fix: fix review comment. add unit test for change

@raman-m, Raman Maksimchuk (1):
      Update caching.rst

@raman-m (7):
      Fix errors
      Fix errors
      Fix styling warnings
      Refactor tests
      Add Delimiter
      Refactor generator
      Add unit tests

* Review after cherry pick

* Some refactoring

* Disable request body hashing

* Make CacheKeyGenerator default

* Refactor property EnableContentHashing

* Fix unit test. Add def cstor for CacheOptions

* Remove virtual modifier

* file-scoped namespace

* Move to feature folder

* Fix warnings

* Refactor CachingTests

* Add acceptance tests of #1172

* Move to feature folder

* Refactor HttpClientCachingTests

---------

Co-authored-by: Mohsen Rajabi <[email protected]>
* first version

* first working version of the new http client pool

* Some cleanup, removing classes that aren't used

* some more cleanup

* forgot passing PooledConnectionLifetime

* adding todo for connection pool and request timeouts

* some code cleanup

* ongoing process refactoring tests

* a little mistake with big effects

* Several refactorings, disposing http response message to ensure that the connection is freed. Moving errors from Polly provider to Errors\QoS.

* providing some comments

* adding response body benchmark

* some minor changes in MessageInvokerPool.

* using context.RequestAborted in responder middleware (copying the response body from downstream service to the http context)

* Fix style warnings

* code review

* moving response.Content.ReadAsStreamAsync nearer to CopyToAsync with using.
Making sure, that the content stream is disposed

* HttpResponse.Content never returns null (from .net 5 onwards)

* adding more unit tests (validating, log warning if passthrough certificate, cookies are returned, message invoker timeout)

* adding a tolerance margin

* adding new acceptance test, checking memory usage. Needs to be compared with current implementation first.

* Review tests by @raman-m

* Update src/Ocelot/Configuration/HttpHandlerOptions.cs

* Update src/Ocelot/Middleware/DownstreamResponse.cs

* Update src/Ocelot/Requester/MessageInvokerPool.cs

* Update src/Ocelot/Requester/HttpExceptionToErrorMapper.cs

* Update src/Ocelot/Responder/HttpContextResponder.cs

* Update src/Ocelot/Middleware/DownstreamResponse.cs

* Use null-coalescing operator for `Nullable<int>` obj

* some modifications in the acceptance test, adding a tolerance of 1 Mb

* finalizing content tests. Making sure, that the downstream response body is not copied by the api gateway.

* adapting tolerances

* Disable StyleCop rule SA1010 which is in conflict with collection initialization block vs whitespace.
More: https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1010.md

* Refactor Content tests

---------

Co-authored-by: Raman Maksimchuk <[email protected]>
…ll placeholders at the end of template (#1911)

* Update RoutingTests.cs

* Fix end of line empty placeholder

* Fix unit tests

* Fix PR Comments

* Update src/Ocelot/Configuration/Creator/UpstreamTemplatePatternCreator.cs

Co-authored-by: Raman Maksimchuk <[email protected]>

* Update src/Ocelot/DownstreamRouteFinder/UrlMatcher/UrlPathPlaceholderNameAndValueFinder.cs

Co-authored-by: Raman Maksimchuk <[email protected]>

* Update test/Ocelot.AcceptanceTests/RoutingTests.cs

Co-authored-by: Raman Maksimchuk <[email protected]>

* Update test/Ocelot.AcceptanceTests/RoutingTests.cs

Co-authored-by: Raman Maksimchuk <[email protected]>

* Update test/Ocelot.UnitTests/Configuration/UpstreamTemplatePatternCreatorTests.cs

Co-authored-by: Raman Maksimchuk <[email protected]>

* compact the tests constant name

* remove constant

* Update RoutingTests.cs

* Update RoutingTests.cs

* Update RoutingTests.cs

* Update UrlPathPlaceholderNameAndValueFinderTests.cs

* Use range operator

* Use expression body for method

* Update src/Ocelot/DownstreamUrlCreator/Middleware/DownstreamUrlCreatorMiddleware.cs

Co-authored-by: Raman Maksimchuk <[email protected]>

* Update DownstreamUrlCreatorMiddleware.cs

* add extra unit tests

* Update RoutingTests.cs

* Clean code

* Update UrlPathPlaceholderNameAndValueFinderTests.cs

* Update DownstreamUrlCreatorMiddlewareTests.cs

* Update DownstreamUrlCreatorMiddlewareTests.cs

* Fix broken dsPath

* Review tests. Add query string scenarios

* Fix unit test and fix +1 issue

* Add final routing tests for Catch-All query string cases

* Fixed added unit tests

* Test traits

* Update docs of Routing feature

---------

Co-authored-by: Raman Maksimchuk <[email protected]>
* #1580. Added an opportunity to use several authentication provider keys.

* Update src/Ocelot/Configuration/Builder/AuthenticationOptionsBuilder.cs

Co-authored-by: Raynald Messié <[email protected]>

* #1580. Replaced AuthenticationProviderKeys type from the list to the array.

* #1580. Added a doc how to use AuthenticationProviderKeys in a Route.

* #1580. Amended the description how to use AuthenticationProviderKeys in a Route.

* #1580. Added an opportunity to use several authentication provider keys.

* Update src/Ocelot/Configuration/Builder/AuthenticationOptionsBuilder.cs

Co-authored-by: Raynald Messié <[email protected]>

* #1580. Replaced AuthenticationProviderKeys type from the list to the array.

* #1580. Added a doc how to use AuthenticationProviderKeys in a Route.

* #1580. Amended the description how to use AuthenticationProviderKeys in a Route.

* Quick review

* #1580. Implemented review points.

* #1580. Initialized result with AuthenticateResult.NoResult().

* #1580. Added @ggnaegi suggestions.

* #1580. Brought back the idea not to allocate AuthenticateResult instance.

* quick review

* Return Auth result of the last key in the collection

* review unit tests

* Enable parallelization of unit tests

* Fix messages

* Disable parallelization for PollyQoSProviderTests

* Switch off unstable test

* Re-enable parallelization & Isolate unstable test

* Reflection issue in middleware base: remove getting Type object

* Switch off unstable test

* Clean code

* Make MiddlewareName as public property

* Code review by @RaynaldM

* AuthenticationMiddleware: Line & Branch coverage -> 100%

* AuthenticationOptionsCreator: coverage -> 100%

* Remove private helpers with one reference

* RouteOptionsCreator: coverage -> 100%

* FileAuthenticationOptions: Refactor ToString method

* FileConfigurationFluentValidator: coverage -> 100%

* RouteFluentValidator: Branch coverage -> 100%

* TODO and Skip unstable test

* Move acceptance tests to the separate folder

* Review and refactor acceptance tests

* Add AuthenticationSteps class.
Choose inheritance over composition: less code

* Add 'GivenIHaveATokenWithScope' to 'AuthenticationSteps'

* Temporarily disable 'Should_timeout_per_default_after_90_seconds' test

* Add CreateIdentityServer method

* Add draft test

* Update route validator to support multiple auth schemes

* Acceptance tests

* Revert "TODO and Skip unstable test"

This reverts commit 1ec8564.

* Revert "Make MiddlewareName as public property"

This reverts commit 6f50c76.

* Revert "Reflection issue in middleware base: remove getting Type object"

* Clean up

* Isolate unstable test

* Mark old property as `Obsolete`

* a tiny little bit of cleanup

* Handling cases when principal or identity are null

* Update Authentication feature docs

* Convert back to block scoped namespace

---------

Co-authored-by: Igor Polishchuk <[email protected]>
Co-authored-by: Raman Maksimchuk <[email protected]>
Co-authored-by: Raynald Messié <[email protected]>
Co-authored-by: Igor Polishchuk <[email protected]>
Co-authored-by: Guillaume Gnaegi <[email protected]>
ZisisTsatsas and others added 6 commits February 12, 2024 12:17
… discovery provider (#1954)

* Update kubernetes.rst

The `Type` field for the kubernetes example is outdated

* Rename the class back to `Kube` making it as default K8s provider

* Endpoint mocking for `GetAsync()` of `Kube` provider

* Switch off timer

* Update K8s docs

* IDE1006: Naming rule violation

* Follow .NET conventions for test class names

---------

Co-authored-by: Raman Maksimchuk <[email protected]>
* Review & update docs and fix build warnings

* Update ReleaseNotes.md: Draft template for build script

* Final version of Release Notes
* Fix HttpContext.User is lost after passing MultiplexingMiddlware

* Simplify single downstream route handling

* fix

* some refactoring of long code

* add unit tests for #1396 user scenario

* Acceptance test for user forwarding

* refactor test

---------

Co-authored-by: Алексей Патрин <[email protected]>
Co-authored-by: Raman Maksimchuk <[email protected]>
* #1844 More open customization of Polly use

* Update src/Ocelot.Provider.Polly/OcelotBuilderExtensions.cs

Co-authored-by: Raman Maksimchuk <[email protected]>

* #1844 More open customization of Polly use

* Update src/Ocelot.Provider.Polly/OcelotBuilderExtensions.cs

Co-authored-by: Raman Maksimchuk <[email protected]>

* fix compilation errors

* add xml doc

* More XML-docs

* remove new line separators

---------

Co-authored-by: Ray <[email protected]>
Co-authored-by: Raman Maksimchuk <[email protected]>
@raman-m raman-m closed this Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.