コード例 #1
0
    def test_migrate_empty_s3obj(self):
        util.print_frame()
        ip, port = util.get_rand_gateway(self.cluster)
        client = redis_sock.RedisClient(ip, port)

        # Fill some string and empty s3 objects
        keyprefix = 'test_migrate_empty_s3obj'
        for i in range(1000):
            ok, data = client.do_request('set %s_string_%d %d\r\n' %
                                         (keyprefix, i, i))
            assert (ok == True)
            ok, data = client.do_request(
                's3ladd ks %s_s3_%d svc key val 0\r\n' % (keyprefix, i))
            assert (ok == True and data == 1)
            ok, data = client.do_request('s3lrem ks %s_s3_%d svc key val\r\n' %
                                         (keyprefix, i))
            assert (ok == True and data == 1)

        ## migration pg0 -> pg1 then pg1 -> pg0
        ret = util.migration(self.cluster, 0, 1, 4096, 8191, 40000)
        self.assertEqual(True, ret, 'Migration Fail')
        ret = util.migration(self.cluster, 1, 0, 4096, 8191, 40000)
        self.assertEqual(True, ret, 'Migration Fail')

        # Check string object
        for i in range(1000):
            ok, data = client.do_request('get %s_string_%d\r\n' %
                                         (keyprefix, i))
            assert (ok == True and int(data) == i)

        client.close()
コード例 #2
0
 def check_oom(self, is_oom=False):
     m, s1, s2 = util.get_mss(self.cluster)
     mr = redis_sock.RedisClient(m['ip'], m['redis_port'])
     sr = redis_sock.RedisClient(s1['ip'], s1['redis_port'])
     try:
         ok, data = mr.do_request("get nosuchkey_check_oom\r\n")
         assert (ok), ok
         ok, data = sr.do_request("get nosuchkey_check_oom\r\n")
         assert (ok), ok
         expected_ok = not is_oom
         ok, data = mr.do_request("set nosuchkey_check_oom 100\r\n")
         assert (ok == expected_ok), (ok, data)
         ok, data = sr.do_request("set nosuchkey_check_oom 100\r\n")
         assert (ok == expected_ok), (ok, data)
     finally:
         if mr != None:
             mr.close()
         if sr != None:
             sr.close()
コード例 #3
0
ファイル: test_bgdel.py プロジェクト: swtalk/nbase-arc
 def setUp( self ):
     util.set_process_logfile_prefix( 'TestBackgroundDelete_%s' % self._testMethodName )
     server = self.cluster['servers'][0]
     self.redis = redis_sock.RedisClient(server['ip'], server['redis_port'])