Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Pbckp 152 multihost#78

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
demonolock merged 27 commits intomasterfromPBCKP-152-multihost
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
27 commits
Select commitHold shift + click to select a range
02c3375
PBCKP-137 update node.py
Apr 10, 2023
1512afd
PBCKP-137 up version 1.8.6
Apr 11, 2023
0d62e0e
PBCKP-137 update node.py
Apr 11, 2023
8be1b3a
PBCKP-137 update node
Apr 17, 2023
51f05de
PBCKP-152 change local function on execution by ssh
May 2, 2023
f131088
PBCKP-152 merge master
May 2, 2023
4f38bd5
PBCKP-152 multihost
May 3, 2023
0da2ee2
merge master
Jun 6, 2023
2bc17f0
testgres from PBCKP-152-multihost
Jun 6, 2023
f9b6bdb
PBCKP-152
Jun 10, 2023
ac77ef7
PBCKP-152 use black for formatting
Jun 11, 2023
b048041
PBCKP-152 fix failed tests
Jun 12, 2023
e098b97
PBCKP-152 fix failed tests
Jun 13, 2023
1c405ef
PBCKP-152 add tests for remote_ops.py
Jun 14, 2023
8c373e6
PBCKP-152 add testgres tests for remote node
Jun 14, 2023
72e6d5d
PBCKP-152 fixed test_simple and test_remote
Jun 17, 2023
2c2d2c5
PBCKP-588 test fix test_restore_after_failover
Jun 22, 2023
1b4f74a
PBCKP-588 test partially fixed test_simple_remote.py 41/43
Jun 22, 2023
2e916df
PBCKP-588 fixes after review
Jun 25, 2023
0528541
PBCKP-588 fixes after review - add ConnectionParams
Jun 26, 2023
089ab9b
PBCKP-588 fixes after review - remove f-strings
Jun 26, 2023
190d084
PBCKP-588 fixes after review - replace subprocess.run on subprocess.P…
Jun 27, 2023
0c26f77
PBCKP-588 fix failed tests - psql, set_auto_conf
Jun 28, 2023
0796bc4
PBCKP-152 - test_restore_target_time cut
Jul 26, 2023
0f14034
PBCKP-152 - node set listen address
Jul 28, 2023
12aa7ba
Add info about remote mode in README.md
Aug 1, 2023
4e7f4b0
merge master
Aug 4, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
PBCKP-152 use black for formatting
  • Loading branch information
v.shepard committedJun 12, 2023
commitac77ef78f640b9b518817403c6841b25e8f46e9b
7 changes: 4 additions & 3 deletionstestgres/cache.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,8 +4,8 @@

fromsiximportraise_from

from .op_ops.local_opsimportLocalOperations
from .op_ops.os_opsimportOsOperations
from .os_ops.local_opsimportLocalOperations
from .os_ops.os_opsimportOsOperations
from .configimporttestgres_config

from .constsimportXLOG_CONTROL_FILE
Expand All@@ -25,6 +25,7 @@ def cached_initdb(data_dir, logfile=None, params=None, os_ops: OsOperations = Lo
"""
Perform initdb or use cached node files.
"""
testgres_config.os_ops=os_ops

defcall_initdb(initdb_dir,log=None):
try:
Expand DownExpand Up@@ -60,7 +61,7 @@ def call_initdb(initdb_dir, log=None):

# XXX: build new WAL segment with our system id
_params= [get_bin_path("pg_resetwal"),"-D",data_dir,"-f"]
execute_utility(_params,logfile,os_ops)
execute_utility(_params,logfile,os_ops=os_ops)

exceptExecUtilExceptionase:
msg="Failed to reset WAL for system id"
Expand Down
9 changes: 4 additions & 5 deletionstestgres/config.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,9 +5,8 @@
importtempfile

fromcontextlibimportcontextmanager
fromshutilimportrmtree

from .op_ops.local_opsimportLocalOperations
from .os_ops.local_opsimportLocalOperations
from .constsimportTMP_CACHE


Expand DownExpand Up@@ -44,7 +43,7 @@ class GlobalConfig(object):
_cached_initdb_dir=None
""" underlying class attribute for cached_initdb_dir property """

os_ops=None
os_ops=LocalOperations()
""" OsOperation object that allows work on remote host """
@property
defcached_initdb_dir(self):
Expand DownExpand Up@@ -137,9 +136,9 @@ def copy(self):


@atexit.register
def_rm_cached_initdb_dirs(os_ops=LocalOperations()):
def_rm_cached_initdb_dirs():
fordincached_initdb_dirs:
os_ops.rmdirs(d,ignore_errors=True)
testgres_config.os_ops.rmdirs(d,ignore_errors=True)


defpush_config(**options):
Expand Down
3 changes: 1 addition & 2 deletionstestgres/defaults.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
importdatetime
importos
importstruct
importuuid

from .op_ops.local_opsimportLocalOperations
from .os_ops.local_opsimportLocalOperations


defdefault_dbname():
Expand Down
42 changes: 18 additions & 24 deletionstestgres/node.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
# coding: utf-8

import io
import os
import random
import shutil
import signal
import threading
from queue import Queue

import psutil
import subprocess
import time

from op_ops.local_ops import LocalOperations
from op_ops.os_ops import OsOperations
from op_ops.remote_ops import RemoteOperations
from .os_ops.local_ops import LocalOperations
from .os_ops.remote_ops import RemoteOperations

try:
from collections.abc import Iterable
Expand All@@ -32,7 +28,6 @@

from shutil import rmtree
from six import raise_from, iteritems, text_type
from tempfile import mkstemp, mkdtemp

from .enums import \
NodeStatus, \
Expand DownExpand Up@@ -96,7 +91,6 @@
eprint, \
get_bin_path, \
get_pg_version, \
file_tail, \
reserve_port, \
release_port, \
execute_utility, \
Expand DownExpand Up@@ -163,6 +157,7 @@ def __init__(self, name=None, port=None, base_dir=None,
else:
self.os_ops = RemoteOperations(host, hostname, ssh_key)

testgres_config.os_ops = self.os_ops
# defaults for __exit__()
self.cleanup_on_good_exit = testgres_config.node_cleanup_on_good_exit
self.cleanup_on_bad_exit = testgres_config.node_cleanup_on_bad_exit
Expand DownExpand Up@@ -289,7 +284,7 @@ def base_dir(self):
self._base_dir = self.os_ops.mkdtemp(prefix=TMP_NODE)

# NOTE: it's safe to create a new dir
if not self.os_ops.exists(self._base_dir):
if not self.os_ops.path_exists(self._base_dir):
self.os_ops.makedirs(self._base_dir)

return self._base_dir
Expand All@@ -299,7 +294,7 @@ def logs_dir(self):
path = os.path.join(self.base_dir, LOGS_DIR)

# NOTE: it's safe to create a new dir
if not self.os_ops.exists(path):
if not self.os_ops.path_exists(path):
self.os_ops.makedirs(path)

return path
Expand DownExpand Up@@ -628,7 +623,7 @@ def status(self):
"-D", self.data_dir,
"status"
] # yapf: disable
execute_utility(_params, self.utils_log_file)
execute_utility(_params, self.utils_log_file, os_ops=self.os_ops)
return NodeStatus.Running

except ExecUtilException as e:
Expand All@@ -650,7 +645,7 @@ def get_control_data(self):
_params += ["-D"] if self._pg_version >= PgVer('9.5') else []
_params += [self.data_dir]

data = execute_utility(_params, self.utils_log_file)
data = execute_utility(_params, self.utils_log_file, os_ops=self.os_ops)

out_dict = {}

Expand DownExpand Up@@ -713,7 +708,7 @@ def start(self, params=[], wait=True):
] + params # yapf: disable

try:
execute_utility(_params, self.utils_log_file)
execute_utility(_params, self.utils_log_file, os_ops=self.os_ops)
except ExecUtilException as e:
msg = 'Cannot start node'
files = self._collect_special_files()
Expand DownExpand Up@@ -744,7 +739,7 @@ def stop(self, params=[], wait=True):
"stop"
] + params # yapf: disable

execute_utility(_params, self.utils_log_file)
execute_utility(_params, self.utils_log_file, os_ops=self.os_ops)

self._maybe_stop_logger()
self.is_started = False
Expand DownExpand Up@@ -786,7 +781,7 @@ def restart(self, params=[]):
] + params # yapf: disable

try:
execute_utility(_params, self.utils_log_file)
execute_utility(_params, self.utils_log_file, os_ops=self.os_ops)
except ExecUtilException as e:
msg = 'Cannot restart node'
files = self._collect_special_files()
Expand All@@ -813,7 +808,7 @@ def reload(self, params=[]):
"reload"
] + params # yapf: disable

execute_utility(_params, self.utils_log_file)
execute_utility(_params, self.utils_log_file, os_ops=self.os_ops)

return self

Expand All@@ -835,7 +830,7 @@ def promote(self, dbname=None, username=None):
"promote"
] # yapf: disable

execute_utility(_params, self.utils_log_file)
execute_utility(_params, self.utils_log_file, os_ops=self.os_ops)

# for versions below 10 `promote` is asynchronous so we need to wait
# until it actually becomes writable
Expand DownExpand Up@@ -870,7 +865,7 @@ def pg_ctl(self, params):
"-w" # wait
] + params # yapf: disable

return execute_utility(_params, self.utils_log_file)
return execute_utility(_params, self.utils_log_file, os_ops=self.os_ops)

def free_port(self):
"""
Expand DownExpand Up@@ -1035,10 +1030,9 @@ def dump(self,
# Generate tmpfile or tmpdir
def tmpfile():
if format == DumpFormat.Directory:
fname = mkdtemp(prefix=TMP_DUMP)
fname =self.os_ops.mkdtemp(prefix=TMP_DUMP)
else:
fd, fname = mkstemp(prefix=TMP_DUMP)
os.close(fd)
fname = self.os_ops.mkstemp(prefix=TMP_DUMP)
return fname

# Set default arguments
Expand All@@ -1056,7 +1050,7 @@ def tmpfile():
"-F", format.value
] # yapf: disable

execute_utility(_params, self.utils_log_file)
execute_utility(_params, self.utils_log_file, os_ops=self.os_ops)

return filename

Expand DownExpand Up@@ -1085,7 +1079,7 @@ def restore(self, filename, dbname=None, username=None):

# try pg_restore if dump is binary formate, and psql if not
try:
execute_utility(_params, self.utils_log_name)
execute_utility(_params, self.utils_log_name, os_ops=self.os_ops)
except ExecUtilException:
self.psql(filename=filename, dbname=dbname, username=username)

Expand DownExpand Up@@ -1417,7 +1411,7 @@ def pgbench_run(self, dbname=None, username=None, options=[], **kwargs):
# should be the last one
_params.append(dbname)

return execute_utility(_params, self.utils_log_file)
return execute_utility(_params, self.utils_log_file, os_ops=self.os_ops)

def connect(self,
dbname=None,
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp