Exemplo n.º 1
0
    def test_merge_bad_archive_config(self):
        testdb = "test-%s" % self.filename

        # Create 2 whisper databases with different schema
        self._update()
        whisper.create(testdb, [(100, 1)])

        with AssertRaisesException(NotImplementedError('db.wsp and test-db.wsp archive configurations are unalike. Resize the input before merging')):
            whisper.merge(self.filename, testdb)

        self._remove(testdb)
Exemplo n.º 2
0
    def test_merge(self):
        """
        test merging two databases
        """
        testdb = "test-%s" % self.filename

        # Create 2 whisper databases and merge one into the other
        self._update()
        self._update(testdb)

        whisper.merge(self.filename, testdb)
Exemplo n.º 3
0
    def test_merge_bad_archive_config(self):
        testdb = "test-%s" % self.filename

        # Create 2 whisper databases with different schema
        self._update()
        whisper.create(testdb, [(100, 1)])

        with AssertRaisesException(NotImplementedError('db.wsp and test-db.wsp archive configurations are unalike. Resize the input before merging')):
            whisper.merge(self.filename, testdb)

        self._remove(testdb)
Exemplo n.º 4
0
    def test_merge(self):
        """
        test merging two databases
        """
        testdb = "test-%s" % self.filename

        # Create 2 whisper databases and merge one into the other
        self._update()
        self._update(testdb)

        whisper.merge(self.filename, testdb)
Exemplo n.º 5
0
    def test_merge_empty(self):
        """
        test merging from an empty database
        """
        testdb_a = "test-a-%s" % self.filename
        testdb_b = "test-b-%s" % self.filename

        # create two empty databases with same retention
        self.addCleanup(self._remove, testdb_a)
        whisper.create(testdb_a, self.retention)
        self.addCleanup(self._remove, testdb_b)
        whisper.create(testdb_b, self.retention)

        whisper.merge(testdb_a, testdb_b)
Exemplo n.º 6
0
    def test_merge_empty(self):
        """
        test merging from an empty database
        """
        testdb_a = "test-a-%s" % self.filename
        testdb_b = "test-b-%s" % self.filename

        # create two empty databases with same retention
        self.addCleanup(self._remove, testdb_a)
        whisper.create(testdb_a, self.retention)
        self.addCleanup(self._remove, testdb_b)
        whisper.create(testdb_b, self.retention)

        whisper.merge(testdb_a, testdb_b)
Exemplo n.º 7
0
    def test_merge(self):
        """test merging two databases"""
        testdb = "test-%s" % self.db
        self._removedb()

        try:
          os.unlink(testdb)
        except Exception:
          pass

        # Create 2 whisper databases and merge one into the other
        self._update()
        self._update(testdb)

        whisper.merge(self.db, testdb)

        self._removedb()
        try:
          os.unlink(testdb)
        except Exception:
          pass
Exemplo n.º 8
0
    def test_merge(self):
        """test merging two databases"""
        testdb = "test-%s" % self.db
        self._removedb()

        try:
            os.unlink(testdb)
        except Exception:
            pass

        # Create 2 whisper databases and merge one into the other
        self._update()
        self._update(testdb)

        whisper.merge(self.db, testdb)

        self._removedb()
        try:
            os.unlink(testdb)
        except Exception:
            pass
Exemplo n.º 9
0
# Ignore SIGPIPE
signal.signal(signal.SIGPIPE, signal.SIG_DFL)

option_parser = optparse.OptionParser(
    usage='''%prog [options] from_path to_path''')
option_parser.add_option(
    '--from',
    default=None,
    type='int',
    dest='_from',
    help=("Begining of interval, unix timestamp (default: epoch)"))
option_parser.add_option('--until',
                         default=None,
                         type='int',
                         help="End of interval, unix timestamp (default: now)")

(options, args) = option_parser.parse_args()

if len(args) < 2:
    option_parser.print_help()
    sys.exit(1)

path_from = args[0]
path_to = args[1]

for filename in (path_from, path_to):
    if not os.path.exists(filename):
        raise SystemExit('[ERROR] File "%s" does not exist!' % filename)

whisper.merge(path_from, path_to, options._from, options.until)
Exemplo n.º 10
0
try:
  import whisper
except ImportError:
  raise SystemExit('[ERROR] Please make sure whisper is installed properly')

# Ignore SIGPIPE
signal.signal(signal.SIGPIPE, signal.SIG_DFL)

option_parser = optparse.OptionParser(
    usage='''%prog [options] from_path to_path''')
option_parser.add_option('--from', default=None, type='int', dest='_from',
  help=("Begining of interval, unix timestamp (default: epoch)"))
option_parser.add_option('--until', default=None, type='int',
  help="End of interval, unix timestamp (default: now)")

(options, args) = option_parser.parse_args()

if len(args) < 2:
  option_parser.print_help()
  sys.exit(1)

path_from = args[0]
path_to = args[1]

for filename in (path_from, path_to):
  if not os.path.exists(filename):
    raise SystemExit('[ERROR] File "%s" does not exist!' % filename)

whisper.merge(path_from, path_to, options._from, options.until)
Exemplo n.º 11
0
import os
import sys
import signal
import optparse

try:
  import whisper
except ImportError:
  raise SystemExit('[ERROR] Please make sure whisper is installed properly')

# Ignore SIGPIPE
signal.signal(signal.SIGPIPE, signal.SIG_DFL)

option_parser = optparse.OptionParser(
    usage='''%prog [options] from_path to_path''')

(options, args) = option_parser.parse_args()

if len(args) < 2:
  option_parser.print_help()
  sys.exit(1)

path_from = args[0]
path_to = args[1]

for filename in (path_from, path_to):
   if not os.path.exists(filename):
       raise SystemExit('[ERROR] File "%s" does not exist!' % filename)

whisper.merge(path_from, path_to)
Exemplo n.º 12
0
import os
import sys
import signal
import optparse

try:
    import whisper
except ImportError:
    raise SystemExit('[ERROR] Please make sure whisper is installed properly')

# Ignore SIGPIPE
signal.signal(signal.SIGPIPE, signal.SIG_DFL)

option_parser = optparse.OptionParser(
    usage='''%prog [options] from_path to_path''')

(options, args) = option_parser.parse_args()

if len(args) < 2:
    option_parser.print_usage()
    sys.exit(1)

path_from = args[0]
path_to = args[1]

for filename in (path_from, path_to):
    if not os.path.exists(filename):
        raise SystemExit('[ERROR] File "%s" does not exist!' % filename)

whisper.merge(path_from, path_to)