pynfs: fix testLeasePeriod sleep with short lease periods
Subsystems (2)
PATCH 1/1 pynfs: fix testLeasePeriod sleep with short lease periods
testLeasePeriod() computed its in-lease sleep as min(lease - 10, 1), which goes negative when the server's lease period is less than 10 seconds, causing time.sleep() to raise "ValueError: sleep length must be non-negative". Clamp the sleep to a non-negative value.
---
Note: knfsd doesn't allow the lease time to be less than 10 seconds, but Hammerspace does.
nfs4.1/server41tests/st_exchange_id.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
nfs4.1/server41tests/st_exchange_id.py +1 -1
@@ -498,7 +498,7 @@ def testLeasePeriod(t, env): # CREATE_SESSION chan_attrs = channel_attrs4(0,8192,8192,8192,128,8,[]) sec = [callback_sec_parms4(0)] - time.sleep(min(lease - 10, 1)) + time.sleep(max(0, min(lease - 10, 1))) # Inside lease period, create_session will success. res1 = c1.c.compound([op.create_session(c1.clientid, c1.seqid, 0, chan_attrs, chan_attrs,
Signature · 1 line
2.56.1
Quoted 19 lines · Scott Mayhew
testLeasePeriod()computed its in-lease sleep asmin(lease - 10, 1), which goes negative when the server's lease period is less than 10 seconds, causingtime.sleep()to raise "ValueError: sleep length must be non-negative". Clamp the sleep to a non-negative value.Co-Authored-By Claude Opus 4.8 <[email protected]>Signed-off-by Scott Mayhew <[email protected]>---
Note: knfsd doesn't allow the lease time to be less than 10 seconds, but Hammerspace does.nfs4.1/server41tests/st_exchange_id.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)nfs4.1/server41tests/st_exchange_id.py +0
-0
nfs4.1/server41tests/st_exchange_id.py def testLeasePeriod(t, env): · line 504
Quoted 8 lines
nfs4.1/server41tests/st_exchange_id.py +1
-1@@ -498,7 +498,7 @@ def testLeasePeriod(t, env): # CREATE_SESSION chan_attrs = channel_attrs4(0,8192,8192,8192,128,8,[]) sec = [callback_sec_parms4(0)] - time.sleep(min(lease - 10, 1)) + time.sleep(max(0, min(lease - 10, 1))) # Inside lease period, create_session will success. res1 = c1.c.compound([op.create_session(c1.clientid, c1.seqid, 0, chan_attrs, chan_attrs,