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 'develop' into 'feature/issue-#737-pluggable-route-variables' #2051

Closed
wants to merge 476 commits into from

Conversation

raman-m
Copy link
Member

@raman-m raman-m commented Apr 17, 2024

TomPallister and others added 30 commits February 9, 2020 15:51
This means that forked PRs can now build as they don't need the coveralls secret
Co-authored-by: TomPallister <tom@threemammals.com>
ggnaegi and others added 19 commits March 1, 2024 20:33
…1826)

* Cleanup of Multiplexing middleware, avoiding creating copies of the Http context if only one downstream route.

* updating comments

* preparing rebase, it's a hack.

* fixing test case "Copy_User_ToTarget",  method name has changed.

* adding some unit tests, checking that if 1 route, ProcessSingleRoute is called and no copies of context are made, if more than 2 Map is called, then more than 2 copies are created.

* Applying refactoring suggested.

* some code cleanup

* Some code cleanup in Aggregate Logic

* Cleanup in Aggregate Tests, verifying multiplexer cleanup

* Finalizing unit test, with complex keys.

* some code refactoring and applying suggestions from reviews

* Update requestaggregation.rst

Recover docs

* updating docs

* Update requestaggregation.rst

* Update requestaggregation.rst

* Code review by @raman-m

* Inherit `Steps` functionality instead of private aggregation

---------

Co-authored-by: Raman Maksimchuk <dotnet044@gmail.com>
Sync 'develop' to 'release/23.1'
… configuration files to memory (#1227)

* Added new ConfigurationBuilderExtensions.AddOcelot
overload to support merging of configuration files to memory

* Fix warnings

* File-scoped namespaces

* Update configuration.rst

Use '^' for subsubsections.
Sections: https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#sections

* Review the code after merge and refactor

* Remove and sort usings

* Fix warnings

* Tried to fix

* A small but funny refactoring

* Update configuration.rst

* More refactoring: add overloaded extensions

* Review helpers of unit tests

* Add `FileUnitTest` and full rewrite of config tests

* Refactor `DiskFileConfigurationRepository` class.
Make unit tests parallel, independent, and thread safe

* some minor changes

* Review and update docs of the Configuration feature

* Review and update docs of the `Dependency Injection` feature

* Check references for `Dependency Injection` feature aka `ref:` and `doc:`

* Update configuration.rst

Replace "kind" with "type"

---------

Co-authored-by: Raman Maksimchuk <dotnet044@gmail.com>
Co-authored-by: Guillaume Gnaegi <58469901+ggnaegi@users.noreply.github.com>
* #1844 More open customization of Polly use

* First step: implementation done, The UTs have yet to be determined

* reverted changes in PollyPoliciesDelegatingHandlerTests
created tests for  PollyResiliencePipelineDelegatingHandler
created tests for PollyQoSResiliencePipelineProvider

* renaming variables for better clarity in PollyQoSResiliencePipelineProviderTests

* The most significant changes involve updates to the `OcelotBuilderExtensions` and `PollyQoSResiliencePipelineProvider` classes, as well as modifications to the `PollyQoSTests` class.

In the `OcelotBuilderExtensions` class, the `GetDelegatingHandler` method is now used instead of `GetDelegatingHandlerV7` in the `AddPolly` methods. The `AddPolly` method without parameters has been simplified using a lambda expression. The `GetDelegatingHandler` method now returns a new instance of `PollyResiliencePipelineDelegatingHandler` instead of `PollyPoliciesDelegatingHandler`.

In the `PollyQoSResiliencePipelineProvider` class, a comment has been added suggesting the use of `ResiliencePipelineRegistry<TKey>.GetOrAddPipeline` due to its thread-safe nature. The `MinimumThroughput` property in `circuitBreakerStrategyOptions` now uses the value from `route.QosOptions.ExceptionsAllowedBeforeBreaking`.

In the `PollyQoSTests` class, the `QoSOptions` used in the test configurations have been updated. Two tests, `Should_open_circuit_breaker_then_close` and `Open_circuit_should_not_effect_different_route`, have been modified to repeat the same request as the minimum `ExceptionsAllowedBeforeBreaking` is now 2. The `GivenThereIsAPossiblyBrokenServiceRunningOn` method now delays for 2.1 seconds when the request count is 2, to ensure the circuit is open.

Changes:

1. `OcelotBuilderExtensions` class updated to use `GetDelegatingHandler` method.
2. `AddPolly` methods in `OcelotBuilderExtensions` class simplified.
3. `GetDelegatingHandler` method in `OcelotBuilderExtensions` class now returns a new instance of `PollyResiliencePipelineDelegatingHandler`.
4. Comment added in `PollyQoSResiliencePipelineProvider` class suggesting the use of `ResiliencePipelineRegistry<TKey>.GetOrAddPipeline`.
5. `MinimumThroughput` property in `circuitBreakerStrategyOptions` updated to use value from `route.QosOptions.ExceptionsAllowedBeforeBreaking`.
6. `QoSOptions` in `PollyQoSTests` class updated.
7. `Should_open_circuit_breaker_then_close` and `Open_circuit_should_not_effect_different_route` tests in `PollyQoSTests` class updated.
8. `GivenThereIsAPossiblyBrokenServiceRunningOn` method in `PollyQoSTests` class updated to delay for 2.1 seconds when request count is 2.

* end of implementation

* remove "Microsoft.VisualStudio.Azure.Containers.Tools.Targets" packages in sample

* Use `ResiliencePipelineRegistry` in `PollyQoSResiliencePipelineProvider`. This new implementation replaces the previous dictionary-based approach for managing cache for resilience pipelines.

* fix conflict

* end of merge of develop (+polly package uptdate)

* fix polly update

* #1844 More open customization of Polly use

* First step: implementation done, The UTs have yet to be determined

* reverted changes in PollyPoliciesDelegatingHandlerTests
created tests for  PollyResiliencePipelineDelegatingHandler
created tests for PollyQoSResiliencePipelineProvider

* renaming variables for better clarity in PollyQoSResiliencePipelineProviderTests

* The most significant changes involve updates to the `OcelotBuilderExtensions` and `PollyQoSResiliencePipelineProvider` classes, as well as modifications to the `PollyQoSTests` class.

In the `OcelotBuilderExtensions` class, the `GetDelegatingHandler` method is now used instead of `GetDelegatingHandlerV7` in the `AddPolly` methods. The `AddPolly` method without parameters has been simplified using a lambda expression. The `GetDelegatingHandler` method now returns a new instance of `PollyResiliencePipelineDelegatingHandler` instead of `PollyPoliciesDelegatingHandler`.

In the `PollyQoSResiliencePipelineProvider` class, a comment has been added suggesting the use of `ResiliencePipelineRegistry<TKey>.GetOrAddPipeline` due to its thread-safe nature. The `MinimumThroughput` property in `circuitBreakerStrategyOptions` now uses the value from `route.QosOptions.ExceptionsAllowedBeforeBreaking`.

In the `PollyQoSTests` class, the `QoSOptions` used in the test configurations have been updated. Two tests, `Should_open_circuit_breaker_then_close` and `Open_circuit_should_not_effect_different_route`, have been modified to repeat the same request as the minimum `ExceptionsAllowedBeforeBreaking` is now 2. The `GivenThereIsAPossiblyBrokenServiceRunningOn` method now delays for 2.1 seconds when the request count is 2, to ensure the circuit is open.

Changes:

1. `OcelotBuilderExtensions` class updated to use `GetDelegatingHandler` method.
2. `AddPolly` methods in `OcelotBuilderExtensions` class simplified.
3. `GetDelegatingHandler` method in `OcelotBuilderExtensions` class now returns a new instance of `PollyResiliencePipelineDelegatingHandler`.
4. Comment added in `PollyQoSResiliencePipelineProvider` class suggesting the use of `ResiliencePipelineRegistry<TKey>.GetOrAddPipeline`.
5. `MinimumThroughput` property in `circuitBreakerStrategyOptions` updated to use value from `route.QosOptions.ExceptionsAllowedBeforeBreaking`.
6. `QoSOptions` in `PollyQoSTests` class updated.
7. `Should_open_circuit_breaker_then_close` and `Open_circuit_should_not_effect_different_route` tests in `PollyQoSTests` class updated.
8. `GivenThereIsAPossiblyBrokenServiceRunningOn` method in `PollyQoSTests` class updated to delay for 2.1 seconds when request count is 2.

* Use `ResiliencePipelineRegistry` in `PollyQoSResiliencePipelineProvider`. This new implementation replaces the previous dictionary-based approach for managing cache for resilience pipelines.

* end of implementation

* remove "Microsoft.VisualStudio.Azure.Containers.Tools.Targets" packages in sample

* fix conflict

* end of merge of develop (+polly package uptdate)

* fix polly update

* renaming

* fix compile error

* The most significant changes involve the modification of the `errorMapping` type from `Dictionary<Type, Func<Exception, Error>>` to `IDictionary<Type, Func<Exception, Error>>` across multiple files. This change is aimed at enhancing code flexibility and testability. Additionally, the `AddPolly<T>` and `AddPollyV7<T>` methods in `OcelotBuilderExtensions.cs` have been updated to accept `IDictionary` instead of `Dictionary`.

Here are the changes in detail:

1. The type of `errorMapping` was changed from `Dictionary<Type, Func<Exception, Error>>` to `IDictionary<Type, Func<Exception, Error>>` in several places across multiple files to make the code more flexible and easier to test.
2. The `AddPolly<T>` and `AddPollyV7<T>` methods in `OcelotBuilderExtensions.cs` were updated to accept `IDictionary` instead of `Dictionary`.
3. The `_mappers` field and the corresponding assignment in the constructor in `HttpExceptionToErrorMapper.cs` were updated to use `IDictionary`.
4. The `WithExceptionsAllowedBeforeBreaking` and `WithTimeoutValue` values in `OcelotBuilderExtensionsTests.cs` and `PollyQoSResiliencePipelineProviderTests.cs` were updated.
5. The `errorMapping` variable in `HttpExceptionToErrorMapperTests.cs` was updated to use `IDictionary`.

* try to fix UTs on CircleCI

* try another settings

* one more test

* post code reveiew and develop merge

* Quick code review by @raman-m

* Re-add lost XML docs from commit 0404c24
Complete docs

* Update Polly version

* Update Polly to 8.3.1

* Code review by @raman-m

* Arrange file layout in a separate directory (V7)
Modify Obsolete attribute texts
Add note in doc

* Update qualityofservice.rst

Update docs according to the Polly v8 implementations and QoS design upgrade

* More XML docs

* Make the base class abstract

* some code cleanup

* some comments

* remove comments

* Re-use logger and fix warning

* Final review of QoS docs

---------

Co-authored-by: Ray <rmessie@traceparts.com>
Co-authored-by: Tomislav Prebeg <tprebeg@traceparts.com>
Co-authored-by: Raman Maksimchuk <dotnet044@gmail.com>
Co-authored-by: Guillaume Gnaegi <58469901+ggnaegi@users.noreply.github.com>
* fix: create building the servicecollection

* fix: handle default configuration

* chore: extension methods invocation

* Update src/Ocelot/DependencyInjection/ServiceCollectionExtensions.cs

* Code review by @raman-m

* No warnings for CS0618

* Given developer forgot to add environment, then?... Ups! Your Duck, duck!
  Hunting for `new FileInfo("")` bug... Done!

* Coverage 100%

---------

Co-authored-by: Adrien HUPOND <adrien.hupond@csgroup.eu>
Co-authored-by: Raman Maksimchuk <dotnet044@gmail.com>
* add validation for downstream path also

* add similiar route placeholders

* Add unit tests

* Refactor unit tests

* IDE1006: Naming rule violation

* IDE0028: Collection Initialization can be simplified

* Merge into one theory

* Less `IEnumerable<T>` usage to have less `IEnumerator<T>` objects in favor of the collection one

* Refactor validation of duplicated placeholders

* Finish unit testing

* Publish hidden Service Fabric feature

* Update acceptance tests

* Update integration tests

* Update release notes

---------
The author: Aly Kafoury <@AlyHKafoury>
Co-authored-by: Raman Maksimchuk <dotnet044@gmail.com>
* Release notes

* Update docs

* Lunar Eclipse codename
Sync 'develop' to 'release/23.2'
* version 8.21.0

* New 8.23 version with `dotnet dev-certs` command

* Publish `latest` and `8.23.2` tags
* Remove faulty rules which validate explicit placeholders but not implicit ones

* Validation rule for Service Fabric placeholders

* Revert "Validation rule for Service Fabric placeholders"
This reverts commit c30fe45.
* Override `DefaultRequestTimeoutSeconds` by new property

* Build using .NET 8 SDK only

* Build all 3 SDKs if target is Release

* Run "dotnet tool restore" to make the "dotnet-cake" command available

* Update GitVersion.Tool package

* GitVersion.Tool 5.12.0

* Newtonsoft.Json

* Review packages

* Prepare folder structure for samples

* samples Administration

* Move Docker files

* samples solution folder

* Move ServiceFabric folders

* Rename ServiceFabric folders

* Re-add OcelotApplication of ServiceFabric sample

* New Samples view in Visual Studio

* Add Ocelot.Samples.sln

* Add Ocelot.Release.sln

* Remove Samples projects from main solution

* log settings of Compile task

* Remove legacy build settings file

* queue/block_workflow

* resource_class

* Update .editorconfig

* CS8936: Feature 'primary constructors' is not available in C# 10, 11.
Feature 'primary constructors' is available in C# 12.0 or greater. But we use `net6.0` and `net7.0`

* CS8936 Feature 'collection expressions' is not available in C# 10, 11.
CS8936: Feature 'primary constructors' is not available in C# 10, 11.

* CS0618: 'member' is obsolete: 'text'.
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/cs0618
Switch off the warning CS0618 for testing projects.

* Fix warnings.

xUnit1013 Public method 'GivenThereIsAnIdentityServerOn' on test class 'AuthenticationTests' should be marked as a Theory. Reduce the visibility of the method, or add a Theory attribute to the method.

CS0618 'FileAuthenticationOptions.AuthenticationProviderKey' is obsolete: 'Use the AuthenticationProviderKeys property!'.

* Don't restore and don't build in RunUnitTests target

* --verbosity:detailed

* Disable BDDfy console report

* enable

* Inherit from `UnitTest`
#2048)

* Update configuration.rst

* Static CSS overrides

* Notes are now smaller
@raman-m raman-m self-assigned this Apr 17, 2024
@raman-m raman-m added conflicts Feature branch has merge conflicts needs feedback Issue is waiting on feedback before acceptance Claims Transformation Ocelot feature: Claims Transformation labels Apr 17, 2024
@raman-m
Copy link
Member Author

raman-m commented Apr 17, 2024

@philproctor Welcome!
Better to rebase feature branch onto develop and close this PR❕

PaulARoy and others added 4 commits April 25, 2024 14:37
…tiplexing (#2050)

* feat: buffer the request body during multiplexing multiple routes

* style: rename clone request body method to be more explicit

* Code review by @raman-m

* feat: refactor clone request method, add acceptance test for form-based requests

* fix: add content-length log, refactor tests from @raman-m commit

* Update requestaggregation.rst

* style: reverse return condition

* Register `Stream` objects for disposing by downstream `HttpResponse`

---------

Co-authored-by: Paul Roy <paul.roy@astriis.com>
Co-authored-by: Raman Maksimchuk <dotnet044@gmail.com>
…vider (#2052)

* Initial refactoring

* Interfaces namespace

* `IKubeServiceBuilder` interface vs `KubeServiceBuilder` class

* `IKubeServiceCreator` interface vs `KubeServiceCreator` class

* Customize K8s services creation

* Add logger

* namespace Ocelot.AcceptanceTests.ServiceDiscovery

* Add `KubernetesServiceDiscoveryTests`

* Unit tests

* AAA pattern

* Acceptance tests

* Update kubernetes.rst

* Check docs
* Use correct interval for request counting

* Minor fixes, return correct counter value when ban period elapsed

* Revert "Use correct interval for request counting"

This reverts commit 7d232c7.

* Revert "Artificial commit, initiate CI"

This reverts commit e723dfa.

* CA1822 Member 'XYZ' does not access instance data and can be marked as static

* Quick code review by @raman-m

* Rate Limiting feature name should match folder name

* namespace `Ocelot.RateLimiting`

* Extract `IRateLimitCore` interface

* Remove useless `ClientRateLimitProcessor` class

* Rename to `IRateLimitStorage` and dev docs

* Wrap services as a feature

* Review `IRateLimitCore` interface and dev docs

* The middleware class prefix should match the feature name

* Add some basic `RateLimitCoreTests`

* Rename to `IRateLimiting`

* Refactor rate limiting core

* Remove redundant `SaveCounter` from the interface

* Thread safe storage operations

* Coalesce in return statement

* Convert to file-scoped namespace

* Use expression body

* Unit tests for #1590 user scenario

* Move test class to separate feature folder

* Inherit from `Steps`

* Refactoring: Follow the DRY principle

* Acceptance test for #1590 user scenario

* Update feature docs

---------

Co-authored-by: raman-m <dotnet044@gmail.com>
…ions` (#2058)

* EnableContentHashing not being considered from appsettings

* Adding CacheOptionsCreator, Injected IRegionCreator as Singleton. Should still add some acceptance tests that are definitely missing!

* Adding caching global configuration since we messed up, ignoring an important breaking change with EnableContentHashing set to false by default

* Adding some further acceptance tests, validating EnableContentHashing, validating global config too.

* removing some debug content

* TtlSeconds must be set

* updating documentation

* Update docs/features/caching.rst

Co-authored-by: Raman Maksimchuk <dotnet044@gmail.com>

* Update docs/features/caching.rst

Co-authored-by: Raman Maksimchuk <dotnet044@gmail.com>

* Removing RegionCreator, moving service collection extension method to dependencyInjection\Features etc.

* adding unit tests for FileCacheOptions

* some more null tests...

* slight refactoring, updating ICacheOptionsCreator signature

* some more design refactoring

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

Co-authored-by: Raman Maksimchuk <dotnet044@gmail.com>

* Code review by @raman-m

* Rename `FileCacheOptions` -> `CacheOptions`

* Subtly transition to `CacheOptions`, ensuring compatibility with `FileCacheOptions` to avoid a breaking change

* Not obsolete

---------

Co-authored-by: Guillaume Gnaegi <58469901+ggnaegi@users.noreply.github.com>
Co-authored-by: Raman Maksimchuk <dotnet044@gmail.com>
@raman-m
Copy link
Member Author

raman-m commented May 14, 2024

The feature branch will be deleted.
The author doesn't develop anymore.

@raman-m raman-m closed this May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Claims Transformation Ocelot feature: Claims Transformation conflicts Feature branch has merge conflicts needs feedback Issue is waiting on feedback before acceptance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet