From 7af01e70f530afbce2ef8712490a0964a3e7ae9b Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 30 Aug 2023 07:57:15 +0200 Subject: fix(CI): Only reset BFP when we changed it Signed-off-by: Joas Schilling --- tests/integration/features/bootstrap/FeatureContext.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php index 21fb9edda..2ef66eefa 100644 --- a/tests/integration/features/bootstrap/FeatureContext.php +++ b/tests/integration/features/bootstrap/FeatureContext.php @@ -106,6 +106,8 @@ class FeatureContext implements Context, SnippetAcceptingContext { /** @var array */ protected array $changedConfigs = []; + protected bool $changedBruteforceSetting = false; + private ?SharingContext $sharingContext; private ?bool $guestsAppWasEnabled = null; @@ -2972,7 +2974,9 @@ class FeatureContext implements Context, SnippetAcceptingContext { } $this->setCurrentUser($currentUser); - $this->enableDisableBruteForceProtection('disable'); + if ($this->changedBruteforceSetting) { + $this->enableDisableBruteForceProtection('disable'); + } } /** @@ -3038,7 +3042,9 @@ class FeatureContext implements Context, SnippetAcceptingContext { * @Given /^(enable|disable) brute force protection$/ */ public function enableDisableBruteForceProtection(string $enable): void { - if ($enable === 'disable') { + if ($enable === 'enable') { + $this->changedBruteforceSetting = true; + } else { // Reset the attempts before disabling $this->runOcc(['security:bruteforce:reset', '127.0.0.1']); $this->theCommandWasSuccessful(); @@ -3064,6 +3070,8 @@ class FeatureContext implements Context, SnippetAcceptingContext { $this->theCommandWasSuccessful(); $this->runOcc(['security:bruteforce:reset', '::1']); $this->theCommandWasSuccessful(); + } else { + $this->changedBruteforceSetting = false; } } -- cgit v1.2.3