@@ -704,6 +704,68 @@ def test_get_all_keys_only(self, etcd):
704704 assert meta .key .startswith (b"/doot/" )
705705 assert not value
706706
707+ def test_get_count_only (self , etcd ):
708+ for i in range (20 ):
709+ etcdctl ('put' , '/doot/count{}' .format (i ), 'i am in all' )
710+ resp = etcd .get_prefix_response (
711+ key_prefix = '/doot/count' ,
712+ count_only = True
713+ )
714+ assert len (resp .kvs ) == 0
715+ assert resp .count == 20
716+
717+ def test_get_limit (self , etcd ):
718+ for i in range (20 ):
719+ etcdctl ('put' , '/doot/limit{}' .format (i ), 'i am in all' )
720+ for i in range (20 ):
721+ resp = etcd .get_prefix_response (key_prefix = '/doot/limit' , limit = i )
722+ assert resp .count == 20
723+ if i == 0 or i == 20 :
724+ assert len (resp .kvs ) == 20
725+ assert resp .more is False
726+ else :
727+ assert len (resp .kvs ) == i
728+ assert resp .more is True
729+
730+ def test_get_revision (self , etcd ):
731+ revisions = []
732+ for i in range (20 ):
733+ resp = etcdctl ('put' , '/doot/revision{}' .format (i ), 'i am in all' )
734+ revisions .append (resp ['header' ]['revision' ])
735+ for i , revision in enumerate (revisions ):
736+ resp = etcd .get_prefix_response (
737+ key_prefix = '/doot/revisiond' ,
738+ revision = revision
739+ )
740+ assert resp .count == i + 1
741+
742+ def test_get_min_mod_revision (self , etcd ):
743+ revisions = []
744+ for i in range (5 ):
745+ resp = etcdctl ('put' , '/doot/revision' , str (i ))
746+ revisions .append (resp ['header' ]['revision' ])
747+ for revision in revisions :
748+ resp = etcd .get_response (
749+ key = '/doot/revision' ,
750+ min_mod_revision = revision
751+ )
752+ assert len (resp .kvs ) == 1
753+
754+ def test_get_max_mod_revision (self , etcd ):
755+ revisions = []
756+ for i in range (5 ):
757+ resp = etcdctl ('put' , '/doot/revision' , str (i ))
758+ revisions .append (resp ['header' ]['revision' ])
759+ for revision in revisions :
760+ resp = etcd .get_response (
761+ key = '/doot/revision' ,
762+ max_mod_revision = revision
763+ )
764+ if revision == revisions [- 1 ]:
765+ assert len (resp .kvs ) == 1
766+ else :
767+ assert len (resp .kvs ) == 0
768+
707769 def test_sort_order (self , etcd ):
708770 def remove_prefix (string , prefix ):
709771 return string [len (prefix ):]
0 commit comments