[PATCH pynfs v3 17/26] server41tests: test mkdir triggers ADD notification
Jeff Layton <[email protected]>
| Newsgroups | gmane.linux.nfs |
|---|---|
| Message-ID | <[email protected]> |
Request a dir delegation with ADD_ENTRY notifications. Create a subdirectory from a second client. Verify the server sends a CB_NOTIFY with the correct ADD event. Signed-off-by: Jeff Layton <[email protected]> --- nfs4.1/server41tests/st_dir_deleg.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/nfs4.1/server41tests/st_dir_deleg.py b/nfs4.1/server41tests/st_dir_deleg.py index 752fec3df185..ec4e2bc0e961 100644 --- a/nfs4.1/server41tests/st_dir_deleg.py +++ b/nfs4.1/server41tests/st_dir_deleg.py @@ -612,3 +612,36 @@ def testDirDelegDirAttrs(t, env): if not found_dir_attrs: fail("No CHANGE_DIR_ATTRS notification found") + +def testDirDelegMkdir(t, env): + """Verify mkdir triggers ADD notification + + FLAGS: dirdeleg all + CODE: DIRDELEG14 + """ + c = env.c1 + cb = threading.Event() + sess1, fh, deleg = _getDirDeleg(t, env, + [NOTIFY4_ADD_ENTRY, + NOTIFY4_GFLAG_EXTEND], cb) + + sess2 = c.new_client_session(b"%s_2" % env.testname(t)) + topdir = c.homedir + [t.code.encode('utf8')] + subdir = topdir + [env.testname(t)] + res = create_obj(sess2, subdir) + check(res) + + completed = cb.wait(2) + + delegreturn_op = [ op.putfh(fh), op.delegreturn(deleg) ] + res = sess1.compound(delegreturn_op) + check(res) + + if (not completed or not cb.got_notify): + fail("Didn't receive a CB_NOTIFY from the server!") + + evt_type, evt = decode_notify_event(cb.changes[0]) + if evt_type != NOTIFY4_ADD_ENTRY: + fail("Expected ADD notification, got %d" % evt_type) + if evt.nad_new_entry.ne_file != env.testname(t): + fail("Wrong directory name in ADD notification") -- 2.54.0