Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix termination tests randomly timing out #68

Merged

Conversation

mresvanis
Copy link
Contributor

@mresvanis mresvanis commented Jul 11, 2023

Unit tests are run in random order. Termination tests also verify the polling logic of the respective code, by atomically incrementing a counter in each call of the HTTP handler. The issues fixed with these changes are:

  1. counter var not being reset after each termination test using polling
  2. using the polling iterations loop in termination tests that were not using the HTTP handler that increments the counter
  3. polling iterations loop not using sleep between iterations, which spikes CPU usage

The first two issues led to the termination tests sometimes passing, depending on which termination test run first. If it was a test that incremented the polling counter, then all other tests would be successful as well. If it was a test that didn't increment the polling counter (because it wasn't using the respective HTTP handler), then the termination tests would be stuck in an endless loop, until the unit tests reached a timeout.

Unit tests are run in random order. Termination tests also verify the
polling logic of the respective code, by atomically incrementing a
counter in each call of the HTTP handler. The issues fixed with these
changes are:

1. counter var not being reset after each termination test using polling
2. using the polling iterations loop in termination tests that were not
   using the HTTP handler that increments the counter
3. polling iterations loop not using sleep between iterations, which
   spikes CPU usage

The first two issues led to the termination tests sometimes passing,
depending on which termination test run first. If it was a test that
incremented the polling counter, then all other test would be successful
as well. If it was a test that didn't increment the polling counter,
then the termination tests would be stuck in an endless loop, until the
unit tests reached a timeout.

Signed-off-by: Michail Resvanis <mresvani@redhat.com>
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 11, 2023

@mresvanis: all tests passed!

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@mresvanis
Copy link
Contributor Author

/cc @elmiko

Copy link
Contributor

@elmiko elmiko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the detailed explanation and the fix @mresvanis !

/approve
/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jul 14, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 14, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: elmiko

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 14, 2023
@openshift-merge-robot openshift-merge-robot merged commit d8cb917 into openshift:main Jul 14, 2023
5 checks passed
@mresvanis mresvanis deleted the fix-termination-unit-tests branch July 17, 2023 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants