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

Make the PhishingController test synchronous #929

Merged
merged 2 commits into from Oct 10, 2022
Merged

Conversation

Gudahtt
Copy link
Member

@Gudahtt Gudahtt commented Oct 7, 2022

The test method for the PhishingController was recently made asynchronous so that it could update the phishing configuration if necessary. We found that in practice this was difficult to use, especially when handling multiple simultaneous tests.

The test method has been made synchronous again. Instead we can check whether the config is out of date using the new isOutOfDate method, and explicitly update the configuration if required.

  • BREAKING:

    • [PhishingController] The test method is now synchronous again.
  • ADDED:

    • [PhishingController] Add isOutOfDate method for checking whether the current configuration is outdated

Checklist

  • Tests are included if applicable
  • Any added code is fully documented

@Gudahtt Gudahtt marked this pull request as ready for review October 7, 2022 18:50
@Gudahtt Gudahtt requested a review from a team as a code owner October 7, 2022 18:50
@adonesky1
Copy link
Contributor

adonesky1 commented Oct 7, 2022

Should we add a test that simulates the issue we just ran into to enforce/demonstrate the broken up pattern - that is to say separating out calls to update the lists and run the check? Or otherwise add comments somewhere about why we want to keep test synchronous?

@Gudahtt
Copy link
Member Author

Gudahtt commented Oct 7, 2022

Oh, good point. This is incomplete.

@Gudahtt Gudahtt marked this pull request as draft October 7, 2022 20:08
@Gudahtt Gudahtt changed the title Make the PhishingController test synchronous again Make the PhishingController test synchronous Oct 10, 2022
@Gudahtt Gudahtt changed the base branch from main to prevent-parallel-phishing-updates October 10, 2022 14:42
adonesky1
adonesky1 previously approved these changes Oct 10, 2022
Copy link
Contributor

@adonesky1 adonesky1 left a comment

Choose a reason for hiding this comment

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

With #930 on the docket as well, this LGTM

@Gudahtt
Copy link
Member Author

Gudahtt commented Oct 10, 2022

This PR is now based on #930 , so we'll need to merge that one first. It ended up being easier to reverse the order,

Base automatically changed from prevent-parallel-phishing-updates to main October 10, 2022 16:28
@Gudahtt Gudahtt force-pushed the make-test-synchronous branch 2 times, most recently from b06052b to facb31f Compare October 10, 2022 16:57
The `test` method for the PhishingController was recently made
asynchronous so that it could update the phishing configuration if
necessary. We found that in practice this was difficult to use,
especially when handling multiple simultanous tests.

The `test` method has been made synchronous again. Instead we can check
whether the config is out of date using the new `isOutOfDate` method,
and explicitly update the configuration if required.
@Gudahtt Gudahtt marked this pull request as ready for review October 10, 2022 17:00
@Gudahtt
Copy link
Member Author

Gudahtt commented Oct 10, 2022

This should be ready to review now. test is now documented as using the current configuration, and a warning has been added about ensuring the config is up-to-date first.

Additional tests have been added to isOutOfDate to ensure it works correctly during and after an update. The intent now is that if multiple requests come up while an update is pending, the project should trigger an update for each one and they will all resolve once the update has finished.

adonesky1
adonesky1 previously approved these changes Oct 10, 2022
Copy link
Contributor

@adonesky1 adonesky1 left a comment

Choose a reason for hiding this comment

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

LGTM, just a couple non-blocking questions/comments

Copy link
Contributor

@adonesky1 adonesky1 left a comment

Choose a reason for hiding this comment

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

LGTM!

@Gudahtt Gudahtt merged commit a7de559 into main Oct 10, 2022
@Gudahtt Gudahtt deleted the make-test-synchronous branch October 10, 2022 20:26
gantunesr pushed a commit that referenced this pull request Dec 8, 2022
The `test` method for the PhishingController was recently made
asynchronous so that it could update the phishing configuration if
necessary. We found that in practice this was difficult to use,
especially when handling multiple simultanous tests.

The `test` method has been made synchronous again. Instead we can check
whether the config is out of date using the new `isOutOfDate` method,
and explicitly update the configuration if required.
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
The `test` method for the PhishingController was recently made
asynchronous so that it could update the phishing configuration if
necessary. We found that in practice this was difficult to use,
especially when handling multiple simultanous tests.

The `test` method has been made synchronous again. Instead we can check
whether the config is out of date using the new `isOutOfDate` method,
and explicitly update the configuration if required.
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
The `test` method for the PhishingController was recently made
asynchronous so that it could update the phishing configuration if
necessary. We found that in practice this was difficult to use,
especially when handling multiple simultanous tests.

The `test` method has been made synchronous again. Instead we can check
whether the config is out of date using the new `isOutOfDate` method,
and explicitly update the configuration if required.
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.

None yet

2 participants