Skip to content

Conversation

@pugnascotia
Copy link
Contributor

@pugnascotia pugnascotia commented Aug 21, 2019

Closes #28450. Convert most awaitBusy calls to assertBusy, and use asserts where possible.

This PR follows on from #28548 by @liketic. However, given the time elapsed since that PR, I implemented the changes from scratch instead of trying to merge (which would probably have taken longer). The PR was still useful though - thanks!

There were a small number of places where it didn't make sense to me to call assertBusy, so I kept the existing calls but renamed the method to waitUntil. This was partly to better reflect its usage, and partly so that anyone trying to add a new call to awaitBusy wouldn't be able to find it.

I also didn't change the usage in TransportStopRollupAction as the comments state that the local awaitBusy method is a temporary copy-and-paste. If @polyfractal can tell me whether and how it can be removed, I'm happy to do it.

Tagging @javanna as he reviwed the original PR.

@pugnascotia pugnascotia added >test Issues or PRs that are addressing/adding tests :Core/Infra/Core Core issues without another label v8.0.0 labels Aug 21, 2019
@pugnascotia pugnascotia requested review from javanna and rjernst August 21, 2019 14:28
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

@polyfractal
Copy link
Contributor

Let's leave the c/p of awaitBusy in TransportStopRollupAction alone for now if you don't mind. We're using it as an actual await, not an assertion (it's waiting for the local job, on a different thread, to tick over to a new state). We currently check the return value, and have the whole thing wrapped in a try too.

The comments reference a different refactor which got shelved, but I think this will be going away soon anyway because we have a different refactor in mind which would obviate the need for it :)

@pugnascotia
Copy link
Contributor Author

@elasticmachine run elasticsearch-ci/2

2 similar comments
@pugnascotia
Copy link
Contributor Author

@elasticmachine run elasticsearch-ci/2

@pugnascotia
Copy link
Contributor Author

@elasticmachine run elasticsearch-ci/2

@pugnascotia
Copy link
Contributor Author

@elasticmachine update branch

@hendrikmuhs
Copy link

@pugnascotia

The labels indicate this is for 8.0 only. Is this correct? no plans for a backport to 7.x? I would like to backport some of your bugfixes to 7.x (all transform related ones).

@pugnascotia
Copy link
Contributor Author

@elasticmachine update branch

@pugnascotia
Copy link
Contributor Author

@hendrikmuhs there's no plan to backport, but I can look into that once I finally get this PR merged.

@ywelsch ywelsch added the v7.5.0 label Sep 25, 2019
@ywelsch
Copy link
Contributor

ywelsch commented Sep 25, 2019

I think this should definitely be backported to 7.x (I took the liberty to add the v7.5.0 label). Having the codebase diverge between master and 7.x without good reasons will complicate any other backports in the future. Perhaps the lesson learned here is to keep these PRs smaller and doing this kind of work more incrementally 😄

@pugnascotia
Copy link
Contributor Author

A CI that wasn't flaky would help too 😉

@pugnascotia pugnascotia merged commit 9dd155c into elastic:master Sep 25, 2019
@pugnascotia pugnascotia deleted the 28450-remove-await-busy branch September 25, 2019 10:46
pugnascotia added a commit to pugnascotia/elasticsearch that referenced this pull request Sep 25, 2019
Backport of elastic#45794 to 7.x. Convert most `awaitBusy` calls to
`assertBusy`, and use asserts where possible. Follows on from elastic#28548 by
@liketic.

There were a small number of places where it didn't make sense to me to
call `assertBusy`, so I kept the existing calls but renamed the method to
`waitUntil`. This was partly to better reflect its usage, and partly so
that anyone trying to add a new call to awaitBusy wouldn't be able to find
it.

I also didn't change the usage in `TransportStopRollupAction` as the
comments state that the local awaitBusy method is a temporary
copy-and-paste.

Other changes:

  * Rework `waitForDocs` to scale its timeout. Instead of calling
    `assertBusy` in a loop, work out a reasonable overall timeout and await
    just once.
  * Some tests failed after switching to `assertBusy` and had to be fixed.
  * Correct the expect templates in AbstractUpgradeTestCase.  The ES
    Security team confirmed that they don't use templates any more, so
    remove this from the expected templates. Also rewrite how the setup
    code checks for templates, in order to give more information.
  * Remove an expected ML template from XPackRestTestConstants The ML team
    advised that the ML tests shouldn't be waiting for any
    `.ml-notifications*` templates, since such checks should happen in the
    production code instead.
  * Also rework the template checking code in `XPackRestTestHelper` to give
    more helpful failure messages.
@pugnascotia
Copy link
Contributor Author

Backport PR is #47112.

@pugnascotia
Copy link
Contributor Author

Thanks again to @liketic for the original PR!

pugnascotia added a commit that referenced this pull request Sep 29, 2019
Backport of #45794 to 7.x. Convert most `awaitBusy` calls to
`assertBusy`, and use asserts where possible. Follows on from #28548 by
@liketic.

There were a small number of places where it didn't make sense to me to
call `assertBusy`, so I kept the existing calls but renamed the method to
`waitUntil`. This was partly to better reflect its usage, and partly so
that anyone trying to add a new call to awaitBusy wouldn't be able to find
it.

I also didn't change the usage in `TransportStopRollupAction` as the
comments state that the local awaitBusy method is a temporary
copy-and-paste.

Other changes:

  * Rework `waitForDocs` to scale its timeout. Instead of calling
    `assertBusy` in a loop, work out a reasonable overall timeout and await
    just once.
  * Some tests failed after switching to `assertBusy` and had to be fixed.
  * Correct the expect templates in AbstractUpgradeTestCase.  The ES
    Security team confirmed that they don't use templates any more, so
    remove this from the expected templates. Also rewrite how the setup
    code checks for templates, in order to give more information.
  * Remove an expected ML template from XPackRestTestConstants The ML team
    advised that the ML tests shouldn't be waiting for any
    `.ml-notifications*` templates, since such checks should happen in the
    production code instead.
  * Also rework the template checking code in `XPackRestTestHelper` to give
    more helpful failure messages.
  * Fix issue in `DataFrameSurvivesUpgradeIT` when upgrading from < 7.4
@pugnascotia
Copy link
Contributor Author

I've merged the backport to 7.x.

DaveCTurner added a commit to DaveCTurner/elasticsearch that referenced this pull request Mar 26, 2020
Retries in this method were lost in elastic#45794. This commit reinstates them.
DaveCTurner added a commit that referenced this pull request Mar 26, 2020
Retries in this method were lost in #45794. This commit reinstates them.
DaveCTurner added a commit that referenced this pull request Mar 26, 2020
Retries in this method were lost in #45794. This commit reinstates them.
DaveCTurner added a commit that referenced this pull request Mar 26, 2020
Retries in this method were lost in #45794. This commit reinstates them.
DaveCTurner added a commit that referenced this pull request Mar 26, 2020
Retries in this method were lost in #45794. This commit reinstates them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Core/Infra/Core Core issues without another label >test Issues or PRs that are addressing/adding tests v7.5.0 v8.0.0-alpha1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

awaitBusy returns a boolean!?!