diff mbox

pynfs: do not fail test which expects STALE_STATEID

Message ID 20170119164825.5962-1-tigran.mkrtchyan@desy.de (mailing list archive)
State New, archived
Headers show

Commit Message

Mkrtchyan, Tigran Jan. 19, 2017, 4:48 p.m. UTC
Stale stateid tests assume to know how state ids are constructed.
When this is not the case, then server will return BAD_STATEID
and test will fail.

update **check** function to always add BAD_STATEID status code
to the warning list.

Some code duplication, due to testing framework structure.

Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
---
 nfs4.0/servertests/environment.py   | 6 ++++++
 nfs4.1/server41tests/environment.py | 6 ++++++
 2 files changed, 12 insertions(+)
diff mbox

Patch

diff --git a/nfs4.0/servertests/environment.py b/nfs4.0/servertests/environment.py
index 11658b3..c6ede8f 100644
--- a/nfs4.0/servertests/environment.py
+++ b/nfs4.0/servertests/environment.py
@@ -248,6 +248,12 @@  def check(res, stat=NFS4_OK, msg=None, warnlist=[]):
         if not (debug_fail and msg):
             return
 
+    # stale state id test expect some structure stateid.other field.
+    # as this is not the case for all server, do not fail tests if they
+    # have returned BAD_STATEID
+    if res.status == NFS4ERR_STALE_STATEID:
+        warnlist.append(NFS4ERR_BAD_STATEID)
+
     statnames = [nfsstat4[stat] for stat in statlist]
     desired = ' or '.join(statnames)
     if not desired:
diff --git a/nfs4.1/server41tests/environment.py b/nfs4.1/server41tests/environment.py
index a910a69..8bae69b 100644
--- a/nfs4.1/server41tests/environment.py
+++ b/nfs4.1/server41tests/environment.py
@@ -282,6 +282,12 @@  def check(res, stat=NFS4_OK, msg=None, warnlist=[]):
         if not (debug_fail and msg):
             return
 
+    # stale state id test expect some structure stateid.other field.
+    # as this is not the case for all server, do not fail tests if they
+    # have returned BAD_STATEID
+    if res.status == NFS4ERR_STALE_STATEID:
+        warnlist.append(NFS4ERR_BAD_STATEID)
+
     statnames = [nfsstat4[stat] for stat in statlist]
     desired = ' or '.join(statnames)
     if not desired: