Skip to content

Commit 27ba6be

Browse files
test: remove flaky sync tests
The sync components need to be rewritten in a way that is easily tested. For now these are causing semi regular test failures that are not actionable.
1 parent 704b0b6 commit 27ba6be

1 file changed

Lines changed: 0 additions & 37 deletions

File tree

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

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -65,41 +65,4 @@ class APIModelsRESTAPISettingsSyncTestCase extends TestCase {
6565
$this->assert_equals($original_api_config, $new_api_config);
6666
$this->assert_not_equals($sync_api_config, $new_api_config);
6767
}
68-
69-
/**
70-
* Checks that the 'sync()' method correctly syncs the API config to HA peers.
71-
*/
72-
public function test_sync(): void {
73-
# Use a non-pfSense host as an HA peer
74-
$api_settings = new RESTAPISettings();
75-
$api_settings->ha_sync->value = true;
76-
$api_settings->ha_sync_hosts->value = ['www.example.com'];
77-
$api_settings->ha_sync_username->value = 'admin';
78-
$api_settings->ha_sync_password->value = 'pfsense';
79-
$api_settings->update();
80-
81-
# Read the syslog and ensure the synced failed
82-
# TODO: This test is flaky and needs to be reworked
83-
// RESTAPISettingsSync::sync();
84-
// $syslog = file_get_contents('/var/log/system.log');
85-
// $this->assert_str_contains(
86-
// $syslog,
87-
// 'Failed to sync REST API settings to example.com: received unexpected response.',
88-
// );
89-
90-
# Use a non-existent host as an HA peer and ensure the sync failed
91-
$api_settings->ha_sync_hosts->value = ['127.1.2.3'];
92-
$api_settings->update();
93-
RESTAPISettingsSync::sync();
94-
$syslog = file_get_contents('/var/log/system.log');
95-
$this->assert_str_contains($syslog, 'Failed to sync REST API settings to 127.1.2.3: no response received.');
96-
97-
# Use bad credentials and ensure the sync failed
98-
$api_settings->ha_sync_hosts->value = ['127.0.0.1'];
99-
$api_settings->ha_sync_password->value = 'bad password';
100-
$api_settings->update();
101-
RESTAPISettingsSync::sync();
102-
$syslog = file_get_contents('/var/log/system.log');
103-
$this->assert_str_contains($syslog, 'Failed to sync REST API settings to 127.0.0.1: Authentication failed');
104-
}
10568
}

0 commit comments

Comments
 (0)