Skip to content

Commit 5524e7a

Browse files
test: revert pf retries in dnpipe test
1 parent 6057b64 commit 5524e7a

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Tests/APIModelsFirewallRuleTestCase.inc

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@ use RESTAPI\Responses\ServerError;
1616
class APIModelsFirewallRuleTestCase extends TestCase {
1717
/**
1818
* Reads the active ruleset directly from pfctl.
19-
* @param string|null $needle If provided, ensures this string is found in the pfctl output before returning.
20-
* @return Command The Command object containing the pfctl output.
2119
*/
22-
public function read_pfctl_rules(?string $needle = null): Command {
20+
public function read_pfctl_rules(): Command {
2321
# Keywords that indicate pf is not ready yet
2422
$not_ready_keywords = ['pfctl: DIOCGETRULE: Device busy', 'pfctl: DIOCGETRULENV: Device busy'];
2523

@@ -30,9 +28,9 @@ class APIModelsFirewallRuleTestCase extends TestCase {
3028
$cmd = new Command('/sbin/pfctl -sr');
3129
$ready = true;
3230

33-
foreach ($not_ready_keywords as $kw) {
31+
foreach ($not_ready_keywords as $keyword) {
3432
# pf is not ready if any of the keywords are found in the output
35-
if (str_contains($cmd->output, $kw) or $needle and !str_contains($cmd->output, $needle)) {
33+
if (str_contains($cmd->output, $keyword)) {
3634
$ready = false;
3735
$attempt++;
3836
sleep(1);
@@ -835,7 +833,7 @@ class APIModelsFirewallRuleTestCase extends TestCase {
835833
$rule->create(apply: true);
836834

837835
# Ensure the dnpipe is correctly represented
838-
$pfctl = $this->read_pfctl_rules(needle: $rule->tracker->value);
836+
$pfctl = $this->read_pfctl_rules();
839837
$this->assert_str_contains(
840838
$pfctl->output,
841839
"ridentifier {$rule->tracker->value} dnpipe {$limiter->number->value}",
@@ -984,4 +982,4 @@ class APIModelsFirewallRuleTestCase extends TestCase {
984982
$this->assert_equals($rule->updated_by->value, "$client->username@$client->ip_address (API)");
985983
}
986984
}
987-
}
985+
}

0 commit comments

Comments
 (0)