|
42 | 42 | import java.util.stream.Stream; |
43 | 43 |
|
44 | 44 | import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; |
| 45 | +import static org.hamcrest.Matchers.anyOf; |
45 | 46 | import static org.hamcrest.Matchers.equalTo; |
46 | 47 |
|
47 | 48 | public class SnapshotsInProgressSerializationTests extends AbstractDiffableWireSerializationTestCase<Custom> { |
@@ -398,17 +399,31 @@ public void testXContent() throws IOException { |
398 | 399 | String json = Strings.toString(builder); |
399 | 400 | assertThat( |
400 | 401 | json, |
401 | | - equalTo( |
402 | | - "{\"snapshots\":[{\"repository\":\"repo\",\"snapshot\":\"name\",\"uuid\":\"uuid\"," |
403 | | - + "\"include_global_state\":true,\"partial\":true,\"state\":\"SUCCESS\"," |
404 | | - + "\"indices\":[{\"name\":\"index\",\"id\":\"uuid\"}],\"start_time\":\"1970-01-01T00:20:34.567Z\"," |
405 | | - + "\"start_time_millis\":1234567,\"repository_state_id\":0,\"shards\":[" |
406 | | - + "{\"index\":{\"index_name\":\"index\",\"index_uuid\":\"uuid\"},\"shard\":0,\"state\":\"SUCCESS\"," |
407 | | - + "\"generation\":\"shardgen\",\"node\":\"nodeId\"," |
408 | | - + "\"result\":{\"generation\":\"shardgen\",\"size\":\"1b\",\"size_in_bytes\":1,\"segments\":1}}," |
409 | | - + "{\"index\":{\"index_name\":\"index\",\"index_uuid\":\"uuid\"},\"shard\":1,\"state\":\"FAILED\"," |
410 | | - + "\"generation\":\"fail-gen\",\"node\":\"nodeId\",\"reason\":\"failure-reason\"}" |
411 | | - + "],\"feature_states\":[],\"data_streams\":[]}]}" |
| 402 | + anyOf( |
| 403 | + equalTo( |
| 404 | + "{\"snapshots\":[{\"repository\":\"repo\",\"snapshot\":\"name\",\"uuid\":\"uuid\"," |
| 405 | + + "\"include_global_state\":true,\"partial\":true,\"state\":\"SUCCESS\"," |
| 406 | + + "\"indices\":[{\"name\":\"index\",\"id\":\"uuid\"}],\"start_time\":\"1970-01-01T00:20:34.567Z\"," |
| 407 | + + "\"start_time_millis\":1234567,\"repository_state_id\":0,\"shards\":[" |
| 408 | + + "{\"index\":{\"index_name\":\"index\",\"index_uuid\":\"uuid\"},\"shard\":0,\"state\":\"SUCCESS\"," |
| 409 | + + "\"generation\":\"shardgen\",\"node\":\"nodeId\"," |
| 410 | + + "\"result\":{\"generation\":\"shardgen\",\"size\":\"1b\",\"size_in_bytes\":1,\"segments\":1}}," |
| 411 | + + "{\"index\":{\"index_name\":\"index\",\"index_uuid\":\"uuid\"},\"shard\":1,\"state\":\"FAILED\"," |
| 412 | + + "\"generation\":\"fail-gen\",\"node\":\"nodeId\",\"reason\":\"failure-reason\"}" |
| 413 | + + "],\"feature_states\":[],\"data_streams\":[]}]}" |
| 414 | + ), // or the shards might be in the other order: |
| 415 | + equalTo( |
| 416 | + "{\"snapshots\":[{\"repository\":\"repo\",\"snapshot\":\"name\",\"uuid\":\"uuid\"," |
| 417 | + + "\"include_global_state\":true,\"partial\":true,\"state\":\"SUCCESS\"," |
| 418 | + + "\"indices\":[{\"name\":\"index\",\"id\":\"uuid\"}],\"start_time\":\"1970-01-01T00:20:34.567Z\"," |
| 419 | + + "\"start_time_millis\":1234567,\"repository_state_id\":0,\"shards\":[" |
| 420 | + + "{\"index\":{\"index_name\":\"index\",\"index_uuid\":\"uuid\"},\"shard\":1,\"state\":\"FAILED\"," |
| 421 | + + "\"generation\":\"fail-gen\",\"node\":\"nodeId\",\"reason\":\"failure-reason\"}," |
| 422 | + + "{\"index\":{\"index_name\":\"index\",\"index_uuid\":\"uuid\"},\"shard\":0,\"state\":\"SUCCESS\"," |
| 423 | + + "\"generation\":\"shardgen\",\"node\":\"nodeId\"," |
| 424 | + + "\"result\":{\"generation\":\"shardgen\",\"size\":\"1b\",\"size_in_bytes\":1,\"segments\":1}}" |
| 425 | + + "],\"feature_states\":[],\"data_streams\":[]}]}" |
| 426 | + ) |
412 | 427 | ) |
413 | 428 | ); |
414 | 429 | } |
|
0 commit comments