Skip to content

Commit ef427c5

Browse files
committed
Build: Add task interdependencies for ssl configuration (#30633)
This commit fixes the tasks creating ssl certs for tests to have correct dependsOn to ensure the right tasks are run before tests run.
1 parent f1073f5 commit ef427c5

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

x-pack/qa/smoke-test-plugins-ssl/build.gradle

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ task exportNodeCertificate(type: LoggedExec) {
105105

106106
// Import the node certificate in the client's keystore
107107
task importNodeCertificateInClientKeyStore(type: LoggedExec) {
108-
dependsOn exportNodeCertificate
108+
dependsOn createClientKeyStore, exportNodeCertificate
109109
executable = new File(project.runtimeJavaHome, 'bin/keytool')
110110
args '-import',
111111
'-alias', 'test-node',
@@ -137,7 +137,7 @@ task exportClientCertificate(type: LoggedExec) {
137137

138138
// Import the client certificate in the node's keystore
139139
task importClientCertificateInNodeKeyStore(type: LoggedExec) {
140-
dependsOn exportClientCertificate
140+
dependsOn createNodeKeyStore, exportClientCertificate
141141
executable = new File(project.runtimeJavaHome, 'bin/keytool')
142142
args '-import',
143143
'-alias', 'test-client',
@@ -153,14 +153,10 @@ forbiddenPatterns {
153153

154154
// Add keystores to test classpath: it expects it there
155155
sourceSets.test.resources.srcDir(keystoreDir)
156-
processTestResources.dependsOn(
157-
createNodeKeyStore, createClientKeyStore,
158-
importNodeCertificateInClientKeyStore, importClientCertificateInNodeKeyStore
159-
)
156+
processTestResources.dependsOn(importNodeCertificateInClientKeyStore, importClientCertificateInNodeKeyStore)
160157

161158
integTestCluster.dependsOn(importClientCertificateInNodeKeyStore, importNodeCertificateInClientKeyStore)
162159

163-
164160
ext.pluginsCount = 0
165161
project(':plugins').getChildProjects().each { pluginName, pluginProject ->
166162
// need to get a non-decorated project object, so must re-lookup the project by path

x-pack/qa/sql/security/ssl/build.gradle

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ task createClientKeyStore(type: LoggedExec) {
7474
// Export the node's certificate
7575
File nodeCertificate = new File(keystoreDir, 'test-node.cert')
7676
task exportNodeCertificate(type: LoggedExec) {
77+
dependsOn createNodeKeyStore
7778
doFirst {
7879
if (nodeCertificate.parentFile.exists() == false) {
7980
nodeCertificate.parentFile.mkdirs()
@@ -92,7 +93,7 @@ task exportNodeCertificate(type: LoggedExec) {
9293

9394
// Import the node certificate in the client's keystore
9495
task importNodeCertificateInClientKeyStore(type: LoggedExec) {
95-
dependsOn exportNodeCertificate
96+
dependsOn createClientKeyStore, exportNodeCertificate
9697
executable = new File(project.runtimeJavaHome, 'bin/keytool')
9798
args '-import',
9899
'-alias', 'test-node',
@@ -105,6 +106,7 @@ task importNodeCertificateInClientKeyStore(type: LoggedExec) {
105106
// Export the client's certificate
106107
File clientCertificate = new File(keystoreDir, 'test-client.cert')
107108
task exportClientCertificate(type: LoggedExec) {
109+
dependsOn createClientKeyStore
108110
doFirst {
109111
if (clientCertificate.parentFile.exists() == false) {
110112
clientCertificate.parentFile.mkdirs()
@@ -123,7 +125,7 @@ task exportClientCertificate(type: LoggedExec) {
123125

124126
// Import the client certificate in the node's keystore
125127
task importClientCertificateInNodeKeyStore(type: LoggedExec) {
126-
dependsOn exportClientCertificate
128+
dependsOn createNodeKeyStore, exportClientCertificate
127129
executable = new File(project.runtimeJavaHome, 'bin/keytool')
128130
args '-import',
129131
'-alias', 'test-client',
@@ -139,10 +141,7 @@ forbiddenPatterns {
139141

140142
// Add keystores to test classpath: it expects it there
141143
sourceSets.test.resources.srcDir(keystoreDir)
142-
processTestResources.dependsOn(
143-
createNodeKeyStore, createClientKeyStore,
144-
importNodeCertificateInClientKeyStore, importClientCertificateInNodeKeyStore
145-
)
144+
processTestResources.dependsOn(importNodeCertificateInClientKeyStore, importClientCertificateInNodeKeyStore)
146145

147146
integTestCluster.dependsOn(importClientCertificateInNodeKeyStore)
148147

0 commit comments

Comments
 (0)