Skip to content
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
6 changes: 1 addition & 5 deletions tests/Tests/Cluster/NodesStats/NodesStatsApiTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,7 @@ protected void Assert(ProcessStats process)

protected void Assert(ScriptStats script) => script.Should().NotBeNull();

protected void Assert(ScriptCacheStats scriptCache)
{
scriptCache.Should().NotBeNull();
scriptCache.Sum.Should().NotBeNull();
}
protected void Assert(ScriptCacheStats scriptCache) => scriptCache?.Sum.Should().NotBeNull();

protected void Assert(TransportStats transport) => transport.Should().NotBeNull();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information

using System;
using System;
using System.Collections.Generic;
using System.Linq;
using Elasticsearch.Net;
Expand Down Expand Up @@ -211,7 +211,6 @@ protected override void ExpectResponse(DeleteByQueryResponse response)
var failure = response.Failures.First();

failure.Index.Should().NotBeNullOrWhiteSpace();
failure.Type.Should().NotBeNullOrWhiteSpace();
failure.Status.Should().Be(409);
failure.Id.Should().NotBeNullOrWhiteSpace();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information

using System;
using System;
using System.Linq;
using Elastic.Elasticsearch.Xunit.XunitPlumbing;
using Elasticsearch.Net;
Expand Down Expand Up @@ -194,7 +194,6 @@ protected override void ExpectResponse(UpdateByQueryResponse response)
var failure = response.Failures.First();

failure.Index.Should().NotBeNullOrWhiteSpace();
failure.Type.Should().NotBeNullOrWhiteSpace();
failure.Status.Should().Be(409);
failure.Id.Should().NotBeNullOrWhiteSpace();

Expand Down
3 changes: 0 additions & 3 deletions tests/Tests/Mapping/Types/Core/Binary/BinaryPropertyTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public BinaryPropertyTests(WritableCluster cluster, EndpointUsage usage) : base(
{
type = "binary",
doc_values = true,
similarity = "BM25",
store = true
}
}
Expand All @@ -32,7 +31,6 @@ public BinaryPropertyTests(WritableCluster cluster, EndpointUsage usage) : base(
.Binary(b => b
.Name(p => p.Name)
.DocValues()
.Similarity("BM25")
.Store()
);

Expand All @@ -42,7 +40,6 @@ public BinaryPropertyTests(WritableCluster cluster, EndpointUsage usage) : base(
"name", new BinaryProperty
{
DocValues = true,
Similarity = "BM25",
Store = true
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public BooleanPropertyTests(WritableCluster cluster, EndpointUsage usage) : base
type = "boolean",
boost = 1.3,
doc_values = false,
similarity = "BM25",
store = true,
index = false,
null_value = false,
Expand All @@ -36,7 +35,6 @@ public BooleanPropertyTests(WritableCluster cluster, EndpointUsage usage) : base
.Name(p => p.Name)
.Boost(1.3)
.DocValues(false)
.Similarity("BM25")
.Store()
.Index(false)
.NullValue(false)
Expand All @@ -49,7 +47,6 @@ public BooleanPropertyTests(WritableCluster cluster, EndpointUsage usage) : base
{
DocValues = false,
Boost = 1.3,
Similarity = "BM25",
Store = true,
Index = false,
NullValue = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ protected override void IntegrationSetup(IElasticClient client, CallUniqueValues
}
}

protected override void IntegrationTeardown(IElasticClient client, CallUniqueValues values)
{
foreach (var callUniqueValue in values)
{
CloseJob(client, callUniqueValue.Value + "-job");
DeleteJob(client, callUniqueValue.Value + "-job");
}
}

protected override LazyResponses ClientUsage() => Calls(
(client, f) => client.MachineLearning.DeleteForecast(CallIsolatedValue + "-job", CallIsolatedValue),
(client, f) => client.MachineLearning.DeleteForecastAsync(CallIsolatedValue + "-job", CallIsolatedValue),
Expand Down
10 changes: 10 additions & 0 deletions tests/Tests/XPack/MachineLearning/GetJobs/GetJobsApiTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ protected override void IntegrationSetup(IElasticClient client, CallUniqueValues
foreach (var callUniqueValue in values) PutJob(client, callUniqueValue.Value);
}

protected override void IntegrationTeardown(IElasticClient client, CallUniqueValues values)
{
foreach (var callUniqueValue in values) DeleteJob(client, callUniqueValue.Value);
}

protected override LazyResponses ClientUsage() => Calls(
(client, f) => client.MachineLearning.GetJobs(f),
(client, f) => client.MachineLearning.GetJobsAsync(f),
Expand Down Expand Up @@ -90,6 +95,11 @@ protected override void IntegrationSetup(IElasticClient client, CallUniqueValues
foreach (var callUniqueValue in values) PutJob(client, callUniqueValue.Value);
}

protected override void IntegrationTeardown(IElasticClient client, CallUniqueValues values)
{
foreach (var callUniqueValue in values) DeleteJob(client, callUniqueValue.Value);
}

protected override LazyResponses ClientUsage() => Calls(
(client, f) => client.MachineLearning.GetJobs(f),
(client, f) => client.MachineLearning.GetJobsAsync(f),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Elasticsearch.Net;
using FluentAssertions;
using Nest;
using Tests.Core.Client;
using Tests.Core.Extensions;
using Tests.Framework.EndpointTests;
using Tests.Framework.EndpointTests.TestState;
Expand Down Expand Up @@ -69,8 +70,18 @@ public InvalidateUserAccessTokenBadPasswordApiTests(Security cluster, EndpointUs
protected override string CurrentAccessToken => "bad_password";

protected override bool ExpectIsValid => false;
protected override int ExpectStatusCode => 401;
protected override int ExpectStatusCode => TestClient.Configuration.InRange("<7.8.0") ? 401 : 404;

protected override void ExpectResponse(InvalidateUserAccessTokenResponse response) => response.ServerError.Should().NotBeNull();
protected override void ExpectResponse(InvalidateUserAccessTokenResponse response)
{
if (TestClient.Configuration.InRange("<7.8.0"))
response.ServerError.Should().NotBeNull();
else
{
response.InvalidatedTokens.Should().BeGreaterOrEqualTo(0);
response.PreviouslyInvalidatedTokens.Should().BeGreaterOrEqualTo(0);
response.ErrorCount.Should().BeGreaterOrEqualTo(0);
}
}
}
}
8 changes: 4 additions & 4 deletions tests/Tests/XPack/Transform/TransformApiTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ public TransformApiTests(WritableCluster cluster, EndpointUsage usage) : base(ne
{
StopTransformStep, u =>
u.Calls<StopTransformDescriptor, StopTransformRequest, IStopTransformRequest, StopTransformResponse>(
v => new StopTransformRequest(v) { Force = true, WaitForCompletion = true },
(v, d) => d.Force().WaitForCompletion(),
v => new StopTransformRequest(v) { Force = true, WaitForCompletion = true, Timeout = "2m"},
(v, d) => d.Force().WaitForCompletion().Timeout("2m"),
(v, c, f) => c.Transform.Stop(v, f),
(v, c, f) => c.Transform.StopAsync(v, f),
(v, c, r) => c.Transform.Stop(r),
Expand All @@ -244,8 +244,8 @@ public TransformApiTests(WritableCluster cluster, EndpointUsage usage) : base(ne
{
DeleteTransformStep, u =>
u.Calls<DeleteTransformDescriptor, DeleteTransformRequest, IDeleteTransformRequest, DeleteTransformResponse>(
v => new DeleteTransformRequest(v),
(v, d) => d,
v => new DeleteTransformRequest(v) { Force = true },
(v, d) => d.Force(),
(v, c, f) => c.Transform.Delete(v, f),
(v, c, f) => c.Transform.DeleteAsync(v, f),
(v, c, r) => c.Transform.Delete(r),
Expand Down