Skip to content

Commit ff9b8c4

Browse files
test: add retries to time sensitive tests
1 parent 7856ef2 commit ff9b8c4

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ namespace RESTAPI\Tests;
55
use RESTAPI\Core\Auth;
66
use RESTAPI\Core\Command;
77
use RESTAPI\Core\TestCase;
8+
use RESTAPI\Core\TestCaseRetry;
89
use RESTAPI\Models\FirewallRule;
910
use RESTAPI\Models\FirewallSchedule;
1011
use RESTAPI\Models\RoutingGateway;
@@ -817,6 +818,7 @@ class APIModelsFirewallRuleTestCase extends TestCase {
817818
/**
818819
* Checks that a rule with a TrafficShaperLimiter object assigned to dnpipe is correctly represented in pfctl.
819820
*/
821+
#[TestCaseRetry(retries: 3, delay: 2)]
820822
public function test_dnpipe_as_limiter_in_pfctl(): void {
821823
# Create a limiter and rule to test with
822824
$limiter = new TrafficShaperLimiter(

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ namespace RESTAPI\Tests;
44

55
use RESTAPI\Core\Command;
66
use RESTAPI\Core\TestCase;
7+
use RESTAPI\Core\TestCaseRetry;
78
use RESTAPI\Models\CARP;
89
use RESTAPI\Models\Table;
910
use RESTAPI\Models\VirtualIP;
@@ -38,6 +39,7 @@ class APIModelsTableTestCase extends TestCase {
3839
/**
3940
* Checks that we can successfully retrieve the list of available table names.
4041
*/
42+
#[TestCaseRetry(retries: 3, delay: 1)]
4143
public function test_get_available_table_names(): void {
4244
# Create a new pf table to test with
4345
$this->add_table(table_name: 'pfrest_test_table', entries: ['1.2.3.4']);
@@ -62,6 +64,7 @@ class APIModelsTableTestCase extends TestCase {
6264
/**
6365
* Checks that we can successfully read entries from a table
6466
*/
67+
#[TestCaseRetry(retries: 3, delay: 1)]
6568
public function test_read(): void {
6669
# Create a new pf table to test with
6770
$this->add_table(table_name: 'pfrest_test_table', entries: ['1.2.3.4', '4.3.2.1']);

0 commit comments

Comments
 (0)