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 a coverage test for pantsd garbage collection, and fix type error #9271

Merged

Conversation

stuhood
Copy link
Member

@stuhood stuhood commented Mar 11, 2020

Problem

StoreGCService was expecting a SchedulerSession, but getting a Scheduler. This meant that if pantsd ran long enough (the default value for "long enough" was too long to ever be caught in tests), it would crash with a failure to call lease_files_in_graph due to the method signature change in #9015.

Solution

Although just adding enough type hints here would hypothetically be enough for mypy to catch this (?), additionally added a coverage test for StoreGCService.

Result

pantsd stays up as long as it should.

@stuhood stuhood added this to the 1.26.x milestone Mar 11, 2020
@stuhood stuhood force-pushed the stuhood/coverage-test-for-store-gc-service branch from cb61011 to abc3d5a Compare March 11, 2020 16:03
Copy link
Member

@hrfuller hrfuller left a comment

Choose a reason for hiding this comment

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

Looks good!

Copy link
Contributor

@Eric-Arellano Eric-Arellano 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 fixing this!

# Ensure that the thread runs successfully for long enough to have run each step at least once.
# TODO: This is a coverage test: although it could examine the internal details of the service
# to validate correctness, we don't do that yet.
time.sleep(interval_secs * 10)
Copy link
Contributor

Choose a reason for hiding this comment

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

Have you tried running this multiple times to test for flakiness? Note that you'd need to use the V1 test runner because of V2's caching.

Copy link
Member Author

Choose a reason for hiding this comment

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

I have not, but I believe that the deltas here are sufficient to avoid flakes. If not, they should be very easy to tune.

@stuhood stuhood force-pushed the stuhood/coverage-test-for-store-gc-service branch from abc3d5a to 28fb234 Compare March 11, 2020 23:51
@stuhood stuhood merged commit 2f6ccdc into pantsbuild:master Mar 12, 2020
@stuhood stuhood deleted the stuhood/coverage-test-for-store-gc-service branch March 12, 2020 01:24
stuhood added a commit that referenced this pull request Mar 12, 2020
#9271)

### Problem

`StoreGCService` was expecting a `SchedulerSession`, but getting a `Scheduler`. This meant that if `pantsd` ran long enough (the default value for "long enough" was too long to ever be caught in tests), it would crash with a failure to call `lease_files_in_graph` due to the method signature change in #9015.

### Solution

Although just adding enough type hints here would hypothetically be enough for mypy to catch this (?), additionally added a coverage test for `StoreGCService`.

### Result

`pantsd` stays up as long as it should.
wisechengyi pushed a commit that referenced this pull request May 4, 2020
#9271)

### Problem

`StoreGCService` was expecting a `SchedulerSession`, but getting a `Scheduler`. This meant that if `pantsd` ran long enough (the default value for "long enough" was too long to ever be caught in tests), it would crash with a failure to call `lease_files_in_graph` due to the method signature change in #9015.

### Solution

Although just adding enough type hints here would hypothetically be enough for mypy to catch this (?), additionally added a coverage test for `StoreGCService`.

### Result

`pantsd` stays up as long as it should.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants