linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mi Jinlong <mijinlong@cn.fujitsu.com>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: NFS <linux-nfs@vger.kernel.org>
Subject: [PATCH v2] CLNT: add some tests for DESTROY_CLIENTID
Date: Thu, 20 Oct 2011 18:14:05 +0800	[thread overview]
Message-ID: <4E9FF46D.5090003@cn.fujitsu.com> (raw)
In-Reply-To: <20111020100202.GF5444@fieldses.org>

Some tests for DESTROY_CLIENTID at pynfs41.

Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com>
---
 nfs4.1/server41tests/__init__.py            |    1 +
 nfs4.1/server41tests/st_destroy_clientid.py |   98 +++++++++++++++++++++++++++
 2 files changed, 99 insertions(+), 0 deletions(-)
 create mode 100644 nfs4.1/server41tests/st_destroy_clientid.py

diff --git a/nfs4.1/server41tests/__init__.py b/nfs4.1/server41tests/__init__.py
index 1cc2048..eb92538 100644
--- a/nfs4.1/server41tests/__init__.py
+++ b/nfs4.1/server41tests/__init__.py
@@ -2,6 +2,7 @@ __all__ = ["st_exchange_id.py", # draft 21
            "st_compound.py",
            "st_create_session.py",
            "st_destroy_session.py",
+           "st_destroy_clientid.py",
            "st_reclaim_complete.py",
            "st_secinfo_no_name.py",
            "st_secinfo.py",
diff --git a/nfs4.1/server41tests/st_destroy_clientid.py b/nfs4.1/server41tests/st_destroy_clientid.py
new file mode 100644
index 0000000..1b193cf
--- /dev/null
+++ b/nfs4.1/server41tests/st_destroy_clientid.py
@@ -0,0 +1,98 @@
+from st_create_session import create_session
+from nfs4_const import *
+from environment import check, fail
+import nfs4_ops as op
+import nfs4lib
+
+def testSupported(t, env):
+    """ Do a simple DESTROY_CLIENTID
+        destroy an unconfirmed clientid without session
+
+    FLAGS: destroy_clientid all
+    CODE: DESCID1
+    """
+    c = env.c1.new_client(env.testname(t))
+
+    res = env.c1.compound([op.destroy_clientid(c.clientid)])
+    check(res)
+
+def testDestroyCIDWS(t, env):
+    """ destroy an unconfirmed clientid with session
+
+    FLAGS: destroy_clientid all
+    CODE: DESCID2
+    """
+    c1 = env.c1.new_client("%s_1" % env.testname(t))
+    c2 = env.c1.new_client("%s_2" % env.testname(t))
+    sess = c1.create_session()
+
+    res = sess.compound([op.destroy_clientid(c2.clientid)])
+    check(res)
+
+def testDestroyBadCIDWS(t, env):
+    """ destroy a nonexistant clientid without session
+
+    FLAGS: destroy_clientid all
+    CODE: DESCID3
+    """
+    res = env.c1.compound([op.destroy_clientid(0)])
+    check(res, NFS4ERR_STALE_CLIENTID)
+
+def testDestroyBadCIDIS(t, env):
+    """ destroy a nonexistant clientid in session
+
+    FLAGS: destroy_clientid all
+    CODE: DESCID4
+    """
+    c = env.c1.new_client(env.testname(t))
+    sess = c.create_session()
+
+    res = sess.compound([op.destroy_clientid(0)])
+    check(res, NFS4ERR_STALE_CLIENTID)
+
+def testDestroyCIDSessionB(t, env):
+    """ destroy clientid using a session belong to that client
+
+    FLAGS: destroy_clientid all
+    CODE: DESCID5
+    """
+    c = env.c1.new_client(env.testname(t))
+    sess = c.create_session()
+
+    res = sess.compound([op.destroy_clientid(c.clientid)])
+    check(res, NFS4ERR_CLIENTID_BUSY)
+
+def testDestroyCIDCSession(t, env):
+    """ destroy a clientid which contains session without session
+
+    FLAGS: destroy_clientid all
+    CODE: DESCID6
+    """
+    c = env.c1.new_client(env.testname(t))
+    sess = c.create_session()
+
+    res = env.c1.compound([op.destroy_clientid(c.clientid)])
+    check(res, NFS4ERR_CLIENTID_BUSY)
+
+def testDestroyCIDNotOnly(t, env):
+    """ destroy a clientid without session with other compound
+
+    FLAGS: destroy_clientid all
+    CODE: DESCID7
+    """
+    res = env.c1.compound([op.destroy_clientid(0), op.reclaim_complete(TRUE)])
+    check(res, NFS4ERR_NOT_ONLY_OP)
+
+def testDestroyCIDTwice(t, env):
+    """ destroy a clientid twice without session
+
+    FLAGS: destroy_clientid all
+    CODE: DESCID8
+    """
+    c = env.c1.new_client(env.testname(t))
+
+    res = env.c1.compound([op.destroy_clientid(c.clientid)])
+    check(res)
+
+    res = env.c1.compound([op.destroy_clientid(c.clientid)])
+    check(res, NFS4ERR_STALE_CLIENTID)
-- 
1.7.6



  reply	other threads:[~2011-10-20 10:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-20  8:57 [PATCH] CLNT: add some tests for DESTROY_CLIENTID Mi Jinlong
2011-10-20  9:43 ` J. Bruce Fields
2011-10-20 10:00   ` Mi Jinlong
2011-10-20 10:02     ` J. Bruce Fields
2011-10-20 10:14       ` Mi Jinlong [this message]
2011-11-04 22:35         ` [PATCH v2] " J. Bruce Fields

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E9FF46D.5090003@cn.fujitsu.com \
    --to=mijinlong@cn.fujitsu.com \
    --cc=bfields@fieldses.org \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).