mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-21 12:25:48 +02:00
minor change to restart test
This commit is contained in:
+27
-16
@@ -314,28 +314,39 @@ class EndToEndTestCase(unittest.TestCase):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
k8s.api.custom_objects_api.patch_namespaced_custom_object(
|
|
||||||
"acid.zalan.do", "v1", "default", "postgresqls", "acid-minimal-cluster", pg_patch_max_connections)
|
|
||||||
|
|
||||||
def get_max_connections():
|
try:
|
||||||
|
k8s.api.custom_objects_api.patch_namespaced_custom_object(
|
||||||
|
"acid.zalan.do", "v1", "default", "postgresqls", "acid-minimal-cluster", pg_patch_max_connections)
|
||||||
|
|
||||||
|
def get_max_connections():
|
||||||
|
pods = k8s.api.core_v1.list_namespaced_pod(
|
||||||
|
'default', label_selector=labels).items
|
||||||
|
self.assert_master_is_unique()
|
||||||
|
masterPod = pods[0]
|
||||||
|
get_max_connections_cmd = '''psql -At -U postgres -c "SELECT setting FROM pg_settings WHERE name = 'max_connections';"'''
|
||||||
|
result = k8s.exec_with_kubectl(masterPod.metadata.name, get_max_connections_cmd)
|
||||||
|
max_connections_value = int(result.stdout)
|
||||||
|
return max_connections_value
|
||||||
|
|
||||||
|
#Make sure that max_connections decreased
|
||||||
|
self.eventuallyEqual(get_max_connections, int(new_max_connections_value), "max_connections didn't decrease")
|
||||||
pods = k8s.api.core_v1.list_namespaced_pod(
|
pods = k8s.api.core_v1.list_namespaced_pod(
|
||||||
'default', label_selector=labels).items
|
'default', label_selector=labels).items
|
||||||
self.assert_master_is_unique()
|
self.assert_master_is_unique()
|
||||||
masterPod = pods[0]
|
masterPod = pods[0]
|
||||||
get_max_connections_cmd = '''psql -At -U postgres -c "SELECT setting FROM pg_settings WHERE name = 'max_connections';"'''
|
#Make sure that pod didn't restart
|
||||||
result = k8s.exec_with_kubectl(masterPod.metadata.name, get_max_connections_cmd)
|
self.assertEqual(creationTimestamp, masterPod.metadata.creation_timestamp,
|
||||||
max_connections_value = int(result.stdout)
|
"Master pod creation timestamp is updated")
|
||||||
return max_connections_value
|
|
||||||
|
|
||||||
#Make sure that max_connections decreased
|
except timeout_decorator.TimeoutError:
|
||||||
self.eventuallyEqual(get_max_connections, int(new_max_connections_value), "max_connections didn't decrease")
|
print('Operator log: {}'.format(k8s.get_operator_log()))
|
||||||
pods = k8s.api.core_v1.list_namespaced_pod(
|
raise
|
||||||
'default', label_selector=labels).items
|
|
||||||
self.assert_master_is_unique()
|
# make sure cluster is in a good state for further tests
|
||||||
masterPod = pods[0]
|
self.eventuallyEqual(lambda: k8s.get_operator_state(), {"0": "idle"}, "Operator does not get in sync")
|
||||||
#Make sure that pod didn't restart
|
self.eventuallyEqual(lambda: k8s.count_running_pods(), 2,
|
||||||
self.assertEqual(creationTimestamp, masterPod.metadata.creation_timestamp,
|
"No 2 pods running")
|
||||||
"Master pod creation timestamp is updated")
|
|
||||||
|
|
||||||
@timeout_decorator.timeout(TEST_TIMEOUT_SEC)
|
@timeout_decorator.timeout(TEST_TIMEOUT_SEC)
|
||||||
def test_enable_disable_connection_pooler(self):
|
def test_enable_disable_connection_pooler(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user