Skip to content

Commit

Permalink
Big rework of how tests are run.
Browse files Browse the repository at this point in the history
We upgraded to the very bleeding edge of xUnit which has improved its internal message bus handling.
In our case we were waiting in upwards of 10 seconds for the summary to be displayed on the console after the last test run.

We now use a custom TestAssemblyRunner so that we are in complete control how tests are executed. This allows us to move away from
xUnit [Collection]'s to initialize clusters in integration mode. Collections also form a concurrency limit which prevented most of our
unit tests to run in parallel.

Unit tests now run in parallel using xUnits default concurrency implementation.

When running Integration tests we group the test classes based on which TClusterBase they implement as per inheriting from IClusterFixture<TClusterBase>.

We initialize one ClusterBase per group and pass the same instance to all test classes. Then (after the cluster starts and bootstraps) we run the tests in parallel

A cluster can override MaxParallism to limit concurrent execution, IntrusiveOperationCluster does this since it runs heavy es API's (reindex, forcemerge and the likes).

Another huge performance gain is that tests now share clients where they can instead of new'ing them each time with new connectionsettings. This totally violated our
own documented best practices!

Improved console out in integration mode, we only elasticsearch.bat std/err up till we get a started confirmation. All the .IsValid.Should().BeTrue() are now replaced with
.ShouldBeValid() or .ShouldNotBeValid() which dumps DebugInformation in the exception.

At the end of the integration run each Cluster's total test time is printed in a short summary, so we know what to focus on if we want to make another big dent in our integration
running times.

Conflicts:
	paket.lock
	src/Elasticsearch.Net/Transport/Pipeline/RequestData.cs
	src/Profiling/ProfilingCluster.cs
	src/Profiling/Program.cs
	src/Tests/Aggregations/AggregationUsageTestBase.cs
	src/Tests/Aggregations/Metric/GeoCentroid/GeoCentroidAggregationUsageTests.cs
	src/Tests/Analysis/AnalysisCrudTests.cs
	src/Tests/Cat/CatAliases/CatAliasesApiTests.cs
	src/Tests/Cat/CatAllocation/CatAllocationApiTests.cs
	src/Tests/Cat/CatCount/CatCountApiTests.cs
	src/Tests/Cat/CatFielddata/CatFielddataApiTests.cs
	src/Tests/Cat/CatHealth/CatHealthApiTests.cs
	src/Tests/Cat/CatHelp/CatHelpApiTests.cs
	src/Tests/Cat/CatIndices/CatIndicesApiTests.cs
	src/Tests/Cat/CatMaster/CatMasterApiTests.cs
	src/Tests/Cat/CatNodeAttributes/CatNodeAttributesApiTests.cs
	src/Tests/Cat/CatNodes/CatNodesApiTests.cs
	src/Tests/Cat/CatPendingTasks/CatPendingTasksApiTests.cs
	src/Tests/Cat/CatPlugins/CatPluginsApiTests.cs
	src/Tests/Cat/CatRecovery/CatRecoveryApiTests.cs
	src/Tests/Cat/CatRepositories/CatRepositoriesApiTests.cs
	src/Tests/Cat/CatSegments/CatSegmentsApiTests.cs
	src/Tests/Cat/CatShards/CatShardsApiTests.cs
	src/Tests/Cat/CatSnapshots/CatSnapshotsApiTests.cs
	src/Tests/Cat/CatThreadPool/CatThreadpoolApiTests.cs
	src/Tests/ClientConcepts/Connection/HttpConnectionTests.cs
	src/Tests/ClientConcepts/ConnectionPooling/BuildingBlocks/RequestPipelines.doc.cs
	src/Tests/ClientConcepts/ConnectionPooling/Sniffing/RoleDetection.doc.cs
	src/Tests/ClientConcepts/Exceptions/ExceptionTests.cs
	src/Tests/ClientConcepts/HighLevel/Inference/IndexNameInference.doc.cs
	src/Tests/ClientConcepts/HighLevel/Inference/IndicesPaths.doc.cs
	src/Tests/ClientConcepts/HighLevel/Inference/PropertyInference.doc.cs
	src/Tests/ClientConcepts/LowLevel/Connecting.doc.cs
	src/Tests/Cluster/ClusterHealth/ClusterHealthApiTests.cs
	src/Tests/Cluster/ClusterPendingTasks/ClusterPendingTasksApiTests.cs
	src/Tests/Cluster/ClusterReroute/ClusterRerouteApiTests.cs
	src/Tests/Cluster/ClusterSettings/ClusterGetSettings/ClusterGetSettingsApiTests.cs
	src/Tests/Cluster/ClusterSettings/ClusterPutSettings/ClusterPutSettingsApiTests.cs
	src/Tests/Cluster/ClusterState/ClusterStatsApiTests.cs
	src/Tests/Cluster/ClusterStats/ClusterStatsApiTests.cs
	src/Tests/Cluster/NodesHotThreads/NodesHotThreadsApiTests.cs
	src/Tests/Cluster/NodesInfo/NodesInfoApiTests.cs
	src/Tests/Cluster/NodesStats/NodesStatsApiTests.cs
	src/Tests/Cluster/Ping/PingApiTests.cs
	src/Tests/Cluster/RootNodeInfo/RootNodeInfoApiTests.cs
	src/Tests/Cluster/TaskManagement/TasksCancel/TasksCancelApiTests.cs
	src/Tests/Cluster/TaskManagement/TasksList/TasksListApiTests.cs
	src/Tests/Document/Multiple/Bulk/BulkApiTests.cs
	src/Tests/Document/Multiple/Bulk/BulkInvalidApiTests.cs
	src/Tests/Document/Multiple/DeleteByQuery/DeleteByQueryApiTests.cs
	src/Tests/Document/Multiple/MultiGet/GetManyApiTests.cs
	src/Tests/Document/Multiple/MultiGet/MultiGetApiTests.cs
	src/Tests/Document/Multiple/MultiTermVectors/MultiTermVectorsApiTests.cs
	src/Tests/Document/Multiple/Reindex/ReindexApiTests.cs
	src/Tests/Document/Multiple/ReindexOnServer/ReindexOnServerApiTests.cs
	src/Tests/Document/Multiple/UpdateByQuery/UpdateByQueryApiTests.cs
	src/Tests/Document/Single/Attachment/AttachmentApiTests.cs
	src/Tests/Document/Single/Delete/DeleteApiTests.cs
	src/Tests/Document/Single/DocumentCrudTests.cs
	src/Tests/Document/Single/Exists/DocumentExistsApiTests.cs
	src/Tests/Document/Single/Get/GetApiTests.cs
	src/Tests/Document/Single/Index/IndexApiTests.cs
	src/Tests/Document/Single/Source/SourceApiTests.cs
	src/Tests/Document/Single/TermVectors/TermVectorsApiTests.cs
	src/Tests/Document/Single/Update/UpdateApiTests.cs
	src/Tests/Document/Single/Update/UpdateWithSourceApiTests.cs
	src/Tests/Framework/EndpointTests/ApiIntegrationTestBase.cs
	src/Tests/Framework/EndpointTests/ApiTestBase.cs
	src/Tests/Framework/EndpointTests/Clusters/IIntegrationCluster.cs
	src/Tests/Framework/EndpointTests/Clusters/OwnIndexCluster.cs
	src/Tests/Framework/EndpointTests/Clusters/ReadOnlyCluster.cs
	src/Tests/Framework/EndpointTests/CrudTestBase.cs
	src/Tests/Framework/EndpointTests/UrlTests.cs
	src/Tests/Framework/Integration/Bootstrappers/Seeder.cs
	src/Tests/Framework/Integration/Clusters/ClusterBase.cs
	src/Tests/Framework/Integration/Process/ElasticsearchNode.cs
	src/Tests/Framework/SerializationTests/Roundtrip.cs
	src/Tests/Framework/SerializationTests/SerializationTestBase.cs
	src/Tests/Framework/SimpleIntegration.cs
	src/Tests/Framework/TestClient.cs
	src/Tests/IndexModules/UsageTestBase.cs
	src/Tests/Indices/AliasManagement/Alias/AliasApiTests.cs
	src/Tests/Indices/AliasManagement/AliasExists/AliasExistsApiTests.cs
	src/Tests/Indices/AliasManagement/DeleteAlias/AliasDeleteApiTests.cs
	src/Tests/Indices/AliasManagement/GetAlias/GetAliasApiTests.cs
	src/Tests/Indices/AliasManagement/GetAliases/GetAliasesApiTests.cs
	src/Tests/Indices/AliasManagement/GetAliasesPointingToIndex/GetAliasesPointingToIndexTests.cs
	src/Tests/Indices/AliasManagement/GetIndicesPointingToAlias/GetIndicesPointingToAliasTests.cs
	src/Tests/Indices/AliasManagement/PutAlias/PutAliasApiTests.cs
	src/Tests/Indices/Analyze/AnalyzeApiTests.cs
	src/Tests/Indices/IndexManagement/CreateIndex/CreateIndexApiTests.cs
	src/Tests/Indices/IndexManagement/DeleteIndex/DeleteIndexApiTests.cs
	src/Tests/Indices/IndexManagement/GetIndex/GetIndexApiTests.cs
	src/Tests/Indices/IndexManagement/IndicesExists/IndexExistsApiTests.cs
	src/Tests/Indices/IndexManagement/OpenCloseIndex/CloseIndex/CloseIndexApiTests.cs
	src/Tests/Indices/IndexManagement/OpenCloseIndex/OpenIndex/OpenIndexApiTests.cs
	src/Tests/Indices/IndexManagement/TypesExists/TypeExistsApiTests.cs
	src/Tests/Indices/IndexSettings/GetIndexSettings/GetIndexSettingsApiTests.cs
	src/Tests/Indices/IndexSettings/IndexTemplates/DeleteIndexTemplate/DeleteIndexTemplateApiTests.cs
	src/Tests/Indices/IndexSettings/IndexTemplates/GetIndexTemplate/GetIndexTemplateApiTests.cs
	src/Tests/Indices/IndexSettings/IndexTemplates/IndexTemplateCrudTests.cs
	src/Tests/Indices/IndexSettings/IndexTemplates/IndexTemplateExists/IndexTemplateExistsApiTests.cs
	src/Tests/Indices/IndexSettings/IndexTemplates/PutIndexTemplate/PutIndexTemplateApiTests.cs
	src/Tests/Indices/IndexSettings/UpdateIndicesSettings/UpdateIndexSettingsApiTests.cs
	src/Tests/Indices/MappingManagement/GetFieldMapping/GetFieldMappingApiTests.cs
	src/Tests/Indices/MappingManagement/GetMapping/GetMappingApiTest.cs
	src/Tests/Indices/MappingManagement/PutMapping/PutMappingApiTest.cs
	src/Tests/Indices/Monitoring/IndicesRecovery/RecoveryStatusApiTests.cs
	src/Tests/Indices/Monitoring/IndicesSegments/SegmentsApiTests.cs
	src/Tests/Indices/Monitoring/IndicesShardStores/IndicesShardStoresApiTests.cs
	src/Tests/Indices/Monitoring/IndicesStats/IndicesStatsApiTests.cs
	src/Tests/Indices/StatusManagement/ClearCache/ClearCacheApiTests.cs
	src/Tests/Indices/StatusManagement/Flush/FlushApiTests.cs
	src/Tests/Indices/StatusManagement/ForceMerge/ForceMergeApiTests.cs
	src/Tests/Indices/StatusManagement/Optimize/OptimizeApiTests.cs
	src/Tests/Indices/StatusManagement/Refresh/RefreshApiTests.cs
	src/Tests/Indices/StatusManagement/SyncedFlush/SyncedFushApiTests.cs
	src/Tests/Indices/StatusManagement/Upgrade/UpgradeApiTests.cs
	src/Tests/Indices/Warmers/DeleteWarmer/DeleteWarmerApiTests.cs
	src/Tests/Indices/Warmers/GetWarmer/GetWarmerApiTests.cs
	src/Tests/Indices/Warmers/PutWarmer/PutWarmerApiTests.cs
	src/Tests/Indices/Warmers/WarmerCrudTests.cs
	src/Tests/Mapping/Metafields/MetafieldsMappingApiTestsBase.cs
	src/Tests/Modules/Scripting/DeleteScript/DeleteScriptApiTests.cs
	src/Tests/Modules/Scripting/GetScript/GetScriptApiTests.cs
	src/Tests/Modules/Scripting/PutScript/PutScriptApiTests.cs
	src/Tests/Modules/Scripting/ScriptingCrudTests.cs
	src/Tests/Modules/SnapshotAndRestore/Repositories/CreateRepository/CreateRepositoryApiTests.cs
	src/Tests/Modules/SnapshotAndRestore/Repositories/DeleteRepository/DeleteRepositoryApiTests.cs
	src/Tests/Modules/SnapshotAndRestore/Repositories/GetRepository/GetRepositoryApiTests.cs
	src/Tests/Modules/SnapshotAndRestore/Repositories/RepositoryCrudTests.cs
	src/Tests/Modules/SnapshotAndRestore/Repositories/VerifyRepository/VerifyRepositoryApiTests.cs
	src/Tests/Modules/SnapshotAndRestore/Restore/RestoreApiTests.cs
	src/Tests/Modules/SnapshotAndRestore/Snapshot/DeleteSnapshot/DeleteSnapshotApiTests.cs
	src/Tests/Modules/SnapshotAndRestore/Snapshot/GetSnapshot/GetSnapshotApiTests.cs
	src/Tests/Modules/SnapshotAndRestore/Snapshot/Snapshot/SnapshotApiTests.cs
	src/Tests/Modules/SnapshotAndRestore/Snapshot/SnapshotCrudTests.cs
	src/Tests/Modules/SnapshotAndRestore/Snapshot/SnapshotStatus/SnapshotStatusApiTests.cs
	src/Tests/QueryDsl/BoolDsl/BoolApiTests.cs
	src/Tests/QueryDsl/Geo/Shape/GeoShapeQueryUsageTestsBase.cs
	src/Tests/QueryDsl/QueryDslIntegrationTestsBase.cs
	src/Tests/QueryDsl/QueryDslUsageTestsBase.cs
	src/Tests/QueryDsl/Specialized/Script/ScriptQueryUsageTests.cs
	src/Tests/Reproduce/GithubIssue1863.cs
	src/Tests/Reproduce/GithubIssue2173.cs
	src/Tests/Search/Count/CountApiTests.cs
	src/Tests/Search/Explain/ExplainApiTests.cs
	src/Tests/Search/FieldStats/FieldStatsApiTests.cs
	src/Tests/Search/MultiSearch/MultiSearchApiTests.cs
	src/Tests/Search/MultiSearch/MultiSearchInvalidApiTests.cs
	src/Tests/Search/MultiSearch/MultiSearchLowLevelPostDataTests.cs
	src/Tests/Search/Percolator/MultiPercolate/MultiPercolateApiTests.cs
	src/Tests/Search/Percolator/MultiPercolate/MultiPercolateInvalidApiTests.cs
	src/Tests/Search/Percolator/Percolate/PercolateApiTests.cs
	src/Tests/Search/Percolator/PercolateCount/PercolateCountApiTests.cs
	src/Tests/Search/Percolator/RegisterPercolator/RegisterPercolatorApiTests.cs
	src/Tests/Search/Percolator/UnregisterPercolator/UnregisterPercolatorApiTests.cs
	src/Tests/Search/Request/InnerHitsUsageTests.cs
	src/Tests/Search/Scroll/ClearScroll/ClearScrollApiTests.cs
	src/Tests/Search/Scroll/Scroll/ScrollApiTests.cs
	src/Tests/Search/Search/Rescoring/RescoreUsageTests.cs
	src/Tests/Search/Search/SearchApiTests.cs
	src/Tests/Search/SearchExists/SearchExistsApiTests.cs
	src/Tests/Search/SearchShards/SearchShardsApiTests.cs
	src/Tests/Search/SearchTemplate/DeleteSearchTemplate/DeleteSearchTemplateApiTests.cs
	src/Tests/Search/SearchTemplate/GetSearchTemplate/GetSearchTemplateApiTests.cs
	src/Tests/Search/SearchTemplate/PutSearchTemplate/PutSearchTemplateApiTests.cs
	src/Tests/Search/SearchTemplate/RenderSearchTemplate/RenderSearchTemplateApiTests.cs
	src/Tests/Search/SearchTemplate/SearchTemplateCrudTests.cs
	src/Tests/Search/SearchUsageTestBase.cs
	src/Tests/Search/Suggesters/SuggestApiTests.cs
	src/Tests/Search/Validate/ValidateQueryApiTests.cs
	src/Tests/Tests.csproj
	src/Tests/XPack/Graph/Explore/GraphExploreApiTests.cs
	src/Tests/XPack/License/GetLicense/GetLicenseApiTests.cs
	src/Tests/XPack/License/PostLicense/PostLicenseApiTests.cs
	src/Tests/XPack/Security/Authenticate/AuthenticateApiTests.cs
	src/Tests/XPack/Security/ClearCachedRealms/ClearCachedRealmsApiTests.cs
	src/Tests/XPack/Security/Role/ClearCachedRoles/ClearCachedRolesApiTests.cs
	src/Tests/XPack/Security/Role/PutRole/PutRoleApiTests.cs
	src/Tests/XPack/Security/Role/RoleCrudTests.cs
	src/Tests/XPack/Security/ShieldCluster.cs
	src/Tests/XPack/Security/User/PutUser/PutUserApiTests.cs
	src/Tests/XPack/Security/User/UserCrudTests.cs
	src/Tests/project.json
  • Loading branch information
Mpdreamz committed Aug 19, 2016
1 parent 454c7b7 commit 9a00e6c
Show file tree
Hide file tree
Showing 248 changed files with 1,559 additions and 1,411 deletions.
3 changes: 2 additions & 1 deletion NuGet.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<configuration>
<packageSources>
<add key="Temp DiffPlex Feed" value="https://www.myget.org/F/diffplex-temp/api/v3/index.json" />
<add key="Xunit myget" value="https://www.myget.org/F/xunit/api/v3/index.json" />
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
</packageSources>
</configuration>
</configuration>
8 changes: 6 additions & 2 deletions build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ SET VERSION=
SET ESVERSIONS=
SET SKIPTESTS=0
SET APIKEY=
SET APIKEYPROVIDED="<empty>"
SET FEED="elasticsearch-net"

IF /I "%1"=="skiptests" (
Expand Down Expand Up @@ -50,12 +51,15 @@ IF /I "%1%"=="integrate" (
)

IF /I "%1%"=="canary" (
IF NOT [%2]==[] IF NOT "%2"=="skiptests" set APIKEY="%2"
IF NOT [%2]==[] IF NOT "%2"=="skiptests" (
set APIKEY="%2"
SET APIKEYPROVIDED="<redacted>"
)
IF NOT [%3]==[] IF NOT "%3"=="skiptests" set FEED="%3"
IF /I "%4"=="skiptests" (set SKIPTESTS=1)
IF /I "%3"=="skiptests" (set SKIPTESTS=1)
IF /I "%2"=="skiptests" (set SKIPTESTS=1)
)

ECHO starting build using target=%TARGET% version=%VERSION% esversions=%ESVERSIONS% skiptests=%SKIPTESTS% apiKey=%APIKEY% feed=%FEED%
ECHO starting build using target=%TARGET% version=%VERSION% esversions=%ESVERSIONS% skiptests=%SKIPTESTS% apiKey=%APIKEYPROVIDED% feed=%FEED%
"packages\build\FAKE\tools\Fake.exe" "build\\scripts\\Targets.fsx" "target=%TARGET%" "version=%VERSION%" "esversions=%ESVERSIONS%" "skiptests=%SKIPTESTS%" "apiKey=%APIKEY%" "feed=%FEED%"
2 changes: 1 addition & 1 deletion build/scripts/Targets.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Target "Canary" <| fun _ ->
"QuickCompile"
==> "QuickTest"

"QuickCompile"
"BuildApp"
==> "Integrate"

"Build"
Expand Down
2 changes: 1 addition & 1 deletion build/scripts/Testing.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ module Tests =

for esVersion in esVersions do
setProcessEnvironVar "NEST_INTEGRATION_VERSION" esVersion
testProjectJson "none"
testDesktopClr "all"
9 changes: 7 additions & 2 deletions paket.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ nuget RazorMachine 2.6.1
nuget System.Collections.Immutable

//tests
nuget xunit
nuget FluentAssertions
nuget Bogus
nuget DiffPlex
Expand All @@ -26,11 +25,17 @@ source https://api.nuget.org/v3/index.json

nuget AsciiDocNet

source https://www.myget.org/F/xunit/
nuget xunit 2.2.0-beta3-build3330
nuget xunit.abstractions 2.0.1-rc2

group build

source https://www.nuget.org/api/v2

nuget FAKE
nuget FSharp.Data
nuget GitLink prerelease
nuget xunit.runner.console

source https://www.myget.org/F/xunit/
nuget xunit.runner.console 2.2.0-beta3-build3330
270 changes: 68 additions & 202 deletions paket.lock

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ private static void DefaultCompletedRequestHandler(IApiCallDetails response) { }
Action<IApiCallDetails> _completedRequestHandler = DefaultCompletedRequestHandler;
Action<IApiCallDetails> IConnectionConfigurationValues.OnRequestCompleted => _completedRequestHandler;

private static void DefaultRequestDataCreated(RequestData response) { }
private Action<RequestData> _onRequestDataCreated = DefaultRequestDataCreated;
Action<RequestData> IConnectionConfigurationValues.OnRequestDataCreated => _onRequestDataCreated;

private readonly NameValueCollection _queryString = new NameValueCollection();
NameValueCollection IConnectionConfigurationValues.QueryStringParameters => _queryString;

Expand Down Expand Up @@ -303,6 +307,9 @@ public T PrettyJson(bool b = true) => Assign(a =>
public T OnRequestCompleted(Action<IApiCallDetails> handler) =>
Assign(a => a._completedRequestHandler += handler ?? DefaultCompletedRequestHandler);

public T OnRequestDataCreated(Action<RequestData> handler) =>
Assign(a => a._onRequestDataCreated += handler ?? DefaultRequestDataCreated);

/// <summary>
/// Basic access authentication credentials to specify with all requests.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ public interface IConnectionConfigurationValues : IDisposable
/// </summary>
BasicAuthenticationCredentials BasicAuthenticationCredentials { get; }

Action<RequestData> OnRequestDataCreated { get; }

/// <summary>
/// KeepAliveTime - specifies the timeout, in milliseconds, with no
/// activity until the first keep-alive packet is sent.
Expand Down
2 changes: 1 addition & 1 deletion src/Elasticsearch.Net/Transport/Pipeline/RequestData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private RequestData(
this.HttpCompression = global.EnableHttpCompression;
this.ContentType = local?.ContentType ?? MimeType;
this.Accept = local?.Accept ?? MimeType;
this.Headers = global.Headers;
this.Headers = new NameValueCollection(global.Headers ?? new NameValueCollection());
this.RunAs = local?.RunAs;

this.RequestTimeout = local?.RequestTimeout ?? global.RequestTimeout;
Expand Down
2 changes: 2 additions & 0 deletions src/Elasticsearch.Net/Transport/Transport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public ElasticsearchResponse<TReturn> Request<TReturn>(HttpMethod method, string
pipeline.FirstPoolUsage(this.Settings.BootstrapLock);

var requestData = new RequestData(method, path, data, this.Settings, requestParameters, this.MemoryStreamFactory);
this.Settings.OnRequestDataCreated?.Invoke(requestData);
ElasticsearchResponse<TReturn> response = null;

var seenExceptions = new List<PipelineException>();
Expand Down Expand Up @@ -119,6 +120,7 @@ public async Task<ElasticsearchResponse<TReturn>> RequestAsync<TReturn>(HttpMeth
await pipeline.FirstPoolUsageAsync(this.Settings.BootstrapLock, cancellationToken).ConfigureAwait(false);

var requestData = new RequestData(method, path, data, this.Settings, requestParameters, this.MemoryStreamFactory);
this.Settings.OnRequestDataCreated?.Invoke(requestData);
ElasticsearchResponse<TReturn> response = null;

var seenExceptions = new List<PipelineException>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public interface IDateHistogramAggregation : IBucketAggregation

[JsonProperty("missing")]
DateTime? Missing { get; set; }
}
}

public class DateHistogramAggregation : BucketAggregationBase, IDateHistogramAggregation
{
Expand Down
4 changes: 2 additions & 2 deletions src/Nest/Aggregations/Metric/TopHits/TopHitsAggregation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public TopHitsAggregationDescriptor<T> Sort(Func<SortFieldDescriptor<T>, IFieldS
{
a.Sort = a.Sort ?? new List<ISort>();
var sort = sortSelector?.Invoke(new SortFieldDescriptor<T>());
if (sort != null) a.Sort.Add(sort);
if (sort != null) a.Sort.Add(sort);
});

public TopHitsAggregationDescriptor<T> Source(bool include = true) =>
Expand All @@ -104,7 +104,7 @@ public TopHitsAggregationDescriptor<T> Highlight(Func<HighlightDescriptor<T>, IH
public TopHitsAggregationDescriptor<T> ScriptFields(Func<ScriptFieldsDescriptor, IPromise<IScriptFields>> scriptFieldsSelector) =>
Assign(a => a.ScriptFields = scriptFieldsSelector?.Invoke(new ScriptFieldsDescriptor())?.Value);

public TopHitsAggregationDescriptor<T> FielddataFields(Func<FieldsDescriptor<T>, IPromise<Fields>> fields) =>
public TopHitsAggregationDescriptor<T> FielddataFields(Func<FieldsDescriptor<T>, IPromise<Fields>> fields) =>
Assign(a => a.FielddataFields = fields?.Invoke(new FieldsDescriptor<T>())?.Value);

public TopHitsAggregationDescriptor<T> Version(bool version = true) => Assign(a => a.Version = version);
Expand Down
50 changes: 25 additions & 25 deletions src/Profiling/ColoredConsoleWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,32 @@

namespace Profiling
{
public class ColoredConsoleWriter
{
public void WriteGreen(string value)
{
Write(ConsoleColor.Green, value);
}
public class ColoredConsoleWriter
{
public void WriteGreen(string value)
{
Write(ConsoleColor.Green, value);
}

public void Write(string value)
{
Write(ConsoleColor.White, value);
}
{
Write(ConsoleColor.White, value);
}

public void WriteOrange(string value)
{
Write(ConsoleColor.DarkYellow, value);
}
public void WriteOrange(string value)
{
Write(ConsoleColor.DarkYellow, value);
}

private void Write(ConsoleColor consoleColor, string value)
{
lock (Console.Out)
{
var foregroundColor = Console.ForegroundColor;
Console.ForegroundColor = consoleColor;
Console.WriteLine(value);
Console.ForegroundColor = foregroundColor;
}
}
}
}
private void Write(ConsoleColor consoleColor, string value)
{
lock (Console.Out)
{
var foregroundColor = Console.ForegroundColor;
Console.ForegroundColor = consoleColor;
Console.WriteLine(value);
Console.ForegroundColor = foregroundColor;
}
}
}
}
Loading

0 comments on commit 9a00e6c

Please sign in to comment.