-
Notifications
You must be signed in to change notification settings - Fork 323
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
TestPlugin cache refactored. #709
TestPlugin cache refactored. #709
Conversation
harshjain2
commented
Apr 12, 2017
- Refactored Test Plugin Cache to support loading for individual extensions.
@harshjain2, |
@@ -113,7 +104,7 @@ public IEnumerable<string> PathToAdditionalExtensions | |||
{ |
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.
Should we rename it to PathToExtensions
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.
Resolved.
@@ -23,45 +23,96 @@ public class TestExtensions | |||
internal Dictionary<string, TestDiscovererPluginInformation> TestDiscoverers { get; set; } | |||
|
|||
/// <summary> | |||
/// Gets or sets a value indicating whether are test discoverers cached. | |||
/// </summary> | |||
internal bool AreTestDiscoverersCached { get; set; } |
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.
Where are we setting the value of variable AreTestDiscoverersCached
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.
Resovled.
@@ -53,12 +54,12 @@ public static TestLoggerExtensionManager Create(IMessageLogger messageLogger) | |||
IEnumerable<LazyExtension<ITestLogger, ITestLoggerCapabilities>> filteredTestExtensions; | |||
IEnumerable<LazyExtension<ITestLogger, Dictionary<string, object>>> unfilteredTestExtensions; | |||
|
|||
TestPluginManager.Instance.GetTestExtensions<ITestLogger, ITestLoggerCapabilities, TestLoggerMetadata>( | |||
TestPluginManager.Instance.GetSpecificTestExtensions<TestLoggerPluginInformation, ITestLogger, ITestLoggerCapabilities, TestLoggerMetadata>( |
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.
TestLoggerPluginInformation [](start = 65, length = 27)
Would we ever call TestLoggerPluginInformation with a different regex pattern? Maybe the regex patter should be in TestPluginInfo itself. Dont see a reason for it to be propagated everywhere when TestPluginInfo is anyway passed through.
{ | ||
extensions.AddRange(TestPluginCache.Instance.PathToAdditionalExtensions); | ||
} | ||
var extensions = this.testHostManager.GetTestPlatformExtensions(sourceList, TestPluginCache.Instance.PathToAdditionalExtensions).ToList(); |
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.
.ToList(); [](start = 140, length = 10)
nit: use IEnumerable.
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.
resolved.
@@ -100,7 +100,7 @@ public DotnetTestHostManager() | |||
/// <remarks> | |||
/// Dependency resolution for .net core projects are pivoted by the test project. Hence each test | |||
/// project must be launched in a separate test host process. | |||
/// </remarks> | |||
/// </remarks>InitializeExtensions |
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.
InitializeExtensions [](start = 22, length = 20)
cleanup?
/// <returns> | ||
/// The <see cref="Dictionary"/> of extensions discovered | ||
/// </returns> | ||
internal Dictionary<string, TPluginInfo> AddExtension<TPluginInfo>( |
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.
AddExtension [](start = 49, length = 12)
misleading name: It says Add but we are setting it. Is that intended?
this.TestExtensions = new TestExtensions(); | ||
} | ||
|
||
this.TestExtensions.AddExtension<TPluginInfo>(pluginInfos); |
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.
Should we update our central cache?
} | ||
|
||
this.GetTestExtensions<TPluginInfo, TExtension>(new List<string>() { extensionAssembly }); | ||
return this.TestExtensions?.GetExtensionsDiscoveredFromAssembly<TPluginInfo>(this.TestExtensions.GetTestExtensionCache<TPluginInfo>(), extensionAssembly); |
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 don't think we need this line.
@@ -204,7 +214,7 @@ public ArgumentProcessorResult Execute() | |||
/// <returns> The list of test adapter and logger assemblies. </returns> | |||
internal virtual IEnumerable<string> GetTestAdaptersFromDirectory(string directory) |
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.
Do we need this function now? I think we can remove it and we should add logic to find extension in testplatform.UpdateTestAdapterPaths( string runSettings )
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.
👍 LGTM
Please add following scenario in your test matrix:
- Run cpp tests
- Pass logger through /TestAdapterpath
…y to modify runsettings.
…n2/vstest into TestPluginCacheRefactor
|
||
try | ||
{ | ||
// Remove leading and trailing ' " ' chars... | ||
argument = argument.Trim().Trim(new char[] { '\"' }); | ||
|
||
customAdaptersPath = Path.GetFullPath(argument); | ||
if (!fileHelper.DirectoryExists(customAdaptersPath)) | ||
var testadapterPaths = argument.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries).ToList(); |
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.
TestAdapterPath can not have more than one path. If we want to change the behavior then we need to set property
public override bool AllowMultiple => true; and user has to specify /Testadapterpath multiple times if he wants to use multiple Testadapterpath
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.
Reverted to original behaviour.
/// Gets or sets test setting provider extensions. | ||
/// </summary> | ||
internal Dictionary<string, TestSettingsProviderPluginInformation> TestSettingsProviders { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets a value indicating whether are test settings providers cached. | ||
/// </summary> | ||
internal bool AreTestSettingsProvidersCached { get; set; } |
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.
Are we planning to move these out to their respective plugin managers? This is becoming a God class.
Please file an issue for the two broad level issues that came out as part of this PR:
|
…hs in runsettings.
this.output.Warning(CommandLineResources.NoAdaptersFoundInTestAdapterPath, argument); | ||
this.output.WriteLine(string.Empty, OutputLevel.Information); | ||
} | ||
this.commandLineOptions.TestAdapterPath = customAdaptersPath; |
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.
Can we please check uses of this. earlier it were taking single path but now u are passing list of paths
@dotnet-bot test this please |
@dotnet-bot test this please |