Skip to content

Commit

Permalink
Only download demo certs when integTest run with -Dsecurity.enabled=t…
Browse files Browse the repository at this point in the history
…rue (#737)

* Only download demo certs when integTest run with -Dsecurity.enabled=true

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Make consistent with security.enabled

Signed-off-by: Craig Perkins <cwperx@amazon.com>

---------

Signed-off-by: Craig Perkins <cwperx@amazon.com>
  • Loading branch information
cwperks authored Feb 25, 2025
1 parent fa0f422 commit 740d707
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-with-security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ jobs:
- name: Run Job-scheduler Integ Tests with Security
run: |
echo "Running integ tests with security..."
./gradlew :integTest --tests "*RestIT" -Dhttps=true -Dsecurity=true -Dtests.opensearch.secure=true -Dtests.opensearch.username=admin -Dtests.opensearch.password=admin -Duser=admin -Dpassword=admin
./gradlew :integTest --tests "*RestIT" -Dhttps=true -Dsecurity.enabled=true -Dtests.opensearch.secure=true -Dtests.opensearch.username=admin -Dtests.opensearch.password=admin -Duser=admin -Dpassword=admin
25 changes: 14 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,18 @@ ext {
licenseFile = rootProject.file('LICENSE.txt')
noticeFile = rootProject.file('NOTICE')

['esnode.pem', 'esnode-key.pem', 'kirk.pem', 'kirk-key.pem', 'root-ca.pem', 'sample.pem', 'test-kirk.jks'].forEach { file ->
File local = getLayout().getBuildDirectory().file(file).get().getAsFile()
download.run {
src "https://raw.githubusercontent.com/opensearch-project/security/refs/heads/main/bwc-test/src/test/resources/security/" + file
dest local
overwrite false
}
processResources {
from(local)
runIntegTestWithSecurityPlugin= System.getProperty("security.enabled")
if (runIntegTestWithSecurityPlugin == "true"){
['esnode.pem', 'esnode-key.pem', 'kirk.pem', 'kirk-key.pem', 'root-ca.pem', 'sample.pem', 'test-kirk.jks'].forEach { file ->
File local = getLayout().getBuildDirectory().file(file).get().getAsFile()
download.run {
src "https://raw.githubusercontent.com/opensearch-project/security/refs/heads/main/bwc-test/src/test/resources/security/" + file
dest local
overwrite false
}
processResources {
from(local)
}
}
}
}
Expand Down Expand Up @@ -281,7 +284,7 @@ def securityPluginFile = resolvePluginFile("opensearch-security")

// === Setup security test ===
// This flag indicates the existence of security plugin
def securityEnabled = System.getProperty("security", "false") == "true" || System.getProperty("https", "false") == "true"
def securityEnabled = System.getProperty("security.enabled", "false") == "true" || System.getProperty("https", "false") == "true"
afterEvaluate {
testClusters.integTest.nodes.each { node ->
def plugins = node.plugins
Expand Down Expand Up @@ -360,7 +363,7 @@ task integTestRemote(type: RestIntegTestTask) {
systemProperty 'java.io.tmpdir', opensearch_tmp_dir.absolutePath

systemProperty "https", System.getProperty("https")
systemProperty "security", System.getProperty("security")
systemProperty "security.enabled", System.getProperty("security.enabled")
systemProperty "user", System.getProperty("user")
systemProperty "password", System.getProperty("password")
systemProperty 'tests.rest.cluster', 'localhost:9200'
Expand Down

0 comments on commit 740d707

Please sign in to comment.