|
5 | 5 | from ..testgres.node import PgVer
|
6 | 6 | from ..testgres.node import PostgresNode
|
7 | 7 | from ..testgres.utils import get_pg_version2
|
| 8 | +from ..testgres.utils import get_pg_config2 |
8 | 9 | from ..testgres.utils import file_tail
|
9 | 10 | from ..testgres.utils import get_bin_path2
|
10 | 11 | from ..testgres import ProcessType
|
@@ -1064,6 +1065,31 @@ def test_dump(self, os_ops: OsOperations):
|
1064 | 1065 | res = node3.execute(query_select)
|
1065 | 1066 | assert (res == [(1, ), (2, )])
|
1066 | 1067 |
|
| 1068 | + def test_get_pg_config2(self, os_ops: OsOperations): |
| 1069 | + # check same instances |
| 1070 | + a = get_pg_config2(os_ops, None) |
| 1071 | + b = get_pg_config2(os_ops, None) |
| 1072 | + assert (id(a) == id(b)) |
| 1073 | + |
| 1074 | + # save right before config change |
| 1075 | + c1 = get_pg_config2(os_ops, None) |
| 1076 | + |
| 1077 | + # modify setting for this scope |
| 1078 | + with scoped_config(cache_pg_config=False) as config: |
| 1079 | + # sanity check for value |
| 1080 | + assert not (config.cache_pg_config) |
| 1081 | + |
| 1082 | + # save right after config change |
| 1083 | + c2 = get_pg_config2(os_ops, None) |
| 1084 | + |
| 1085 | + # check different instances after config change |
| 1086 | + assert (id(c1) != id(c2)) |
| 1087 | + |
| 1088 | + # check different instances |
| 1089 | + a = get_pg_config2(os_ops, None) |
| 1090 | + b = get_pg_config2(os_ops, None) |
| 1091 | + assert (id(a) != id(b)) |
| 1092 | + |
1067 | 1093 | @staticmethod
|
1068 | 1094 | def helper__get_node(os_ops: OsOperations, name=None):
|
1069 | 1095 | assert isinstance(os_ops, OsOperations)
|
|
0 commit comments