1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-10 01:18:15 +03:00

pytest:sid_strings: same timestamp for all tests in the run

We don't care about the exact time of the test, just that we
disambiguate between different runs (each run leaves an immutable scar
on the target server).

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Douglas Bagnall 2023-04-05 15:16:21 +12:00 committed by Andrew Bartlett
parent 489cdc42c4
commit 708d9896aa
2 changed files with 6 additions and 6 deletions

View File

@ -78,12 +78,12 @@ class SidStringTests(TestCase):
session_info=system_session(lp), lp=lp)
cls.base_dn = cls.ldb.domain_dn()
cls.schema_dn = cls.ldb.get_schema_basedn().get_linearized()
cls.timestamp = str(int(time.time()))
def _test_sid_string_with_args(self, code, expected_sid):
random_suffix = random.randint(0, 100000)
timestamp = time.strftime('%s', time.gmtime())
class_name = f'my-Sid-String-Class{timestamp}{random_suffix}'
class_name = f'my-Sid-String-Class-{self.timestamp}-{random_suffix}'
class_ldap_display_name = class_name.replace('-', '')
class_dn = f'CN={class_name},{self.schema_dn}'
@ -126,7 +126,7 @@ schemaUpdateNow: 1
'''
self.ldb.modify_ldif(ldif)
object_name = f'sddl_{timestamp}_{random_suffix}'
object_name = f'sddl_{self.timestamp}_{random_suffix}'
object_dn = f'CN={object_name},{self.base_dn}'
ldif = f'''

View File

@ -1,3 +1,3 @@
^samba.tests.sid_strings.samba.tests.sid_strings.SidStringTests.test_sid_string_Aa.ad_dc
^samba.tests.sid_strings.samba.tests.sid_strings.SidStringTests.test_sid_string_aA.ad_dc
^samba.tests.sid_strings.samba.tests.sid_strings.SidStringTests.test_sid_string_aa.ad_dc
^samba.tests.sid_strings.+.SidStringTests.test_sid_string_Aa.ad_dc
^samba.tests.sid_strings.+.SidStringTests.test_sid_string_aA.ad_dc
^samba.tests.sid_strings.+.SidStringTests.test_sid_string_aa.ad_dc