-
Notifications
You must be signed in to change notification settings - Fork 134
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
[Tests] Test utils update to fix IT tests for serverless #2869
Conversation
@@ -772,6 +779,29 @@ public static String getResponseBody(Response response, boolean retainNewLines) | |||
return sb.toString(); | |||
} | |||
|
|||
// TODO: this is temporary fix for fixing serverless tests to pass with 2 digit precision value |
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.
any thoughts on what should be long term fix for this and other temp fixes? Also, should we create issues to track long term fix?
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.
ya I can check with serverless team on this and see if we need a issue to track the long term fix.
integ-test/src/test/java/org/opensearch/sql/sql/AggregationIT.java
Outdated
Show resolved
Hide resolved
integ-test/src/test/java/org/opensearch/sql/util/MatcherUtils.java
Outdated
Show resolved
Hide resolved
integ-test/src/test/java/org/opensearch/sql/util/MatcherUtils.java
Outdated
Show resolved
Hide resolved
integ-test/src/test/java/org/opensearch/sql/util/TestUtils.java
Outdated
Show resolved
Hide resolved
@@ -123,6 +118,18 @@ public static Response performRequest(RestClient client, Request request) { | |||
} | |||
return response; | |||
} catch (IOException e) { | |||
if (e instanceof ResponseException | |||
&& ((ResponseException) e).getResponse().getStatusLine().getStatusCode() == 400 | |||
&& e.getMessage().contains("true refresh policy is not supported.")) { |
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.
Is it safe to match with message? If there is no other way, that's fine as it is test code, but error message tends to be easily changed.
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 looked into specific exception we get for refresh policy related error. But today its wrapped as ResponseException
. I think I need to have this check to make sure I'm retrying exactly for the refresh issue only. As it is a test code, if there are message updates on the exception, tests would fail and we might have to adjust the message here for that in future.
@@ -123,6 +118,18 @@ public static Response performRequest(RestClient client, Request request) { | |||
} | |||
return response; | |||
} catch (IOException e) { | |||
if (e instanceof ResponseException |
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.
Can't we remove the refresh policy when it is requesting collection from the beginning?
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 don't think the URL with refresh policy token is set during @before setup or during client connection. I see we have few tests which adds this token within test files before submitting query like this: https://github.com/opensearch-project/sql/blob/main/integ-test/src/test/java/org/opensearch/sql/sql/IdentifierIT.java#L245 All those tests rely on this test util function, so I thought of adding the retry here.
0bdeec9
to
278a2d3
Compare
Signed-off-by: Manasvini B S <manasvis@amazon.com>
278a2d3
to
c72c89a
Compare
Signed-off-by: Manasvini B S <manasvis@amazon.com> (cherry picked from commit 7e73f12) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
…2869) Signed-off-by: Manasvini B S <manasvis@amazon.com>
…2869) Signed-off-by: Manasvini B S <manasvis@amazon.com>
Description
Issues Resolved
[List any issues this PR will resolve]
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.