[TEST] fix method clashes due to randomTimeValue addition to ESTestCase
Original commit: elastic/x-pack-elasticsearch@74bd522bf8
This commit is contained in:
parent
dd8ce6017b
commit
22edda4044
|
@ -43,7 +43,7 @@ public class MarvelSettingTests extends ESTestCase {
|
||||||
String description = randomAsciiOfLength(20);
|
String description = randomAsciiOfLength(20);
|
||||||
TimeValue defaultValue = null;
|
TimeValue defaultValue = null;
|
||||||
if (randomBoolean()) {
|
if (randomBoolean()) {
|
||||||
defaultValue = randomTimeValue();
|
defaultValue = randomParsedTimeValue();
|
||||||
}
|
}
|
||||||
boolean dynamic = randomBoolean();
|
boolean dynamic = randomBoolean();
|
||||||
|
|
||||||
|
@ -59,11 +59,11 @@ public class MarvelSettingTests extends ESTestCase {
|
||||||
setting.onRefresh(settingsBuilder().put(name, 15000L).build());
|
setting.onRefresh(settingsBuilder().put(name, 15000L).build());
|
||||||
assertThat(setting.getValue().millis(), equalTo(15000L));
|
assertThat(setting.getValue().millis(), equalTo(15000L));
|
||||||
|
|
||||||
TimeValue updated = randomTimeValue();
|
TimeValue updated = randomParsedTimeValue();
|
||||||
setting.onRefresh(settingsBuilder().put(name, updated.toString()).build());
|
setting.onRefresh(settingsBuilder().put(name, updated.toString()).build());
|
||||||
assertThat(setting.getValue().millis(), equalTo(updated.millis()));
|
assertThat(setting.getValue().millis(), equalTo(updated.millis()));
|
||||||
|
|
||||||
updated = randomTimeValue();
|
updated = randomParsedTimeValue();
|
||||||
setting.onRefresh(settingsBuilder().put(name, updated.toString()).build());
|
setting.onRefresh(settingsBuilder().put(name, updated.toString()).build());
|
||||||
assertThat(setting.getValue().millis(), equalTo(updated.millis()));
|
assertThat(setting.getValue().millis(), equalTo(updated.millis()));
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ public class MarvelSettingTests extends ESTestCase {
|
||||||
assertArrayEquals(setting.getValue(), updated);
|
assertArrayEquals(setting.getValue(), updated);
|
||||||
}
|
}
|
||||||
|
|
||||||
private TimeValue randomTimeValue() {
|
private TimeValue randomParsedTimeValue() {
|
||||||
return TimeValue.parseTimeValue(randomFrom("10ms", "1.5s", "1.5m", "1.5h", "1.5d", "1000d"), null, getClass().getSimpleName() + ".unit");
|
return TimeValue.parseTimeValue(randomFrom("10ms", "1.5s", "1.5m", "1.5h", "1.5d", "1000d"), null, getClass().getSimpleName() + ".unit");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,13 +24,13 @@ import static org.hamcrest.Matchers.*;
|
||||||
@ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST, numDataNodes = 1)
|
@ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST, numDataNodes = 1)
|
||||||
public class MarvelSettingsTests extends ESIntegTestCase {
|
public class MarvelSettingsTests extends ESIntegTestCase {
|
||||||
|
|
||||||
private final TimeValue startUp = randomTimeValue();
|
private final TimeValue startUp = randomParsedTimeValue();
|
||||||
private final TimeValue interval = randomTimeValue();
|
private final TimeValue interval = randomParsedTimeValue();
|
||||||
private final TimeValue indexStatsTimeout = randomTimeValue();
|
private final TimeValue indexStatsTimeout = randomParsedTimeValue();
|
||||||
private final String[] indices = randomStringArray();
|
private final String[] indices = randomStringArray();
|
||||||
private final TimeValue clusterStateTimeout = randomTimeValue();
|
private final TimeValue clusterStateTimeout = randomParsedTimeValue();
|
||||||
private final TimeValue clusterStatsTimeout = randomTimeValue();
|
private final TimeValue clusterStatsTimeout = randomParsedTimeValue();
|
||||||
private final TimeValue recoveryTimeout = randomTimeValue();
|
private final TimeValue recoveryTimeout = randomParsedTimeValue();
|
||||||
private final Boolean recoveryActiveOnly = randomBoolean();
|
private final Boolean recoveryActiveOnly = randomBoolean();
|
||||||
private final String[] collectors = randomStringArray();
|
private final String[] collectors = randomStringArray();
|
||||||
private final TimeValue licenseGracePeriod = randomExpirationDelay();
|
private final TimeValue licenseGracePeriod = randomExpirationDelay();
|
||||||
|
@ -99,7 +99,7 @@ public class MarvelSettingsTests extends ESIntegTestCase {
|
||||||
Object updated = null;
|
Object updated = null;
|
||||||
Settings.Builder transientSettings = Settings.builder();
|
Settings.Builder transientSettings = Settings.builder();
|
||||||
if (setting instanceof MarvelSetting.TimeValueSetting) {
|
if (setting instanceof MarvelSetting.TimeValueSetting) {
|
||||||
updated = randomTimeValue();
|
updated = randomParsedTimeValue();
|
||||||
transientSettings.put(setting.getName(), updated);
|
transientSettings.put(setting.getName(), updated);
|
||||||
|
|
||||||
} else if (setting instanceof MarvelSetting.BooleanSetting) {
|
} else if (setting instanceof MarvelSetting.BooleanSetting) {
|
||||||
|
@ -156,7 +156,7 @@ public class MarvelSettingsTests extends ESIntegTestCase {
|
||||||
return requestBuilder;
|
return requestBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
private TimeValue randomTimeValue() {
|
private TimeValue randomParsedTimeValue() {
|
||||||
return TimeValue.parseTimeValue(randomFrom("30m", "1h", "3h", "5h", "7h", "10h", "1d"), null, getClass().getSimpleName());
|
return TimeValue.parseTimeValue(randomFrom("30m", "1h", "3h", "5h", "7h", "10h", "1d"), null, getClass().getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,6 +171,6 @@ public class MarvelSettingsTests extends ESIntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
private TimeValue randomExpirationDelay() {
|
private TimeValue randomExpirationDelay() {
|
||||||
return randomBoolean() ? randomTimeValue() : TimeValue.timeValueHours(randomIntBetween(-10, 10) * 24);
|
return randomBoolean() ? randomParsedTimeValue() : TimeValue.timeValueHours(randomIntBetween(-10, 10) * 24);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue