@@ -28,7 +28,7 @@ import tech.beshu.ror.tools.RorTools.Result
2828import  tech .beshu .ror .tools .core .patches .base .EsPatchMetadataCodec 
2929import  tech .beshu .ror .tools .core .patches .internal .FilePatch .FilePatchMetadata 
3030import  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 }
3232import  tech .beshu .ror .tools .utils .{CapturingOutputAndMockingInput , ExampleEsWithRorContainer }
3333import  tech .beshu .ror .utils .files .FileUtils 
3434
@@ -165,6 +165,18 @@ class RorToolsAppSuite
165165          |"""  .stripMargin
166166      )
167167    }
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+     }
168180    " Patching not started when user declines to accept implications of patching (in interactive mode)"   in {
169181      val  (result, output) =  captureResultAndOutputWithInteraction(
170182        RorToolsTestApp .run(Array (" patch"  ))(_, _),
@@ -336,7 +348,6 @@ class RorToolsAppSuite
336348          .stripMargin
337349      )
338350    }
339- 
340351    " The patch is not detected when metadata file is missing and `verify` command is executed"   in {
341352      val  (patchResult, patchOutput) =  captureResultAndOutput {
342353        RorToolsTestApp .run(Array (" patch"  , " --I_UNDERSTAND_AND_ACCEPT_ES_PATCHING"  , " yes"  , " --es-path"  , esLocalPath.toString))(_, _)
@@ -368,7 +379,6 @@ class RorToolsAppSuite
368379           | """ .stripMargin
369380      )
370381    }
371- 
372382    " 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 {
373383      val  (patchResult, patchOutput) =  captureResultAndOutput {
374384        RorToolsTestApp .run(Array (" patch"  , " --I_UNDERSTAND_AND_ACCEPT_ES_PATCHING"  , " yes"  , " --es-path"  , esLocalPath.toString))(_, _)
0 commit comments