-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Fix warnings and tests for missing script values #32382
Conversation
Pinging @elastic/es-core-infra |
336d52f
to
1cd0bcb
Compare
`-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 |
There was a problem hiding this comment.
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
1cd0bcb
to
2c8b9ae
Compare
@elasticmachine run sample packaging tests |
There was a problem hiding this 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 |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
ea36d72
to
67df5d8
Compare
@rjernst Ryan, can you please continue to review this PR, when you have time. I have tried to address your comments. |
There was a problem hiding this 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
For main code:
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 tofalse
by default in tests. This behaviour is similar with default
node settings, and with tests running from IDE.
modify
ScriptDocValuesMissingV6BehaviourTests
to test the defaultbehaviour in v6, where there are default values for missing values.
add
ScriptDocValuesMissingV7BehaviourTests
to test the defaultbehavior in v7 where
es.scripting.exception_for_missing_value
is set to
true
, and where exceptions are produced for missingvalues.
Relates to #29286