@@ -28,7 +28,7 @@ import tech.beshu.ror.tools.RorTools.Result
28
28
import tech .beshu .ror .tools .core .patches .base .EsPatchMetadataCodec
29
29
import tech .beshu .ror .tools .core .patches .internal .FilePatch .FilePatchMetadata
30
30
import tech .beshu .ror .tools .core .patches .internal .RorPluginDirectory .EsPatchMetadata
31
- import tech .beshu .ror .tools .core .utils .{OsRawEnvVariablesProvider , RawEnvVariablesProvider , InOut }
31
+ import tech .beshu .ror .tools .core .utils .{InOut , OsRawEnvVariablesProvider , RawEnvVariablesProvider }
32
32
import tech .beshu .ror .tools .utils .{CapturingOutputAndMockingInput , ExampleEsWithRorContainer }
33
33
import tech .beshu .ror .utils .files .FileUtils
34
34
@@ -165,6 +165,18 @@ class RorToolsAppSuite
165
165
|""" .stripMargin
166
166
)
167
167
}
168
+ " Patching not started when user declines to accept implications of patching (when env variable is set and arg is passed in the same time)" in {
169
+ val (result, output) = captureResultAndOutput(
170
+ RorToolsTestApp .run(Array (" patch" , " --I_UNDERSTAND_AND_ACCEPT_ES_PATCHING" , " no" ))(_, _),
171
+ mockedEnvs = Map (" I_UNDERSTAND_AND_ACCEPT_ES_PATCHING" -> " no" )
172
+ )
173
+ result should equal(Result .Failure )
174
+ output should equal(
175
+ """ You have to confirm, that You understand the implications of ES patching in order to perform it.
176
+ |You can read about patching in our documentation: https://docs.readonlyrest.com/elasticsearch#id-3.-patch-elasticsearch.
177
+ |""" .stripMargin
178
+ )
179
+ }
168
180
" Patching not started when user declines to accept implications of patching (in interactive mode)" in {
169
181
val (result, output) = captureResultAndOutputWithInteraction(
170
182
RorToolsTestApp .run(Array (" patch" ))(_, _),
@@ -336,7 +348,6 @@ class RorToolsAppSuite
336
348
.stripMargin
337
349
)
338
350
}
339
-
340
351
" The patch is not detected when metadata file is missing and `verify` command is executed" in {
341
352
val (patchResult, patchOutput) = captureResultAndOutput {
342
353
RorToolsTestApp .run(Array (" patch" , " --I_UNDERSTAND_AND_ACCEPT_ES_PATCHING" , " yes" , " --es-path" , esLocalPath.toString))(_, _)
@@ -368,7 +379,6 @@ class RorToolsAppSuite
368
379
| """ .stripMargin
369
380
)
370
381
}
371
-
372
382
" The patch is not detected when metadata file is missing and `verify` command is executed (ES 9.x with detailed assertions)" excludeES(allEs6x, allEs7x, allEs8x) in {
373
383
val (patchResult, patchOutput) = captureResultAndOutput {
374
384
RorToolsTestApp .run(Array (" patch" , " --I_UNDERSTAND_AND_ACCEPT_ES_PATCHING" , " yes" , " --es-path" , esLocalPath.toString))(_, _)
0 commit comments