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

Add unit tests to remaining sync related controllers #212

Merged
merged 5 commits into from
Sep 20, 2023

Conversation

jujaga
Copy link
Member

@jujaga jujaga commented Sep 19, 2023

Description

This PR adds more unit tests to cover off loose ends related to synchronization. It also modifies shutdown behavior so that the pod immediately finishes handling the queue on signal instead of continuing work for another 3 seconds.

  • 3f65f94 Add more unit test coverage to model utils
  • d4f4c8f Add unit tests for sync controller
  • 09d572a Add unit tests for storageService.listAllObjectVersions
  • c77519a Unit test and refactor queueManager close to not recursively spinlock
  • ad75b39 Modify shutdown/cleanup ordering to halt queue processing earlier

SHOWCASE-3328

Types of changes

Bug fix (non-breaking change which fixes an issue)

Checklist

  • I have read the CONTRIBUTING doc
  • I have checked that unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

Previously the terminate signal would come in, but the queue would continue
working for another 3 seconds or so before halting itself. We change it up
so that when the signal comes in, it immediately tells the queue to stop
before doing the 3 second grace period to kill the database connection.

Signed-off-by: Jeremy Ho <jujaga@gmail.com>
There are situations where the spinlock causes a stack overflow instead of
properly waiting for the isBusy state to change. We deal with this by
inverting the control flow to insert in a stored callback reference and
then invoking the callback when isBusy is assigned a false value. This
approach removes the need to poll frequently and instead defers it to the
setter to do the work at the right time.

Signed-off-by: Jeremy Ho <jujaga@gmail.com>
Signed-off-by: Jeremy Ho <jujaga@gmail.com>
Signed-off-by: Jeremy Ho <jujaga@gmail.com>
Skipped trxWrapper coverage due to mock autowiring difficulties

Signed-off-by: Jeremy Ho <jujaga@gmail.com>
@jujaga jujaga added the bug Something isn't working label Sep 19, 2023
@jujaga jujaga self-assigned this Sep 19, 2023
@codeclimate
Copy link

codeclimate bot commented Sep 19, 2023

Code Climate has analyzed commit 3f65f94 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 61.9% (3.1% change).

View more on Code Climate.

@github-actions
Copy link

Coverage Report

Totals Coverage
Statements: 55.83% ( 2632 / 4714 )
Methods: 46.43% ( 293 / 631 )
Lines: 61.96% ( 1583 / 2555 )
Branches: 49.48% ( 756 / 1528 )

@norrisng-bc norrisng-bc merged commit d50302d into master Sep 20, 2023
12 checks passed
@norrisng-bc norrisng-bc deleted the test/queuemanager branch September 20, 2023 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants