Skip to content

Commit

Permalink
Avoid daylight savings time issues in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
greghudson committed Nov 3, 2020
1 parent 3b163ee commit 34ba677
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/tests/t_kdcpolicy.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
'max_renewable_life': '1d'}}}
realm = K5Realm(krb5_conf=krb5_conf, kdc_conf=kdc_conf)

# We will be scraping timestamps from klist to compute lifetimes, so
# use a time zone with no daylight savings time.
realm.env['TZ'] = 'UTC'

realm.run([kadminl, 'addprinc', '-pw', password('fail'), 'fail'])

def verify_time(out, target_time):
Expand Down
4 changes: 4 additions & 0 deletions src/tests/t_renew.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
conf = {'realms': {'$realm': {'max_life': '20h', 'max_renewable_life': '20h'}}}
realm = K5Realm(create_host=False, get_creds=False, kdc_conf=conf)

# We will be scraping timestamps from klist to compute lifetimes, so
# use a time zone with no daylight savings time.
realm.env['TZ'] = 'UTC'

def test(testname, life, rlife, exp_life, exp_rlife, env=None):
global realm
flags = ['-l', life]
Expand Down

0 comments on commit 34ba677

Please sign in to comment.