Commits

Sümer Cip committed ab20090

OOM autotest is deferred. It is not easy or maybe possible.

  • Participants
  • Parent commits 1015718

Comments (0)

Files changed (2)

     stats.bytes_written = 0;
 }
 
-struct conn*make_conn(int fd) {
+struct conn* make_conn(int fd) {
     struct conn *conn, *item;
 
     conn = NULL;
 
 
 static int init_resources(conn *conn)
-{
+{         
     free_request(conn);
     free_response(conn);
-    
+             
     conn->in = (request *)li_malloc(sizeof(request));
     if (!conn->in) {
-        // TODO: if we really fail here, we shall do something as 
-        // nobody can connect till we do something.
         return 0;
     }
   
     #def test_memleak_test_itself_is_valid(self):
         # below command should create a hash entry on server side.
     #    self.assertRaises( AssertionError, self.check_for_memusage_delta, ([("set", "a_unique_long_key_to_be_malloced", "value1", 1),])  )
-    
+    """
     def test_out_of_memory(self):
         self.client.flush_all()
         i = 0        
         while(True):
-            self.client.set("key%d" % (i), "value(%d)" % (i), 100000)
-            if self.client.response.errcode == OUT_OF_MEMORY:
-                break
+            try:
+                self.client.set("key%d" % (i), "value(%d)" % (i), 100000)
+            except:
+                break           
             i += 1 
-        # we are out of memory here, try to set some value
-        self.client.set("oom_key", "oom_val", 1)
-        self.assertErrorResponse(OUT_OF_MEMORY)       
-        
 
+        # here we are sure that we encountered OOM condition. Problem is 
+        # on an OOM condition it is not possible to know whether to get a peer 
+        # disconnect or an OUT_OF_MEMORY error.
+        # TODO: Do something here after collect_unused_mem is implemented.
+    """
 if __name__ == '__main__':
     print "Running MemTests..."
     unittest.main()