diff options
author | Daniil Baturin <daniil@vyos.io> | 2024-03-12 11:32:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-12 11:32:59 +0100 |
commit | aafdc29b444a4ecddadabd883e05b2d193698374 (patch) | |
tree | fed813830ff471a2f9024ba9eeeff61017265caa /smoketest | |
parent | 964234ed47c27145bafbac2642bef7fd5e57c16a (diff) | |
parent | 19fecd46a2980fcf97905aa2485513a6f79271eb (diff) | |
download | vyos-1x-1.4.0-epa2.tar.gz vyos-1x-1.4.0-epa2.zip |
Merge pull request #3122 from HollyGurza/T6020-sagitta1.4.0-epa2
vrrp: T6020: vrrp health-check script not applied correctly in keepal…
Diffstat (limited to 'smoketest')
-rwxr-xr-x | smoketest/scripts/cli/test_high-availability_vrrp.py | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/smoketest/scripts/cli/test_high-availability_vrrp.py b/smoketest/scripts/cli/test_high-availability_vrrp.py index 1bb35e422..9ba06aef6 100755 --- a/smoketest/scripts/cli/test_high-availability_vrrp.py +++ b/smoketest/scripts/cli/test_high-availability_vrrp.py @@ -264,5 +264,58 @@ class TestVRRP(VyOSUnitTestSHIM.TestCase): self.assertIn(f' {peer_address_1}', config) self.assertIn(f' {peer_address_2}', config) + def test_check_health_script(self): + sync_group = 'VyOS' + + for group in groups: + vlan_id = group.lstrip('VLAN') + vip = f'100.64.{vlan_id}.1/24' + group_base = base_path + ['vrrp', 'group', group] + + self.cli_set(['interfaces', 'ethernet', vrrp_interface, 'vif', vlan_id, 'address', inc_ip(vip, 1) + '/' + vip.split('/')[-1]]) + + self.cli_set(group_base + ['interface', f'{vrrp_interface}.{vlan_id}']) + self.cli_set(group_base + ['address', vip]) + self.cli_set(group_base + ['vrid', vlan_id]) + + self.cli_set(group_base + ['health-check', 'ping', '127.0.0.1']) + + # commit changes + self.cli_commit() + + for group in groups: + config = getConfig(f'vrrp_instance {group}') + self.assertIn(f'track_script', config) + + self.cli_set(base_path + ['vrrp', 'sync-group', sync_group, 'member', groups[0]]) + + with self.assertRaises(ConfigSessionError): + self.cli_commit() + + self.cli_delete(base_path + ['vrrp', 'group', groups[0], 'health-check']) + self.cli_commit() + + for group in groups[1:]: + config = getConfig(f'vrrp_instance {group}') + self.assertIn(f'track_script', config) + + config = getConfig(f'vrrp_instance {groups[0]}') + self.assertNotIn(f'track_script', config) + + config = getConfig(f'vrrp_sync_group {sync_group}') + self.assertNotIn(f'track_script', config) + + self.cli_set(base_path + ['vrrp', 'sync-group', sync_group, 'health-check', 'ping', '127.0.0.1']) + + # commit changes + self.cli_commit() + + config = getConfig(f'vrrp_instance {groups[0]}') + self.assertNotIn(f'track_script', config) + + config = getConfig(f'vrrp_sync_group {sync_group}') + self.assertIn(f'track_script', config) + + if __name__ == '__main__': unittest.main(verbosity=2) |