From e1cb078a63441af98f7aa9f877b52753937f9e86 Mon Sep 17 00:00:00 2001 From: Alex Hemsath Date: Tue, 25 Jun 2024 10:33:07 -0700 Subject: [PATCH] Remove wonky logic in favor of a parameter to the test class constructor --- .../Elasticsearch/ElasticsearchTests.cs | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/tests/Agent/IntegrationTests/UnboundedIntegrationTests/Elasticsearch/ElasticsearchTests.cs b/tests/Agent/IntegrationTests/UnboundedIntegrationTests/Elasticsearch/ElasticsearchTests.cs index 73c88b856..0bde7d802 100644 --- a/tests/Agent/IntegrationTests/UnboundedIntegrationTests/Elasticsearch/ElasticsearchTests.cs +++ b/tests/Agent/IntegrationTests/UnboundedIntegrationTests/Elasticsearch/ElasticsearchTests.cs @@ -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); @@ -340,7 +330,7 @@ public ElasticsearchNetTestsCoreOldest(ConsoleDynamicMethodFixtureCoreOldest fix public class ElasticsearchElasticClientTestsFWLatest : ElasticsearchTestsBase { public ElasticsearchElasticClientTestsFWLatest(ConsoleDynamicMethodFixtureFWLatest fixture, ITestOutputHelper output) - : base(fixture, output, ClientType.ElasticClients) + : base(fixture, output, ClientType.ElasticClients, syncMethodsOk : false) { } } @@ -358,7 +348,7 @@ public ElasticsearchElasticClientTestsFW462(ConsoleDynamicMethodFixtureFW462 fix public class ElasticsearchElasticClientTestsCoreLatest : ElasticsearchTestsBase { public ElasticsearchElasticClientTestsCoreLatest(ConsoleDynamicMethodFixtureCoreLatest fixture, ITestOutputHelper output) - : base(fixture, output, ClientType.ElasticClients) + : base(fixture, output, ClientType.ElasticClients, syncMethodsOk: false) { } }