mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-25 14:53:37 +00:00
+8
-2
@@ -1,10 +1,11 @@
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from patroni.exceptions import PatroniException
|
||||
from patroni.utils import enable_keepalive, get_major_version, get_postgres_version, \
|
||||
polling_loop, Retry, RetryFailedError, unquote, validate_directory
|
||||
from patroni.utils import apply_keepalive_limit, enable_keepalive, get_major_version, \
|
||||
get_postgres_version, polling_loop, Retry, RetryFailedError, unquote, validate_directory
|
||||
|
||||
|
||||
class TestUtils(unittest.TestCase):
|
||||
@@ -43,6 +44,11 @@ class TestUtils(unittest.TestCase):
|
||||
with patch('sys.platform', platform):
|
||||
self.assertIsNone(enable_keepalive(Mock(), 10, 5))
|
||||
|
||||
def test_apply_keepalive_limit(self):
|
||||
for platform in ('linux2', 'darwin'):
|
||||
with patch('sys.platform', platform):
|
||||
self.assertLess(apply_keepalive_limit('TCP_KEEPIDLE', sys.maxsize), sys.maxsize)
|
||||
|
||||
def test_unquote(self):
|
||||
self.assertEqual(unquote('value'), 'value')
|
||||
self.assertEqual(unquote('value with spaces'), "value with spaces")
|
||||
|
||||
Reference in New Issue
Block a user