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

Fix warnings and tests for missing script values #32382

Merged

Conversation

mayya-sharipova
Copy link
Contributor

For main code:

  • ScriptModule will NOT produce a deprecation warning anymore,
    when es.scripting.exception_for_missing_value is not set.
    This warning is produced only when missing values in script are used and
    is produced only once.

For tests:

  • make es.scripting.exception_for_missing_value equal to false
    by default in tests. This behaviour is similar with default
    node settings, and with tests running from IDE.

  • modify ScriptDocValuesMissingV6BehaviourTests to test the default
    behaviour in v6, where there are default values for missing values.

  • add ScriptDocValuesMissingV7BehaviourTests to test the default
    behavior in v7 where es.scripting.exception_for_missing_value
    is set to true, and where exceptions are produced for missing
    values.

Relates to #29286

@mayya-sharipova mayya-sharipova added v6.5.0 >test Issues or PRs that are addressing/adding tests :Core/Infra/Scripting Scripting abstractions, Painless, and Mustache labels Jul 25, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

@mayya-sharipova mayya-sharipova requested a review from rjernst July 25, 2018 21:35
@mayya-sharipova mayya-sharipova force-pushed the deprecate-script-missing-values branch 3 times, most recently from 336d52f to 1cd0bcb Compare August 8, 2018 12:35
`-Des.scripting.exception_for_missing_value=true` on a node. If you do not enable
this behavior, a deprecation warning is logged on start up.
`-Des.scripting.exception_for_missing_value=true` on a node. If you do not
enable this behavior, a one-time deprecation warning is logged when painless
Copy link
Member

Choose a reason for hiding this comment

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

For other deprecated uses that potentially happen a lot, we have used deprecationLog.deprecatedAndMaybeLog. I think that would be better here. See other deprecated examples inside ScriptDocValues

For main code:
- ScriptModule will NOT produce a deprecation warning anymore,
when `es.scripting.exception_for_missing_value` is not set.
This warning is produced only when missing values in script are used and
is produced only once.

For tests:
- make `es.scripting.exception_for_missing_value` equal to `false`
by default in tests. This behaviour is similar with default
node settings, and with tests running from IDE.

- modify `ScriptDocValuesMissingV6BehaviourTests` to test the default
behaviour in v6, where there are default values for missing values.

- add `ScriptDocValuesMissingV7BehaviourTests` to test the default
behavior in v7 where `es.scripting.exception_for_missing_value`
is set to `true`, and where exceptions are produced for missing
values.

Relates to elastic#29286
@mayya-sharipova mayya-sharipova force-pushed the deprecate-script-missing-values branch from 1cd0bcb to 2c8b9ae Compare August 13, 2018 17:21
@mayya-sharipova
Copy link
Contributor Author

@elasticmachine run sample packaging tests

Copy link
Member

@rjernst rjernst left a comment

Choose a reason for hiding this comment

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

A couple more questions

`-Des.scripting.exception_for_missing_value=true` on a node. If you do not enable
this behavior, a deprecation warning is logged on start up.
`-Des.scripting.exception_for_missing_value=true` on a node. If you do not
enable this behavior, a one-time deprecation warning is logged for each
Copy link
Member

Choose a reason for hiding this comment

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

I think this explanation needs to be updated given the use of deprecatedAndMaybeLog?

@@ -135,12 +128,12 @@ public Void run() {
}
}, noPermissionsAcc);

assertThat(warnings, containsInAnyOrder(
assertThat(warnings, hasItems(
Copy link
Member

Choose a reason for hiding this comment

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

This seems to be making the check lenient, so other warnings could also exist. I think this test should be verify all warnings that are emitted?

public boolean enableWarningsCheck() {
// missing values has some deprecated warnings
// that only are output once which is not easy to check
// that's why we disable warnings' checking
Copy link
Member

Choose a reason for hiding this comment

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

This is no longer true right? And isn't the purpose of this test to check those warnings?

@mayya-sharipova mayya-sharipova force-pushed the deprecate-script-missing-values branch from ea36d72 to 67df5d8 Compare August 24, 2018 10:19
@mayya-sharipova
Copy link
Contributor Author

@rjernst Ryan, can you please continue to review this PR, when you have time. I have tried to address your comments.

Copy link
Member

@rjernst rjernst left a comment

Choose a reason for hiding this comment

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

Thanks @mayya-sharipova. LGTM

@mayya-sharipova mayya-sharipova merged commit 64d1be9 into elastic:6.x Sep 10, 2018
@mayya-sharipova mayya-sharipova deleted the deprecate-script-missing-values branch September 10, 2018 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/Scripting Scripting abstractions, Painless, and Mustache >test Issues or PRs that are addressing/adding tests v6.5.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants