Skip to content

Commit 19ef753

Browse files
committed
[_SQUASH] correct (sometimes) failing tests
1 parent b8826df commit 19ef753

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

irods/test/data_obj_test.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /usr/bin/env python
22

3-
from datetime import datetime, timezone
3+
from datetime import datetime, timezone, timedelta
44
import base64
55
import collections
66
import concurrent.futures
@@ -3308,11 +3308,16 @@ def test_access_time__issue_700(self):
33083308
data_path= iRODSPath(self.coll.path,
33093309
unique_name(my_function_name(), datetime.now())
33103310
)
3311+
3312+
time.sleep(2)
3313+
33113314
with self.sess.data_objects.open(data_path,"w") as f:
33123315
f.write(b'_')
3316+
3317+
# At this point, the access_time should be earlier than the modify_time; next we will
3318+
# test that a read() will the update the access timestamp to be equal or greater.
33133319
with self.sess.data_objects.open(data_path,"r") as f:
33143320
f.read()
3315-
33163321
data = self.sess.data_objects.get(data_path)
33173322
self.assertGreaterEqual(data.access_time, data.modify_time)
33183323

irods/test/scripts/test003_write_pam_credentials_to_secrets_file.bats

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,13 @@ except irods.client_init.irodsA_already_exists:
4343
[ -n "$CONTENTS1" -a "$CONTENTS1" = "$CONTENTS2" ]
4444

4545
# Now delete the already existing irodsA and repeat without negating overwrite.
46+
TIMESTAMP_0=$(stat -c%Y $auth_file)
47+
sleep 2
4648
$PYTHON -c "import irods.client_init; irods.client_init.write_pam_irodsA_file('$ALICES_NEW_PAM_PASSWD')"
47-
CONTENTS3=$(cat $auth_file)
48-
[ "$CONTENTS2" != "$CONTENTS3" ]
49+
TIMESTAMP=$(stat -c%Y $auth_file)
50+
51+
# Test only the timestamp of the new auth_file, not the content, since that is implicitly asserted by the next step.
52+
[ $(($TIMESTAMP-TIMESTAMP_0)) -ge 1 ]
4953

5054
# Define the core Python to be run, basically a minimal code block ensuring that we can authenticate to iRODS
5155
# without an exception being raised.

0 commit comments

Comments
 (0)