提交 2b431a56 编写于 作者: C Chris Hajas

Remove pysync

This was only used by gprepairmirrorseg, which was removed in a previous
commit.
Authored-by: NChris Hajas <chajas@pivotal.io>
上级 77a93f43
......@@ -54,23 +54,6 @@ def getPostmasterPID(hostname, datadir):
except:
return -1
#-----------------------------------------------
class PySync(Command):
def __init__(self,name,srcDir,dstHost,dstDir,ctxt=LOCAL,remoteHost=None, options=None):
psync_executable=GPHOME + "/bin/lib/pysync.py"
# MPP-13617
if ':' in dstHost and not ']' in dstHost:
dstHost = '[' + dstHost + ']'
self.cmdStr="%s %s %s %s:%s" % (psync_executable,
options if options else "",
srcDir,
dstHost,
dstDir)
Command.__init__(self,name,self.cmdStr,ctxt,remoteHost)
#-----------------------------------------------
class CmdArgs(list):
......
import os, tempfile, hashlib
from gp_unittest import *
from lib.pysync import LocalPysync
CONTENT = 'To be or not to be.'
class LocalPySyncTestCase(GpTestCase):
def setUp(self):
self.subject = LocalPysync(['pysync', '/tmp', 'localhost:/tmp'])
def tearDown(self):
super(LocalPySyncTestCase, self).tearDown()
def test_doCommand_getDigest(self):
filename = ''
try:
filename, filesize = createTempFileWithContent(CONTENT)
doCommand_digest = self.subject.doCommand(['getDigest', filename, 0, filesize])
m = hashlib.sha256()
m.update(CONTENT)
self.assertTrue(m.digest() == doCommand_digest)
finally:
os.unlink(filename)
def createTempFileWithContent(content):
fd = tempfile.NamedTemporaryFile(delete=False)
fd.write(content)
filename = fd.name
fd.close()
filesize = os.stat(filename).st_size
return filename, filesize
if __name__ == '__main__':
run_tests()
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册