|
1 | | -/* |
2 | | - * Licensed to Elasticsearch under one or more contributor |
3 | | - * license agreements. See the NOTICE file distributed with |
4 | | - * this work for additional information regarding copyright |
5 | | - * ownership. Elasticsearch licenses this file to you under |
6 | | - * the Apache License, Version 2.0 (the "License"); you may |
7 | | - * not use this file except in compliance with the License. |
8 | | - * You may obtain a copy of the License at |
9 | | - * |
10 | | - * http://www.apache.org/licenses/LICENSE-2.0 |
11 | | - * |
12 | | - * Unless required by applicable law or agreed to in writing, |
13 | | - * software distributed under the License is distributed on an |
14 | | - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
15 | | - * KIND, either express or implied. See the License for the |
16 | | - * specific language governing permissions and limitations |
17 | | - * under the License. |
18 | | - */ |
19 | | -package org.elasticsearch.upgrades; |
20 | | - |
21 | | -import org.elasticsearch.Version; |
22 | | -import org.elasticsearch.common.settings.Settings; |
23 | | -import org.elasticsearch.test.rest.ESRestTestCase; |
24 | | - |
25 | | -public abstract class AbstractRollingTestCase extends ESRestTestCase { |
26 | | - protected enum ClusterType { |
27 | | - OLD, |
28 | | - MIXED, |
29 | | - UPGRADED; |
30 | | - |
31 | | - public static ClusterType parse(String value) { |
32 | | - switch (value) { |
33 | | - case "old_cluster": |
34 | | - return OLD; |
35 | | - case "mixed_cluster": |
36 | | - return MIXED; |
37 | | - case "upgraded_cluster": |
38 | | - return UPGRADED; |
39 | | - default: |
40 | | - throw new AssertionError("unknown cluster type: " + value); |
41 | | - } |
42 | | - } |
43 | | - } |
44 | | - |
45 | | - protected static final ClusterType CLUSTER_TYPE = ClusterType.parse(System.getProperty("tests.rest.suite")); |
46 | | - protected static final Version UPGRADE_FROM_VERSION = Version.fromString(System.getProperty("tests.upgrade_from_version")); |
47 | | - protected static final boolean firstMixedRound = Boolean.parseBoolean(System.getProperty("tests.first_round", "false")); |
48 | | - |
49 | | - @Override |
50 | | - protected final boolean preserveIndicesUponCompletion() { |
51 | | - return true; |
52 | | - } |
53 | | - |
54 | | - @Override |
55 | | - protected final boolean preserveReposUponCompletion() { |
56 | | - return true; |
57 | | - } |
58 | | - |
59 | | - @Override |
60 | | - protected final Settings restClientSettings() { |
61 | | - return Settings.builder().put(super.restClientSettings()) |
62 | | - // increase the timeout here to 90 seconds to handle long waits for a green |
63 | | - // cluster health. the waits for green need to be longer than a minute to |
64 | | - // account for delayed shards |
65 | | - .put(ESRestTestCase.CLIENT_SOCKET_TIMEOUT, "90s") |
66 | | - .build(); |
67 | | - } |
68 | | -} |
| 1 | +/* |
| 2 | + * Licensed to Elasticsearch under one or more contributor |
| 3 | + * license agreements. See the NOTICE file distributed with |
| 4 | + * this work for additional information regarding copyright |
| 5 | + * ownership. Elasticsearch licenses this file to you under |
| 6 | + * the Apache License, Version 2.0 (the "License"); you may |
| 7 | + * not use this file except in compliance with the License. |
| 8 | + * You may obtain a copy of the License at |
| 9 | + * |
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + * |
| 12 | + * Unless required by applicable law or agreed to in writing, |
| 13 | + * software distributed under the License is distributed on an |
| 14 | + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | + * KIND, either express or implied. See the License for the |
| 16 | + * specific language governing permissions and limitations |
| 17 | + * under the License. |
| 18 | + */ |
| 19 | +package org.elasticsearch.upgrades; |
| 20 | + |
| 21 | +import org.elasticsearch.Version; |
| 22 | +import org.elasticsearch.common.settings.Settings; |
| 23 | +import org.elasticsearch.test.rest.ESRestTestCase; |
| 24 | + |
| 25 | +public abstract class AbstractRollingTestCase extends ESRestTestCase { |
| 26 | + protected enum ClusterType { |
| 27 | + OLD, |
| 28 | + MIXED, |
| 29 | + UPGRADED; |
| 30 | + |
| 31 | + public static ClusterType parse(String value) { |
| 32 | + switch (value) { |
| 33 | + case "old_cluster": |
| 34 | + return OLD; |
| 35 | + case "mixed_cluster": |
| 36 | + return MIXED; |
| 37 | + case "upgraded_cluster": |
| 38 | + return UPGRADED; |
| 39 | + default: |
| 40 | + throw new AssertionError("unknown cluster type: " + value); |
| 41 | + } |
| 42 | + } |
| 43 | + } |
| 44 | + |
| 45 | + protected static final ClusterType CLUSTER_TYPE = ClusterType.parse(System.getProperty("tests.rest.suite")); |
| 46 | + protected static final Version UPGRADE_FROM_VERSION = Version.fromString(System.getProperty("tests.upgrade_from_version")); |
| 47 | + protected static final boolean firstMixedRound = Boolean.parseBoolean(System.getProperty("tests.first_round", "false")); |
| 48 | + |
| 49 | + @Override |
| 50 | + protected final boolean preserveIndicesUponCompletion() { |
| 51 | + return true; |
| 52 | + } |
| 53 | + |
| 54 | + @Override |
| 55 | + protected final boolean preserveReposUponCompletion() { |
| 56 | + return true; |
| 57 | + } |
| 58 | + |
| 59 | + @Override |
| 60 | + protected final Settings restClientSettings() { |
| 61 | + return Settings.builder().put(super.restClientSettings()) |
| 62 | + // increase the timeout here to 90 seconds to handle long waits for a green |
| 63 | + // cluster health. the waits for green need to be longer than a minute to |
| 64 | + // account for delayed shards |
| 65 | + .put(ESRestTestCase.CLIENT_SOCKET_TIMEOUT, "90s") |
| 66 | + .build(); |
| 67 | + } |
| 68 | +} |
0 commit comments