@@ -94,8 +94,16 @@ def test_init_after_cleanup(self):
9494 @unittest .skipUnless (util_exists ('pg_resetwal' ), 'might be missing' )
9595 @unittest .skipUnless (pg_version_ge ('9.6' ), 'query works on 9.6+' )
9696 def test_init_unique_system_id (self ):
97- with scoped_config (
98- cache_initdb = True , cached_initdb_unique = True ) as config :
97+ # this function exists in PostgreSQL 9.6+
98+ query = 'select system_identifier from pg_control_system()'
99+
100+ with scoped_config (cache_initdb = False ):
101+ with get_new_node ().init ().start () as node0 :
102+ id0 = node0 .execute (query )[0 ]
103+
104+ # yapf: disable
105+ with scoped_config (cache_initdb = True ,
106+ cached_initdb_unique = True ) as config :
99107
100108 self .assertTrue (config .cache_initdb )
101109 self .assertTrue (config .cached_initdb_unique )
@@ -104,13 +112,11 @@ def test_init_unique_system_id(self):
104112 with get_new_node ().init ().start () as node1 , \
105113 get_new_node ().init ().start () as node2 :
106114
107- # this function exists in PostgreSQL 9.6+
108- query = 'select system_identifier from pg_control_system()'
109-
110115 id1 = node1 .execute (query )[0 ]
111116 id2 = node2 .execute (query )[0 ]
112117
113118 # ids must increase
119+ self .assertGreater (id1 , id0 )
114120 self .assertGreater (id2 , id1 )
115121
116122 def test_node_exit (self ):
0 commit comments