Skip to content

Commit 7f590ea

Browse files
committed
more diversity
1 parent 164dd3a commit 7f590ea

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

server/src/test/java/org/elasticsearch/cluster/settings/ClusterSettingsIT.java

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,14 @@
2929
import org.elasticsearch.common.settings.Setting;
3030
import org.elasticsearch.common.settings.Settings;
3131
import org.elasticsearch.common.unit.ByteSizeUnit;
32+
import org.elasticsearch.common.unit.TimeValue;
3233
import org.elasticsearch.indices.recovery.RecoverySettings;
3334
import org.elasticsearch.test.ESIntegTestCase;
3435
import org.junit.After;
3536

3637
import java.util.Arrays;
3738

38-
import static org.elasticsearch.cluster.routing.allocation.decider.ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_RECOVERIES_SETTING;
39+
import static org.elasticsearch.cluster.routing.allocation.DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL_SETTING;
3940
import static org.elasticsearch.cluster.routing.allocation.decider.ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_INITIAL_PRIMARIES_RECOVERIES_SETTING;
4041
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
4142
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertBlocked;
@@ -69,35 +70,35 @@ public void testClusterNonExistingSettingsUpdate() {
6970

7071
public void testDeleteIsAppliedFirst() {
7172
final Setting<Integer> INITIAL_RECOVERIES = CLUSTER_ROUTING_ALLOCATION_NODE_INITIAL_PRIMARIES_RECOVERIES_SETTING;
72-
final Setting<Integer> CONCURRENT_RECOVERIES = CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_RECOVERIES_SETTING;
73+
final Setting<TimeValue> REROUTE_INTERVAL = CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL_SETTING;
7374

7475
ClusterUpdateSettingsResponse response = client().admin().cluster()
7576
.prepareUpdateSettings()
7677
.setTransientSettings(Settings.builder()
7778
.put(INITIAL_RECOVERIES.getKey(), 7)
78-
.put(CONCURRENT_RECOVERIES.getKey(), 42).build())
79+
.put(REROUTE_INTERVAL.getKey(), "42s").build())
7980
.get();
8081

8182
assertAcked(response);
8283
assertThat(INITIAL_RECOVERIES.get(response.getTransientSettings()), equalTo(7));
8384
assertThat(clusterService().getClusterSettings().get(INITIAL_RECOVERIES), equalTo(7));
84-
assertThat(CONCURRENT_RECOVERIES.get(response.getTransientSettings()), equalTo(42));
85-
assertThat(clusterService().getClusterSettings().get(CONCURRENT_RECOVERIES), equalTo(42));
85+
assertThat(REROUTE_INTERVAL.get(response.getTransientSettings()), equalTo(TimeValue.timeValueSeconds(42)));
86+
assertThat(clusterService().getClusterSettings().get(REROUTE_INTERVAL), equalTo(TimeValue.timeValueSeconds(42)));
8687

8788
response = client().admin().cluster()
8889
.prepareUpdateSettings()
8990
.setTransientSettings(Settings.builder().putNull((randomBoolean() ? "cluster.routing.*" : "*"))
90-
.put(CONCURRENT_RECOVERIES.getKey(), 43))
91+
.put(REROUTE_INTERVAL.getKey(), "43s"))
9192
.get();
9293
assertThat(INITIAL_RECOVERIES.get(response.getTransientSettings()), equalTo(INITIAL_RECOVERIES.get(Settings.EMPTY)));
9394
assertThat(clusterService().getClusterSettings().get(INITIAL_RECOVERIES), equalTo(INITIAL_RECOVERIES.get(Settings.EMPTY)));
94-
assertThat(CONCURRENT_RECOVERIES.get(response.getTransientSettings()), equalTo(43));
95-
assertThat(clusterService().getClusterSettings().get(CONCURRENT_RECOVERIES), equalTo(43));
95+
assertThat(REROUTE_INTERVAL.get(response.getTransientSettings()), equalTo(TimeValue.timeValueSeconds(43)));
96+
assertThat(clusterService().getClusterSettings().get(REROUTE_INTERVAL), equalTo(TimeValue.timeValueSeconds(43)));
9697
}
9798

9899
public void testResetClusterSetting() {
99100
final Setting<Integer> INITIAL_RECOVERIES = CLUSTER_ROUTING_ALLOCATION_NODE_INITIAL_PRIMARIES_RECOVERIES_SETTING;
100-
final Setting<Integer> CONCURRENT_RECOVIERS = CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_RECOVERIES_SETTING;
101+
final Setting<TimeValue> REROUTE_INTERVAL = CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL_SETTING;
101102

102103
ClusterUpdateSettingsResponse response = client().admin().cluster()
103104
.prepareUpdateSettings()
@@ -122,23 +123,23 @@ public void testResetClusterSetting() {
122123
.prepareUpdateSettings()
123124
.setTransientSettings(Settings.builder()
124125
.put(INITIAL_RECOVERIES.getKey(), 8)
125-
.put(CONCURRENT_RECOVIERS.getKey(), 43).build())
126+
.put(REROUTE_INTERVAL.getKey(), "43s").build())
126127
.get();
127128

128129
assertAcked(response);
129130
assertThat(INITIAL_RECOVERIES.get(response.getTransientSettings()), equalTo(8));
130131
assertThat(clusterService().getClusterSettings().get(INITIAL_RECOVERIES), equalTo(8));
131-
assertThat(CONCURRENT_RECOVIERS.get(response.getTransientSettings()), equalTo(43));
132-
assertThat(clusterService().getClusterSettings().get(CONCURRENT_RECOVIERS), equalTo(43));
132+
assertThat(REROUTE_INTERVAL.get(response.getTransientSettings()), equalTo(TimeValue.timeValueSeconds(43)));
133+
assertThat(clusterService().getClusterSettings().get(REROUTE_INTERVAL), equalTo(TimeValue.timeValueSeconds(43)));
133134
response = client().admin().cluster()
134135
.prepareUpdateSettings()
135136
.setTransientSettings(Settings.builder().putNull((randomBoolean() ? "cluster.routing.*" : "*")))
136137
.get();
137138

138139
assertThat(INITIAL_RECOVERIES.get(response.getTransientSettings()), equalTo(INITIAL_RECOVERIES.get(Settings.EMPTY)));
139140
assertThat(clusterService().getClusterSettings().get(INITIAL_RECOVERIES), equalTo(INITIAL_RECOVERIES.get(Settings.EMPTY)));
140-
assertThat(CONCURRENT_RECOVIERS.get(response.getTransientSettings()), equalTo(CONCURRENT_RECOVIERS.get(Settings.EMPTY)));
141-
assertThat(clusterService().getClusterSettings().get(CONCURRENT_RECOVIERS), equalTo(CONCURRENT_RECOVIERS.get(Settings.EMPTY)));
141+
assertThat(REROUTE_INTERVAL.get(response.getTransientSettings()), equalTo(REROUTE_INTERVAL.get(Settings.EMPTY)));
142+
assertThat(clusterService().getClusterSettings().get(REROUTE_INTERVAL), equalTo(REROUTE_INTERVAL.get(Settings.EMPTY)));
142143

143144
// now persistent
144145
response = client().admin().cluster()
@@ -163,23 +164,23 @@ public void testResetClusterSetting() {
163164
.prepareUpdateSettings()
164165
.setPersistentSettings(Settings.builder()
165166
.put(INITIAL_RECOVERIES.getKey(), 10)
166-
.put(CONCURRENT_RECOVIERS.getKey(), 44).build())
167+
.put(REROUTE_INTERVAL.getKey(), "44s").build())
167168
.get();
168169

169170
assertAcked(response);
170171
assertThat(INITIAL_RECOVERIES.get(response.getPersistentSettings()), equalTo(10));
171172
assertThat(clusterService().getClusterSettings().get(INITIAL_RECOVERIES), equalTo(10));
172-
assertThat(CONCURRENT_RECOVIERS.get(response.getPersistentSettings()), equalTo(44));
173-
assertThat(clusterService().getClusterSettings().get(CONCURRENT_RECOVIERS), equalTo(44));
173+
assertThat(REROUTE_INTERVAL.get(response.getPersistentSettings()), equalTo(TimeValue.timeValueSeconds(44)));
174+
assertThat(clusterService().getClusterSettings().get(REROUTE_INTERVAL), equalTo(TimeValue.timeValueSeconds(44)));
174175
response = client().admin().cluster()
175176
.prepareUpdateSettings()
176177
.setPersistentSettings(Settings.builder().putNull((randomBoolean() ? "cluster.routing.*" : "*")))
177178
.get();
178179

179180
assertThat(INITIAL_RECOVERIES.get(response.getPersistentSettings()), equalTo(INITIAL_RECOVERIES.get(Settings.EMPTY)));
180181
assertThat(clusterService().getClusterSettings().get(INITIAL_RECOVERIES), equalTo(INITIAL_RECOVERIES.get(Settings.EMPTY)));
181-
assertThat(CONCURRENT_RECOVIERS.get(response.getPersistentSettings()), equalTo(CONCURRENT_RECOVIERS.get(Settings.EMPTY)));
182-
assertThat(clusterService().getClusterSettings().get(CONCURRENT_RECOVIERS), equalTo(CONCURRENT_RECOVIERS.get(Settings.EMPTY)));
182+
assertThat(REROUTE_INTERVAL.get(response.getPersistentSettings()), equalTo(REROUTE_INTERVAL.get(Settings.EMPTY)));
183+
assertThat(clusterService().getClusterSettings().get(REROUTE_INTERVAL), equalTo(REROUTE_INTERVAL.get(Settings.EMPTY)));
183184
}
184185

185186
public void testClusterSettingsUpdateResponse() {

0 commit comments

Comments
 (0)