Example #1
0
 def test_copy_data(self):
     pg_ctl_exe = pgtest.which('pg_ctl')
     temp_dir = tempfile.mkdtemp()
     data_dir = os.path.join(temp_dir, 'data')
     cmd = ('"{pg_ctl}" initdb -D "{cluster}" -o "-U postgres -A trust"'
            ).format(pg_ctl=pg_ctl_exe, cluster=data_dir)
     subprocess.check_output(cmd, shell=True)
     with pgtest.PGTest(copy_cluster=data_dir) as pg:
         self.assertTrue(pgtest.is_server_running(pg.cluster))
     shutil.rmtree(temp_dir, ignore_errors=True)
Example #2
0
 def test_create_db_cluster(self):
     self.profile_manager.create_db_cluster()
     self.assertTrue(
         pgtest.is_server_running(self.profile_manager.pg_cluster.cluster))
Example #3
0
 def test_base_dir_valid(self):
     temp_dir = tempfile.mkdtemp()
     with pgtest.PGTest(base_dir=temp_dir) as pg:
         self.assertTrue(pgtest.is_server_running(pg.cluster))
     shutil.rmtree(temp_dir, ignore_errors=True)
Example #4
0
 def test_pg_ctl_exe_valid(self):
     pg_ctl_exe = pgtest.which('pg_ctl')
     with pgtest.PGTest(pg_ctl=pg_ctl_exe) as pg:
         self.assertTrue(pgtest.is_server_running(pg.cluster))
Example #5
0
 def test_username_valid(self):
     with pgtest.PGTest(username='******') as pg:
         self.assertTrue(pgtest.is_server_running(pg.cluster))
Example #6
0
 def test_is_not_server_running(self):
     self.assertFalse(pgtest.is_server_running(self.data_dir))
Example #7
0
 def test_cluster_running(self):
     self.assertTrue(pgtest.is_server_running(self.pg.cluster))