forked from shivagowda/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract common test cluster authentication wiring (elastic#77551)
* Extract common test cluster authentication wiring * Fix imports * Minor polishing * no extension property neeeded * Use common cluster authenticationi * Do not configure distro type in authenticated-cluster plugin Apply review feedback
- Loading branch information
Showing
7 changed files
with
37 additions
and
110 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
build-tools-internal/src/main/groovy/elasticsearch.authenticated-testclusters.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask | ||
|
||
def clusterCredentials = [ | ||
username: providers.systemProperty('tests.rest.cluster.username') | ||
.forUseAtConfigurationTime() | ||
.getOrElse('test_admin'), | ||
password: providers.systemProperty('tests.rest.cluster.password') | ||
.forUseAtConfigurationTime() | ||
.getOrElse('x-pack-test-password') | ||
] | ||
|
||
tasks.withType(StandaloneRestIntegTestTask).configureEach { | ||
systemProperty 'tests.rest.cluster.username', clusterCredentials.username | ||
systemProperty 'tests.rest.cluster.password', clusterCredentials.password | ||
} | ||
|
||
testClusters.all { | ||
setting 'xpack.security.enabled', 'true' | ||
setting 'xpack.license.self_generated.type', 'trial' | ||
user clusterCredentials | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,16 @@ | ||
apply plugin: 'elasticsearch.internal-java-rest-test' | ||
apply plugin: 'elasticsearch.authenticated-testclusters' | ||
|
||
dependencies { | ||
javaRestTestImplementation(testArtifact(project(xpackModule('core')))) | ||
} | ||
|
||
def clusterCredentials = [ | ||
username: providers.systemProperty('tests.rest.cluster.username') | ||
.orElse('test_admin') | ||
.forUseAtConfigurationTime() | ||
.get(), | ||
password: providers.systemProperty('tests.rest.cluster.password') | ||
.orElse('x-pack-test-password') | ||
.forUseAtConfigurationTime() | ||
.get() | ||
] | ||
|
||
tasks.named("javaRestTest").configure { | ||
systemProperty 'tests.rest.cluster.username', clusterCredentials.username | ||
systemProperty 'tests.rest.cluster.password', clusterCredentials.password | ||
} | ||
|
||
testClusters.all { | ||
testDistribution = 'DEFAULT' | ||
setting 'xpack.security.enabled', 'true' | ||
setting 'xpack.watcher.enabled', 'false' | ||
setting 'xpack.watcher.enabled', 'false' | ||
setting 'xpack.ml.enabled', 'false' | ||
setting 'xpack.license.self_generated.type', 'trial' | ||
extraConfigFile 'roles.yml', file('roles.yml') | ||
user clusterCredentials | ||
user username: "test_ilm", password: "x-pack-test-password", role: "ilm" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,13 @@ | ||
import org.elasticsearch.gradle.VersionProperties | ||
|
||
apply plugin: 'elasticsearch.internal-java-rest-test' | ||
apply plugin: 'elasticsearch.authenticated-testclusters' | ||
|
||
dependencies { | ||
javaRestTestImplementation(testArtifact(project(xpackModule('core')))) | ||
} | ||
|
||
def clusterCredentials = [ | ||
username: providers.systemProperty('tests.rest.cluster.username') | ||
.orElse('test_admin') | ||
.forUseAtConfigurationTime() | ||
.get(), | ||
password: providers.systemProperty('tests.rest.cluster.password') | ||
.orElse('x-pack-test-password') | ||
.forUseAtConfigurationTime() | ||
.get() | ||
] | ||
|
||
tasks.named("javaRestTest").configure { | ||
systemProperty 'tests.rest.cluster.username', clusterCredentials.username | ||
systemProperty 'tests.rest.cluster.password', clusterCredentials.password | ||
} | ||
|
||
testClusters.all { | ||
testDistribution = 'DEFAULT' | ||
numberOfNodes = 4 | ||
|
||
setting 'xpack.security.enabled', 'true' | ||
user username: clusterCredentials.username, password: clusterCredentials.password, role: 'superuser' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,15 @@ | ||
apply plugin: 'elasticsearch.internal-java-rest-test' | ||
apply plugin: 'elasticsearch.authenticated-testclusters' | ||
|
||
dependencies { | ||
javaRestTestImplementation(testArtifact(project(xpackModule('core')))) | ||
} | ||
|
||
def clusterCredentials = [ | ||
username: providers.systemProperty('tests.rest.cluster.username') | ||
.orElse('test_admin') | ||
.forUseAtConfigurationTime() | ||
.get(), | ||
password: providers.systemProperty('tests.rest.cluster.password') | ||
.orElse('x-pack-test-password') | ||
.forUseAtConfigurationTime() | ||
.get() | ||
] | ||
|
||
tasks.named("javaRestTest").configure { | ||
systemProperty 'tests.rest.cluster.username', clusterCredentials.username | ||
systemProperty 'tests.rest.cluster.password', clusterCredentials.password | ||
} | ||
|
||
testClusters.all { | ||
testDistribution = 'DEFAULT' | ||
setting 'xpack.security.enabled', 'true' | ||
setting 'xpack.watcher.enabled', 'false' | ||
setting 'xpack.ml.enabled', 'false' | ||
setting 'xpack.license.self_generated.type', 'trial' | ||
extraConfigFile 'roles.yml', file('roles.yml') | ||
user clusterCredentials | ||
user username: "test", password: "x-pack-test-password", role: "test" | ||
} |