Skip to content

Improve test logger #4445

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

Merged
merged 3 commits into from
Feb 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
trigger:
batch: true
branches:
include:
- master
- "*.x"

pr:
autoCancel: true
branches:
exclude:
- "backport-*"

jobs:
- job: StaleDocs
pool:
Expand Down
2 changes: 1 addition & 1 deletion build/scripts/scripts.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<PackageReference Include="FSharp.Core" Version="4.7.0" />

<PackageReference Include="Bullseye" Version="3.1.0" />
<PackageReference Include="Elastic.Managed" Version="0.1.0-ci20191209T135928" />
<PackageReference Include="Elastic.Managed" Version="0.1.0-ci20200224T155731" />

<PackageReference Include="Fake.Core.Environment" Version="5.15.0" />
<PackageReference Include="Fake.Core.SemVer" Version="5.15.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,63 @@ var myGeoHashGrid = response.Aggregations.GeoHash("my_geohash_grid");
myGeoHashGrid.Should().NotBeNull();
----

==== Fluent DSL example

[source,csharp]
----
a => a
.GeoHash("my_geohash_grid", g => g
.Field(p => p.LocationPoint)
.Bounds(b => b
.TopLeft(90,-180)
.BottomRight(-90, 180)
)
)
----

==== Object Initializer syntax example

[source,csharp]
----
new GeoHashGridAggregation("my_geohash_grid")
{
Field = Field<Project>(p => p.LocationPoint),
Bounds = new BoundingBox
{
TopLeft = new GeoLocation(90, -180),
BottomRight = new GeoLocation(-90, 180)
}
}
----

[source,javascript]
.Example json output
----
{
"my_geohash_grid": {
"geohash_grid": {
"field": "locationPoint",
"bounds": {
"top_left": {
"lat": 90.0,
"lon": -180.0
},
"bottom_right": {
"lat": -90.0,
"lon": 180.0
}
}
}
}
}
----

==== Handling Responses

[source,csharp]
----
response.ShouldBeValid();
var myGeoHashGrid = response.Aggregations.GeoHash("my_geohash_grid");
myGeoHashGrid.Should().NotBeNull();
----

Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ q
new RankFeatureQuery()
{
Name = "named_query",
Boost = 1.1,
Boost = 1.1,
Field = Infer.Field<Project>(f => f.Rank),
Function = new RankFeatureSaturationFunction()
}
Expand All @@ -63,3 +63,39 @@ new RankFeatureQuery()
}
----

==== Fluent DSL example

[source,csharp]
----
q
.RankFeature(rf => rf
.Name("named_query")
.Boost(1.1)
.Field(f => f.Rank)
)
----

==== Object Initializer syntax example

[source,csharp]
----
new RankFeatureQuery
{
Name = "named_query",
Boost = 1.1,
Field = Infer.Field<Project>(f => f.Rank),
}
----

[source,javascript]
.Example json output
----
{
"rank_feature": {
"_name": "named_query",
"boost": 1.1,
"field": "rank"
}
}
----

6 changes: 6 additions & 0 deletions tests/.ci.runsettings
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
<RunConfiguration>
<CollectSourceInformation>true</CollectSourceInformation>
</RunConfiguration>
<LoggerRunSettings>
<Loggers>
<Logger friendlyName="Console" enabled="True"/>
<Logger friendlyName="pretty" enabled="False"/>
</Loggers>
</LoggerRunSettings>
<DataCollectionRunSettings>
<DataCollectors>
<DataCollector friendlyName="XPlat Code Coverage">
Expand Down
10 changes: 0 additions & 10 deletions tests/.runsettings
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,4 @@
<TestRunParameters>
<Parameter name="DisableFullSkipMessages" value=""/>
</TestRunParameters>
<DataCollectionRunSettings>
<DataCollectors>
<DataCollector friendlyName="XPlat Code Coverage">
<Configuration>
<Format>cobertura</Format>
<UseSourceLink>true</UseSourceLink>
</Configuration>
</DataCollector>
</DataCollectors>
</DataCollectionRunSettings>
</RunSettings>
2 changes: 1 addition & 1 deletion tests/Tests.Configuration/Tests.Configuration.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Elastic.Managed" Version="0.1.0-ci20191209T135928" />
<PackageReference Include="Elastic.Managed" Version="0.1.0-ci20200224T155731" />
</ItemGroup>
</Project>
11 changes: 11 additions & 0 deletions tests/Tests.Core/Extensions/ClientExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using Elasticsearch.Net;
using Nest;

namespace Tests.Core.Extensions
{
public static class ClientExtensions
{
public static ClusterHealthResponse WaitForSecurityIndices(this IElasticClient client) =>
client.Cluster.Health(new ClusterHealthRequest(".security-*") { WaitForStatus = WaitForStatus.Green });
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,8 @@ protected virtual ConnectionSettings ConnectionSettings(ConnectionSettings s) =>
protected sealed override void SeedCluster()
{
Client.Cluster.Health(new ClusterHealthRequest { WaitForStatus = WaitForStatus.Green });
Client.Cluster.Health(new ClusterHealthRequest(".security-7") { WaitForStatus = WaitForStatus.Green });
SeedNode();
Client.Cluster.Health(new ClusterHealthRequest { WaitForStatus = WaitForStatus.Green });
Client.Cluster.Health(new ClusterHealthRequest(".security-7") { WaitForStatus = WaitForStatus.Green });
}

protected virtual void SeedNode() => new DefaultSeeder(Client).SeedNode();
Expand Down
2 changes: 1 addition & 1 deletion tests/Tests.Core/Tests.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.1" />
<PackageReference Include="coverlet.collector" Version="1.1.0" />
<PackageReference Include="Elastic.Xunit" Version="0.1.0-ci20191209T135928" />
<PackageReference Include="Elastic.Xunit" Version="0.1.0-ci20200224T155731" />
<PackageReference Include="FluentAssertions" Version="5.7.0" />

<PackageReference Include="DiffPlex" Version="1.4.1" />
Expand Down
2 changes: 1 addition & 1 deletion tests/Tests.Domain/Tests.Domain.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Bogus" Version="22.1.2" />
<PackageReference Include="Elastic.Managed" Version="0.1.0-ci20191209T135928" />
<PackageReference Include="Elastic.Managed" Version="0.1.0-ci20200224T155731" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
<ProjectReference Include="$(SolutionRoot)\tests\Tests.Configuration\Tests.Configuration.csproj" />
</ItemGroup>
Expand Down
Loading