Browse Source

fix(CI): Only reset BFP when we changed it

Signed-off-by: Joas Schilling <coding@schilljs.com>
pull/10417/head
Joas Schilling 2 years ago
parent
commit
7af01e70f5
No known key found for this signature in database GPG Key ID: 74434EFE0D2E2205
  1. 12
      tests/integration/features/bootstrap/FeatureContext.php

12
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;
}
}

Loading…
Cancel
Save