[PATCH pynfs 07/13] server41tests: test COPY with bad destination stateid

Jeff Layton <[email protected]>
Newsgroups gmane.linux.nfs
Message-ID <[email protected]>
Add testCopyBadDestStateid (COPY9) which verifies the server returns
NFS4ERR_BAD_STATEID when the COPY destination stateid is invalid.

Signed-off-by: Jeff Layton <[email protected]>
---
 nfs4.1/server41tests/st_copy.py | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/nfs4.1/server41tests/st_copy.py b/nfs4.1/server41tests/st_copy.py
index 1918f3da2bdf..6be3c70ccfab 100644
--- a/nfs4.1/server41tests/st_copy.py
+++ b/nfs4.1/server41tests/st_copy.py
@@ -272,3 +272,18 @@ def testCopyBadSourceStateid(t, env):
     res = _do_copy(sess, src_fh, _bad_stateid(), dst_fh, dst_stateid,
                    count=1024, synchronous=1)
     check(res, NFS4ERR_BAD_STATEID, msg="COPY with bad source stateid")
+
+def testCopyBadDestStateid(t, env):
+    """COPY with an invalid destination stateid should fail
+
+    FLAGS: copy
+    CODE: COPY9
+    """
+    sess = env.c1.new_client_session(env.testname(t))
+    src_fh, src_stateid = _create_and_open(sess, env.testname(t))
+    write_file(sess, src_fh, b"data", 0, src_stateid)
+    dst_fh, _dst_stateid = _create_and_open(sess, env.testname(t) + b"_dst")
+
+    res = _do_copy(sess, src_fh, src_stateid, dst_fh, _bad_stateid(),
+                   count=4, synchronous=1)
+    check(res, NFS4ERR_BAD_STATEID, msg="COPY with bad dest stateid")

-- 
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.