2017-01-19 16:49:04

by Mkrtchyan, Tigran

[permalink] [raw]
Subject: [PATCH] pynfs: do not fail test which expects STALE_STATEID

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 <[email protected]>
---
nfs4.0/servertests/environment.py | 6 ++++++
nfs4.1/server41tests/environment.py | 6 ++++++
2 files changed, 12 insertions(+)

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:
--
2.9.3