-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Orleans.TestingHost support test clusters without legacy configuration #3878
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/Orleans.Runtime/MembershipService/LegacyMembershipConfigurator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,16 +6,13 @@ | |
using Microsoft.Extensions.DependencyInjection; | ||
using Orleans.Providers; | ||
using Orleans.Runtime; | ||
using Orleans.Runtime.Configuration; | ||
using Orleans.Runtime.GrainDirectory; | ||
using Orleans.Runtime.Messaging; | ||
using Orleans.Runtime.Placement; | ||
using Orleans.Storage; | ||
using Orleans.MultiCluster; | ||
using Orleans.Hosting; | ||
using Orleans.Runtime.MultiClusterNetwork; | ||
using Orleans.Runtime.TestHooks; | ||
using Orleans.Runtime.Providers; | ||
|
||
namespace Orleans.TestingHost | ||
{ | ||
|
@@ -25,24 +22,21 @@ public class AppDomainSiloHost : MarshalByRefObject | |
private readonly ISiloHost host; | ||
|
||
/// <summary>Creates and initializes a silo in the current app domain.</summary> | ||
/// <param name="name">Name of this silo.</param> | ||
/// <param name="siloBuilderFactoryType">Type of silo host builder factory.</param> | ||
/// <param name="config">Silo config data to be used for this silo.</param> | ||
public AppDomainSiloHost(string name, Type siloBuilderFactoryType, ClusterConfiguration config) | ||
/// <param name="appDomainName">Name of this silo.</param> | ||
/// <param name="serializedConfigurationSources">Silo config data to be used for this silo.</param> | ||
public AppDomainSiloHost(string appDomainName, string serializedConfigurationSources) | ||
{ | ||
var builderFactory = (ISiloBuilderFactory)Activator.CreateInstance(siloBuilderFactoryType); | ||
ISiloHostBuilder builder = builderFactory | ||
.CreateSiloBuilder(name, config) | ||
.ConfigureServices(services => services.AddSingleton<TestHooksSystemTarget>()) | ||
.ConfigureApplicationParts(parts => parts.AddFromAppDomain().AddFromApplicationBaseDirectory()); | ||
this.host = builder.Build(); | ||
InitializeTestHooksSystemTarget(); | ||
var deserializedSources = TestClusterHostFactory.DeserializeConfigurationSources(serializedConfigurationSources); | ||
this.host = TestClusterHostFactory.CreateSiloHost(appDomainName, deserializedSources); | ||
this.AppDomainTestHook = new AppDomainTestHooks(this.host); | ||
} | ||
|
||
/// <summary> SiloAddress for this silo. </summary> | ||
public SiloAddress SiloAddress => this.host.Services.GetRequiredService<ILocalSiloDetails>().SiloAddress; | ||
|
||
|
||
/// <summary> Gateway address for this silo. </summary> | ||
public SiloAddress GatewayAddress => this.host.Services.GetRequiredService<ILocalSiloDetails>().GatewayAddress; | ||
|
||
internal AppDomainTestHooks AppDomainTestHook { get; } | ||
|
||
/// <summary>Starts the silo</summary> | ||
|
@@ -56,13 +50,6 @@ public void Shutdown() | |
{ | ||
this.host.StopAsync().GetAwaiter().GetResult(); | ||
} | ||
|
||
private void InitializeTestHooksSystemTarget() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. where is this part of logic moved to ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moved to TestClusterHostFactory |
||
{ | ||
var testHook = this.host.Services.GetRequiredService<TestHooksSystemTarget>(); | ||
var providerRuntime = this.host.Services.GetRequiredService<SiloProviderRuntime>(); | ||
providerRuntime.RegisterSystemTarget(testHook); | ||
} | ||
} | ||
|
||
/// <summary> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure swallowing
FileNotFoundException
is a good idea, didn't this change original behavior? And for users who wanted to doStandardLoad
from a config file, it hided exception from them which make it harder for them to notice that they made a mistake somewhere.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really, this is for the path we're users didn't explicitly pass a config object. If they do want, then they'll get the exception in their code when they try to load the config.
Btw, this code path will be removed as soon as the runtime itself stops requiring the legacy config in the first place