|
10 | 10 |
|
11 | 11 | namespace Tests.XPack.Migration.MigrationUpgrade |
12 | 12 | { |
13 | | - [SkipVersion(">=6.3.0", "Not running on latest version")] |
| 13 | + [SkipVersion("<6.3.0", "Not running on latest version")] |
14 | 14 | public class InvalidMigrationUpgradeApiTests |
15 | 15 | : ApiIntegrationTestBase<XPackCluster, IMigrationUpgradeResponse, IMigrationUpgradeRequest, MigrationUpgradeDescriptor, |
16 | 16 | MigrationUpgradeRequest> |
17 | 17 | { |
18 | | - private const string Index = ".watches"; |
19 | | - |
20 | 18 | public InvalidMigrationUpgradeApiTests(XPackCluster cluster, EndpointUsage usage) |
21 | 19 | : base(cluster, usage) { } |
22 | 20 |
|
23 | 21 | protected override bool ExpectIsValid => false; |
24 | 22 |
|
25 | 23 | protected override object ExpectJson => null; |
26 | | - protected override int ExpectStatusCode => 400; |
| 24 | + protected override int ExpectStatusCode => 500; |
27 | 25 |
|
28 | 26 | protected override Func<MigrationUpgradeDescriptor, IMigrationUpgradeRequest> Fluent => f => f; |
29 | 27 | protected override HttpMethod HttpMethod => HttpMethod.POST; |
30 | 28 |
|
31 | | - protected override MigrationUpgradeRequest Initializer => new MigrationUpgradeRequest(Index); |
| 29 | + protected override MigrationUpgradeRequest Initializer => new MigrationUpgradeRequest(CallIsolatedValue); |
32 | 30 |
|
33 | | - protected override string UrlPath => $"/_xpack/migration/upgrade/{Index}"; |
| 31 | + protected override string UrlPath => $"/_xpack/migration/upgrade/{CallIsolatedValue}"; |
34 | 32 |
|
35 | 33 | 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), |
38 | 36 | (c, r) => c.MigrationUpgrade(r), |
39 | 37 | (c, r) => c.MigrationUpgradeAsync(r) |
40 | 38 | ); |
41 | 39 |
|
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 | + } |
43 | 52 |
|
44 | 53 | protected override void ExpectResponse(IMigrationUpgradeResponse response) |
45 | 54 | { |
46 | 55 | response.ShouldNotBeValid(); |
47 | | - response.ServerError.Should().BeNull(); |
| 56 | + response.ServerError.Should().NotBeNull(); |
| 57 | + response.ServerError.Status.Should().Be(500); |
48 | 58 | } |
49 | 59 | } |
50 | 60 | } |
0 commit comments