Skip to content

Commit d59113a

Browse files
committed
fix invalid upgrade api tests
1 parent e26bd0b commit d59113a

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

src/Tests/Tests/XPack/Migration/MigrationUpgrade/InvalidMigrationUpgradeApiTests.cs

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,41 +10,51 @@
1010

1111
namespace Tests.XPack.Migration.MigrationUpgrade
1212
{
13-
[SkipVersion(">=6.3.0", "Not running on latest version")]
13+
[SkipVersion("<6.3.0", "Not running on latest version")]
1414
public class InvalidMigrationUpgradeApiTests
1515
: ApiIntegrationTestBase<XPackCluster, IMigrationUpgradeResponse, IMigrationUpgradeRequest, MigrationUpgradeDescriptor,
1616
MigrationUpgradeRequest>
1717
{
18-
private const string Index = ".watches";
19-
2018
public InvalidMigrationUpgradeApiTests(XPackCluster cluster, EndpointUsage usage)
2119
: base(cluster, usage) { }
2220

2321
protected override bool ExpectIsValid => false;
2422

2523
protected override object ExpectJson => null;
26-
protected override int ExpectStatusCode => 400;
24+
protected override int ExpectStatusCode => 500;
2725

2826
protected override Func<MigrationUpgradeDescriptor, IMigrationUpgradeRequest> Fluent => f => f;
2927
protected override HttpMethod HttpMethod => HttpMethod.POST;
3028

31-
protected override MigrationUpgradeRequest Initializer => new MigrationUpgradeRequest(Index);
29+
protected override MigrationUpgradeRequest Initializer => new MigrationUpgradeRequest(CallIsolatedValue);
3230

33-
protected override string UrlPath => $"/_xpack/migration/upgrade/{Index}";
31+
protected override string UrlPath => $"/_xpack/migration/upgrade/{CallIsolatedValue}";
3432

3533
protected override LazyResponses ClientUsage() => Calls(
36-
(c, f) => c.MigrationUpgrade(Index, f),
37-
(c, f) => c.MigrationUpgradeAsync(Index, f),
34+
(c, f) => c.MigrationUpgrade(CallIsolatedValue, f),
35+
(c, f) => c.MigrationUpgradeAsync(CallIsolatedValue, f),
3836
(c, r) => c.MigrationUpgrade(r),
3937
(c, r) => c.MigrationUpgradeAsync(r)
4038
);
4139

42-
protected override MigrationUpgradeDescriptor NewDescriptor() => new MigrationUpgradeDescriptor(Index);
40+
protected override MigrationUpgradeDescriptor NewDescriptor() => new MigrationUpgradeDescriptor(CallIsolatedValue);
41+
42+
protected override void IntegrationSetup(IElasticClient client, CallUniqueValues values)
43+
{
44+
foreach (var (k, v) in values)
45+
client.CreateIndex(v);
46+
}
47+
protected override void IntegrationTeardown(IElasticClient client, CallUniqueValues values)
48+
{
49+
foreach (var (k, v) in values)
50+
client.DeleteIndex(v);
51+
}
4352

4453
protected override void ExpectResponse(IMigrationUpgradeResponse response)
4554
{
4655
response.ShouldNotBeValid();
47-
response.ServerError.Should().BeNull();
56+
response.ServerError.Should().NotBeNull();
57+
response.ServerError.Status.Should().Be(500);
4858
}
4959
}
5060
}

0 commit comments

Comments
 (0)