Skip to content

Skip ENV VAR tests for compatibility header on <7.13.0 and run in intrusive operation cluster #5648

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 1 commit into from
Apr 27, 2021
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
8 changes: 5 additions & 3 deletions tests/Tests/ClientConcepts/Connection/HttpConnectionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
using HttpMethod = Elasticsearch.Net.HttpMethod;
using FluentAssertions;
using System.Text.RegularExpressions;
using Tests.Core.Xunit;
using Environment = System.Environment;

namespace Tests.ClientConcepts.Connection
Expand Down Expand Up @@ -348,11 +349,13 @@ protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage
}
}

public class HttpConnectionEnvironmentalTests : ClusterTestClassBase<ReadOnlyCluster>, IDisposable
// using IntrusiveOperationCluster to avoid affecting other tests with the ENV VAR
[SkipVersion("<7.13.0", "Setting only valid in 7.13.0+")]
public class HttpConnectionEnvironmentalTests : ClusterTestClassBase<IntrusiveOperationCluster>, IDisposable
{
private readonly string _previousEnvironmentVariable;

public HttpConnectionEnvironmentalTests(ReadOnlyCluster cluster) : base(cluster) =>
public HttpConnectionEnvironmentalTests(IntrusiveOperationCluster cluster) : base(cluster) =>
_previousEnvironmentVariable = Environment.GetEnvironmentVariable(ConnectionConfiguration.ApiVersioningEnvironmentVariableName);

[I]
Expand All @@ -366,7 +369,6 @@ public async Task HttpClientSetsApiVersioningHeaderWhenEnabledAsTrue()
responseMessage.RequestMessage.Content.Headers.ContentType.Should().NotBeNull();
var contentType = responseMessage.RequestMessage.Content.Headers.ContentType.ToString();
contentType.Should().Contain("compatible-with");

});

var r = connection.Request<StringResponse>(requestData);
Expand Down