Skip to content
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

tests: Simplify logic in Elasticsearch integration tests for skipping non-async methods #2574

Merged
merged 1 commit into from
Jun 26, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,12 @@ protected enum ClientType
const string SyncMethodSkipReason = "Synchronous methods are deprecated in latest Elastic.Clients.Elasticsearch";


protected ElasticsearchTestsBase(TFixture fixture, ITestOutputHelper output, ClientType clientType) : base(fixture)
protected ElasticsearchTestsBase(TFixture fixture, ITestOutputHelper output, ClientType clientType, bool syncMethodsOk = true) : base(fixture)
{
_fixture = fixture;
_fixture.TestLogger = output;
_clientType = clientType;

// non-async methods are deprecated in the latest Elastic.Clients.Elasticsearch versions
if (_clientType != ClientType.ElasticClients ||
(_fixture.GetType() != typeof(ConsoleDynamicMethodFixtureCoreLatest) && _fixture.GetType() != typeof(ConsoleDynamicMethodFixtureFWLatest)))
{
_syncMethodsOk = true;
}
else
{
_syncMethodsOk = false;
}
_syncMethodsOk = syncMethodsOk;

_host = GetHostFromElasticServer(_clientType);

Expand Down Expand Up @@ -340,7 +330,7 @@ public ElasticsearchNetTestsCoreOldest(ConsoleDynamicMethodFixtureCoreOldest fix
public class ElasticsearchElasticClientTestsFWLatest : ElasticsearchTestsBase<ConsoleDynamicMethodFixtureFWLatest>
{
public ElasticsearchElasticClientTestsFWLatest(ConsoleDynamicMethodFixtureFWLatest fixture, ITestOutputHelper output)
: base(fixture, output, ClientType.ElasticClients)
: base(fixture, output, ClientType.ElasticClients, syncMethodsOk : false)
{
}
}
Expand All @@ -358,7 +348,7 @@ public ElasticsearchElasticClientTestsFW462(ConsoleDynamicMethodFixtureFW462 fix
public class ElasticsearchElasticClientTestsCoreLatest : ElasticsearchTestsBase<ConsoleDynamicMethodFixtureCoreLatest>
{
public ElasticsearchElasticClientTestsCoreLatest(ConsoleDynamicMethodFixtureCoreLatest fixture, ITestOutputHelper output)
: base(fixture, output, ClientType.ElasticClients)
: base(fixture, output, ClientType.ElasticClients, syncMethodsOk: false)
{
}
}
Expand Down
Loading