Skip to content

Commit

Permalink
ipatests: some tests are date-sensitive and fail Feb 29
Browse files Browse the repository at this point in the history
A few tests are changing the date back and forth using for
instance date -s +3Years+1day and date -s -3Years-1day.
This method does not bring the system back to the current date
if executed around Feb 28 or 29 on a leap year, and may result
in de-synchronized server and client.

Add a note in the test to warn about potential future failures.

Related: https://pagure.io/freeipa/issue/9548

Signed-off-by: Florence Blanc-Renaud <flo@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
  • Loading branch information
flo-renaud committed Mar 1, 2024
1 parent f4a1696 commit 558a7de
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ipatests/test_integration/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -1575,6 +1575,17 @@ def test_ipa_context_manager(self):
# upload script and run with Python executable
script = "/tmp/example_cli.py"
host.put_file_contents(script, contents)
# Important: this test is date-sensitive and may fail if executed
# around Feb 28 or Feb 29 on a leap year.
# The previous tests are playing with the date by jumping in the
# future and back to the (expected) current date but calling
# date -s +15Years and then date -s -15Years doesn't
# bring the date back to the original value if called around Feb 29.
# As a consequence, client and server are not synchronized any more
# and client API authentication may fail with the following error:
# ipalib.errors.KerberosError:
# No valid Negotiate header in server response
# If you see this failure, just ignore and relaunch on March 1.
result = host.run_command([sys.executable, script])

# script prints admin account
Expand Down
11 changes: 11 additions & 0 deletions ipatests/test_integration/test_ipa_cert_fix.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,17 @@ def install(cls, mh):
tasks.install_master(
mh.master, setup_dns=False, extra_args=['--no-ntp']
)
# Important: this test is date-sensitive and may fail if executed
# around Feb 28 or Feb 29 on a leap year.
# The previous tests are playing with the date by jumping in the
# future and back to the (expected) current date but calling
# date -s +3Years+1day and then date -s -3Years-1day doesn't
# bring the date back to the original value if called around Feb 29.
# As a consequence, client and server are not synchronized any more
# and client installation may fail with the following error:
# Joining realm failed: JSON-RPC call failed:
# SSL peer certificate or SSH remote key was not OK
# If you see this failure, just ignore and relaunch on March 1.
tasks.install_replica(
mh.master, mh.replicas[0],
setup_dns=False, extra_args=['--no-ntp']
Expand Down

0 comments on commit 558a7de

Please sign in to comment.