Skip to content

Commit 9d8c1ce

Browse files
committed
Fix failing tasks cancel test, but some setup issues still remain when running in mixed mode
1 parent c016d99 commit 9d8c1ce

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Diff for: src/Tests/Cluster/TaskManagement/TasksCancel/TasksCancelApiTests.cs

+7-5
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
namespace Tests.Cluster.TaskManagement.TasksCancel
1212
{
13+
// TODO Unit tests will fail in mixed mode because SetupTaskIds isn't setup
1314
[Collection(IntegrationContext.OwnIndex)]
1415
public class TasksCancelApiTests : ApiIntegrationTestBase<ITasksCancelResponse, ITasksCancelRequest, TasksCancelDescriptor, TasksCancelRequest>
1516
{
@@ -54,16 +55,17 @@ protected override LazyResponses ClientUsage() => Calls(
5455
protected override bool ExpectIsValid => true;
5556
protected override int ExpectStatusCode => 200;
5657
protected override HttpMethod HttpMethod => HttpMethod.POST;
57-
58-
protected override string UrlPath => $"/_reindex?refresh=true";
59-
58+
protected override string UrlPath => $"/_tasks/{Uri.EscapeDataString(this.TaskId.ToString())}/_cancel";
6059
protected override bool SupportsDeserialization => false;
6160

61+
private TaskId TaskId => TestClient.Configuration.RunIntegrationTests ? this.SetupTaskIds[CallIsolatedValue] : "foo:1";
62+
6263
protected override Func<TasksCancelDescriptor, ITasksCancelRequest> Fluent => d => d
63-
.TaskId(this.SetupTaskIds[CallIsolatedValue]);
64+
.TaskId(this.TaskId);
6465

65-
protected override TasksCancelRequest Initializer => new TasksCancelRequest(this.SetupTaskIds[CallIsolatedValue]);
66+
protected override TasksCancelRequest Initializer => new TasksCancelRequest(this.TaskId);
6667

68+
// TODO this test is flaky, sometimes SetupTaskIds is empty
6769
protected override void ExpectResponse(ITasksCancelResponse response)
6870
{
6971
response.NodeFailures.Should().BeNullOrEmpty();

0 commit comments

Comments
 (0)