use of org.graylog.shaded.elasticsearch7.org.elasticsearch.common.settings.Settings in project elasticsearch by elastic.
the class EvilLoggerTests method testProperties.
public void testProperties() throws IOException, UserException {
final Settings.Builder builder = Settings.builder().put("cluster.name", randomAsciiOfLength(16));
if (randomBoolean()) {
builder.put("node.name", randomAsciiOfLength(16));
}
final Settings settings = builder.build();
setupLogging("minimal", settings);
assertNotNull(System.getProperty("es.logs.base_path"));
assertThat(System.getProperty("es.logs.cluster_name"), equalTo(ClusterName.CLUSTER_NAME_SETTING.get(settings).value()));
if (Node.NODE_NAME_SETTING.exists(settings)) {
assertThat(System.getProperty("es.logs.node_name"), equalTo(Node.NODE_NAME_SETTING.get(settings)));
} else {
assertNull(System.getProperty("es.logs.node_name"));
}
}
use of org.graylog.shaded.elasticsearch7.org.elasticsearch.common.settings.Settings in project elasticsearch by elastic.
the class NodeEnvironmentEvilTests method testMissingWritePermissionOnIndex.
public void testMissingWritePermissionOnIndex() throws IOException {
assumeTrue("posix filesystem", isPosix);
final String[] tempPaths = tmpPaths();
Path path = PathUtils.get(randomFrom(tempPaths));
Path fooIndex = path.resolve("nodes").resolve("0").resolve(NodeEnvironment.INDICES_FOLDER).resolve("foo");
Files.createDirectories(fooIndex);
try (PosixPermissionsResetter attr = new PosixPermissionsResetter(fooIndex)) {
attr.setPermissions(new HashSet<>(Arrays.asList(PosixFilePermission.OTHERS_READ, PosixFilePermission.GROUP_READ, PosixFilePermission.OWNER_READ)));
Settings build = Settings.builder().put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toAbsolutePath().toString()).putArray(Environment.PATH_DATA_SETTING.getKey(), tempPaths).build();
IOException ioException = expectThrows(IOException.class, () -> {
new NodeEnvironment(build, new Environment(build));
});
assertTrue(ioException.getMessage(), ioException.getMessage().startsWith("failed to write in data directory"));
}
}
use of org.graylog.shaded.elasticsearch7.org.elasticsearch.common.settings.Settings in project elasticsearch by elastic.
the class AwsS3ServiceImplTests method testAwsCredsExplicitConfigSettings.
public void testAwsCredsExplicitConfigSettings() {
Settings repositorySettings = Settings.builder().put(InternalAwsS3Service.CLIENT_NAME.getKey(), "myconfig").build();
MockSecureSettings secureSettings = new MockSecureSettings();
secureSettings.setString("s3.client.myconfig.access_key", "aws_key");
secureSettings.setString("s3.client.myconfig.secret_key", "aws_secret");
secureSettings.setString("s3.client.default.access_key", "wrong_key");
secureSettings.setString("s3.client.default.secret_key", "wrong_secret");
Settings settings = Settings.builder().setSecureSettings(secureSettings).build();
launchAWSCredentialsWithElasticsearchSettingsTest(repositorySettings, settings, "aws_key", "aws_secret");
}
use of org.graylog.shaded.elasticsearch7.org.elasticsearch.common.settings.Settings in project elasticsearch by elastic.
the class AwsS3ServiceImplTests method testAWSConfigurationWithAwsAndS3SettingsBackcompat.
public void testAWSConfigurationWithAwsAndS3SettingsBackcompat() {
Settings settings = Settings.builder().put(AwsS3Service.PROTOCOL_SETTING.getKey(), "http").put(AwsS3Service.PROXY_HOST_SETTING.getKey(), "aws_proxy_host").put(AwsS3Service.PROXY_PORT_SETTING.getKey(), 8080).put(AwsS3Service.PROXY_USERNAME_SETTING.getKey(), "aws_proxy_username").put(AwsS3Service.PROXY_PASSWORD_SETTING.getKey(), "aws_proxy_password").put(AwsS3Service.SIGNER_SETTING.getKey(), "AWS3SignerType").put(AwsS3Service.READ_TIMEOUT.getKey(), "5s").put(AwsS3Service.CLOUD_S3.PROTOCOL_SETTING.getKey(), "https").put(AwsS3Service.CLOUD_S3.PROXY_HOST_SETTING.getKey(), "s3_proxy_host").put(AwsS3Service.CLOUD_S3.PROXY_PORT_SETTING.getKey(), 8081).put(AwsS3Service.CLOUD_S3.PROXY_USERNAME_SETTING.getKey(), "s3_proxy_username").put(AwsS3Service.CLOUD_S3.PROXY_PASSWORD_SETTING.getKey(), "s3_proxy_password").put(AwsS3Service.CLOUD_S3.SIGNER_SETTING.getKey(), "NoOpSignerType").put(AwsS3Service.CLOUD_S3.READ_TIMEOUT.getKey(), "10s").build();
launchAWSConfigurationTest(settings, Settings.EMPTY, Protocol.HTTPS, "s3_proxy_host", 8081, "s3_proxy_username", "s3_proxy_password", "NoOpSignerType", 3, false, 10000);
assertSettingDeprecationsAndWarnings(new Setting<?>[] { AwsS3Service.PROXY_USERNAME_SETTING, AwsS3Service.PROXY_PASSWORD_SETTING, AwsS3Service.PROTOCOL_SETTING, AwsS3Service.PROXY_HOST_SETTING, AwsS3Service.PROXY_PORT_SETTING, AwsS3Service.SIGNER_SETTING, AwsS3Service.READ_TIMEOUT, AwsS3Service.CLOUD_S3.PROXY_USERNAME_SETTING, AwsS3Service.CLOUD_S3.PROXY_PASSWORD_SETTING, AwsS3Service.CLOUD_S3.PROTOCOL_SETTING, AwsS3Service.CLOUD_S3.PROXY_HOST_SETTING, AwsS3Service.CLOUD_S3.PROXY_PORT_SETTING, AwsS3Service.CLOUD_S3.SIGNER_SETTING, AwsS3Service.CLOUD_S3.READ_TIMEOUT });
}
use of org.graylog.shaded.elasticsearch7.org.elasticsearch.common.settings.Settings in project elasticsearch by elastic.
the class AwsS3ServiceImplTests method testRepositoryMaxRetries.
public void testRepositoryMaxRetries() {
Settings repositorySettings = generateRepositorySettings(null, null, null, 20);
Settings settings = Settings.builder().put(S3Repository.Repositories.MAX_RETRIES_SETTING.getKey(), 10).build();
launchAWSConfigurationTest(settings, repositorySettings, Protocol.HTTPS, null, -1, null, null, null, 20, false, 50000);
}
Aggregations