Ejemplo n.º 1
0
    def setUp(self):
        super(TestRdirServer2, self).setUp()
        # Start a sandboxed rdir service
        self.num, self.host, self.port = 17, '127.0.0.1', 5999
        self.cfg_path = tempfile.mktemp()
        self.db_path = tempfile.mkdtemp()
        self.service_id = str(uuid.uuid4())
        self.garbage_files.extend((self.cfg_path, self.db_path))

        config = {
            'host': self.host,
            'port': self.port,
            'ns': self.ns,
            'db': self.db_path,
            'service_id': self.service_id
        }
        _write_config(self.cfg_path, config)

        child = subprocess.Popen(['oio-rdir-server', self.cfg_path],
                                 close_fds=True)
        if not wait_for_slow_startup(self.port):
            child.kill()
            raise Exception("The rdir server is too long to start")
        else:
            self.garbage_procs.append(child)
Ejemplo n.º 2
0
 def test_good_config(self):
     host, port = '127.0.0.1', 5999
     cfg = tempfile.mktemp()
     db = tempfile.mkdtemp()
     self.garbage_files.extend((cfg, db))
     with open('/dev/null', 'w') as out:
         fd = out.fileno()
         # start a first rdir
         config = {'host': host, 'port': port, 'ns': self.ns, 'db': db}
         _write_config(cfg, config)
         proc0 = subprocess.Popen(['oio-rdir-server', cfg], stderr=fd)
         self.garbage_procs.append(proc0)
         self.assertTrue(wait_for_slow_startup(port))
Ejemplo n.º 3
0
    def test_volume_lock(self):
        host, port = '127.0.0.1', 5999
        cfg = tempfile.mktemp()
        db = tempfile.mkdtemp()
        self.garbage_files.extend((cfg, db))
        out = open('/dev/null', 'w')
        fd = out.fileno()

        # start a first rdir
        config = {'host': host, 'port': port, 'ns': self.ns, 'db': db}
        _write_config(cfg, config)
        proc0 = subprocess.Popen(['oio-rdir-server', cfg], stderr=fd)
        self.garbage_procs.append(proc0)
        self.assertTrue(wait_for_slow_startup(port))

        # now start a second rdir on another port
        config.update({'port': port + 1})
        _write_config(cfg, config)
        proc1 = subprocess.Popen(['oio-rdir-server', cfg], stderr=fd)
        self.garbage_procs.append(proc1)
        self.assertTrue(check_process_absent(proc1))