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

Transform dynamic watches integration tests into unit tests #911

Merged
merged 3 commits into from
May 24, 2019

Conversation

sebgl
Copy link
Contributor

@sebgl sebgl commented May 23, 2019

This commit sets up a unit test to cover the integration test scenario
we had for the DynamicEnqueueRequest handler. A very basic integration
test is left to ensure everything correctly fits together, but most of
the logic we wanted to test (and a bit more) is moved into the unit test.

Main benefits:

  • remove complexity from IT (edge cases of 1-2 potential reconciliations,
    wait for something to not happen)
  • remove dependency to test.Timeout in most tests (used both in
    CheckReconcileCalledIn and CheckReconcileNotCalledWithin)
  • faster execution time

Fixes #908.

This commit sets up a unit test to cover the integration test scenario
we had for the DynamicEnqueueRequest handler. A very basic integration
test is left to ensure everything correctly fits together, but most of
the logic we wanted to test (and a bit more) is moved into the unit test.

Main benefits:
* remove complexity from IT complexity (edge cases of 1-2 potential reconciliations,
wait for something to not happen)
* remove dependency to test.Timeout in most tests (used both in
`CheckReconcileCalledIn` and `CheckReconcileNotCalledWithin`)
* faster execution time

// StartManager sets up a manager and controller to perform reconciliations in background.
// It must be stopped by calling the returned function.
func StartManager(t *testing.T, addToMgrFunc func(manager.Manager, operator.Parameters) error, parameters operator.Parameters) (k8s.Client, func()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This comes from #906, should disappear from the diff once #906 is merged.

@sebgl sebgl changed the title Turn most of dynamic watches integration tests into unit tests Transform most of dynamic watches integration tests into unit tests May 23, 2019
@sebgl sebgl changed the title Transform most of dynamic watches integration tests into unit tests Transform dynamic watches integration tests into unit tests May 23, 2019
Copy link
Collaborator

@pebrc pebrc left a comment

Choose a reason for hiding this comment

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

Much better than what we had before!

Copy link
Contributor

@thbkrkr thbkrkr left a comment

Choose a reason for hiding this comment

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

LGTM

@sebgl
Copy link
Contributor Author

sebgl commented May 24, 2019

jenkins test this please

@sebgl sebgl merged commit 4f12828 into elastic:master May 24, 2019
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.

Improve dynamic watches integration tests
3 participants