Skip to content

Commit df209f9

Browse files
committed
Use CallIsolatedValue for OpaqueId header
1 parent 936835d commit df209f9

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/Tests/Tests/Search/Search/SearchApiTests.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -359,8 +359,6 @@ protected override void ExpectResponse(ISearchResponse<Project> response)
359359
[SkipVersion("<6.2.0", "OpaqueId introduced in 6.2.0")]
360360
public class OpaqueIdApiTests : ApiIntegrationTestBase<ReadOnlyCluster, ISearchResponse<Project>, ISearchRequest, SearchDescriptor<Project>, SearchRequest<Project>>
361361
{
362-
private const string OpaqueId = "123456";
363-
364362
public OpaqueIdApiTests(ReadOnlyCluster cluster, EndpointUsage usage) : base(cluster, usage) { }
365363

366364
protected override object ExpectJson => new { };
@@ -371,15 +369,14 @@ public OpaqueIdApiTests(ReadOnlyCluster cluster, EndpointUsage usage) : base(clu
371369
protected override string UrlPath => $"/project/doc/_search?scroll=10m";
372370

373371
protected override Func<SearchDescriptor<Project>, ISearchRequest> Fluent => s => s
374-
.RequestConfiguration(r => r.OpaqueId(OpaqueId))
375-
.Query(q => q)
372+
.RequestConfiguration(r => r.OpaqueId(CallIsolatedValue))
376373
.Scroll("10m"); // Create a scroll in order to keep the task around.
377374

378375
protected override SearchRequest<Project> Initializer => new SearchRequest<Project>()
379376
{
380377
RequestConfiguration = new RequestConfiguration
381378
{
382-
OpaqueId = OpaqueId
379+
OpaqueId = CallIsolatedValue
383380
},
384381
Scroll = "10m"
385382
};
@@ -393,16 +390,16 @@ protected override LazyResponses ClientUsage() => Calls(
393390

394391
protected override void OnAfterCall(IElasticClient client)
395392
{
396-
var tasks = client.ListTasks(d => d.RequestConfiguration(r => r.OpaqueId(OpaqueId)));
393+
var tasks = client.ListTasks(d => d.RequestConfiguration(r => r.OpaqueId(CallIsolatedValue)));
397394
tasks.Should().NotBeNull();
398395
foreach (var node in tasks.Nodes)
399396
{
400397
foreach (var task in node.Value.Tasks)
401398
{
402-
task.Value.Headers[RequestData.OpaqueIdHeader].Should().Be(OpaqueId);
399+
task.Value.Headers.Should().NotBeNull().And.NotBeEmpty();
400+
task.Value.Headers[RequestData.OpaqueIdHeader].Should().Be(CallIsolatedValue, $"OpaqueId {CallIsolatedValue} not found for task id {task.Key}");
403401
}
404402
}
405-
base.OnAfterCall(client);
406403
}
407404

408405
protected override void ExpectResponse(ISearchResponse<Project> response)

0 commit comments

Comments
 (0)