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

add checks to existing unit tests #1104

Merged
merged 1 commit into from
Jul 24, 2024
Merged

add checks to existing unit tests #1104

merged 1 commit into from
Jul 24, 2024

Conversation

al-niessner
Copy link
Contributor

Description

Shows that 'a:b:c::2.0' works on main but not 2.x branches.

Issues Resolved

#1103

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.

@al-niessner
Copy link
Contributor Author

al-niessner commented Jul 23, 2024

What would you like added to change log since this is just unit test changes and not overly complicated changes. Given the minor changes, not sure why so many red 'X's are showing up.

@dblock
Copy link
Member

dblock commented Jul 23, 2024

We can skip the changelog, but not sure what's up with the integ test failure.

Execution failed for task ':java-client:compileTestJava'.
> Could not resolve all files for configuration ':java-client:testCompileClasspath'.
   > Could not find any matches for software.amazon.awssdk:aws-crt-client:[2.15,3.0) as no versions of software.amazon.awssdk:aws-crt-client are available.

Is it caused by this import which attempts to bring the kitchen sink from OpenSearch?

import org.opensearch.client.opensearch.core.GetRequest;

@al-niessner
Copy link
Contributor Author

We can skip the changelog, but not sure what's up with the integ test failure.

Execution failed for task ':java-client:compileTestJava'.
> Could not resolve all files for configuration ':java-client:testCompileClasspath'.
   > Could not find any matches for software.amazon.awssdk:aws-crt-client:[2.15,3.0) as no versions of software.amazon.awssdk:aws-crt-client are available.

Is it caused by this import which attempts to bring the kitchen sink from OpenSearch?

import org.opensearch.client.opensearch.core.GetRequest;

Is there a different GetRequest I should be importing? I have all the amazon cruft in my environment so does not matter to me. I think the point is that the GetRequest is not the same on main as 2.x. It is the encoding of the ID that we ultimately care about (my project) and the RefreshRequest is insufficient to test the ID encoding. Probably similar failure with DeleteByQueryRequest too but maybe fixing GetRequest (or its root cause) will fix the DBQR as well.

@al-niessner
Copy link
Contributor Author

I take it back. My gradle build in eclipse is showing 3 errors in the integrations tests but it looks like eclipse is java 8 while these tests are in src/test/java11 so I am going to say that it local to me. Still the changes I made should not make any difference to your build beyond importing from core somehow being evil.

@Xtansia
Copy link
Collaborator

Xtansia commented Jul 24, 2024

The failures were completely unrelated to the changes in this PR, just got unlucky and they ran at the exact time a release of AWS SDK was happening, so got some of the newer version libraries while their dependencies hadn't been pushed to maven yet.

@Xtansia
Copy link
Collaborator

Xtansia commented Jul 24, 2024

Only failures now are DCO and spotless check.

Copy link
Member

@dblock dblock left a comment

Choose a reason for hiding this comment

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

@Xtansia bah! Thanks for digging into it.

@al-niessner Please fix the spotless linter and DCO (git commit --amend -s and force push) and let's merge this test and see it fail in 2.x?

@al-niessner
Copy link
Contributor Author

Sorry I see two MAC build fails and DCO. What is spotless?

@dblock
Copy link
Member

dblock commented Jul 24, 2024

Sorry I see two MAC build fails and DCO. What is spotless?

Check out https://github.com/opensearch-project/OpenSearch/blob/main/DEVELOPER_GUIDE.md#java-language-formatting-guidelines, we use the same linter here.

From https://github.com/opensearch-project/opensearch-java/actions/runs/10079173830/job/27865902771?pr=1104

* What went wrong:
Execution failed for task ':java-client:spotlessJavaCheck'.
> The following files had format violations:
      src/test/java/org/opensearch/client/opensearch/model/EndpointTest.java
          @@ -39,11 +39,11 @@
           import·org.opensearch.client.opensearch.indices.RefreshRequest;
           
           public·class·EndpointTest·extends·Assert·{
          -··@Test
          -··public·void·testIdEncoding()·{
          -····GetRequest·req·=·new·GetRequest.Builder().index("db").id("a:b:c::2.0").build();
          -····assertEquals·("/db/_doc/a%3Ab%3Ac%3A%3A2.0",·GetRequest._ENDPOINT.requestUrl(req));
          -··}
          +····@Test
          +····public·void·testIdEncoding()·{
          +········GetRequest·req·=·new·GetRequest.Builder().index("db").id("a:b:c::2.0").build();
          +········assertEquals("/db/_doc/a%3Ab%3Ac%3A%3A2.0",·GetRequest._ENDPOINT.requestUrl(req));
          +····}
           
           ····@Test
           ····public·void·testArrayPathParameter()·{
      src/test/java/org/opensearch/client/util/PathEncoderTest.java
          @@ -40,5 +40,5 @@
           ········String·colonSegmentString·=·"a:b:c::2.0";
           ········String·encodedColonSegmentString·=·PathEncoder.encode(colonSegmentString);
           ········assertEquals("a%3Ab%3Ac%3A%3A2.0",·encodedColonSegmentString);
          -···}
          +····}
           }
  Run './gradlew :java-client:spotlessApply' to fix these violations.

You should be able to ./gradlew :java-client:spotlessApply as instructed to fix this one.

@al-niessner
Copy link
Contributor Author

Oh, I see. I thought MacOS-latest was some attempt to build the latest main branch on a MacOS. Anyway, followed directions in the output and used gradlew to fix it.

One for EndpointTest that checks for the GetRequest.id() being correctly encoded. One for PathEncodingTesst to verify that ":" is being encoded.

Updated for spotless.

Signed-off-by: Al Niessner <Al.Niessner@xxx.xxx>
@al-niessner al-niessner requested a review from dblock July 24, 2024 15:42
@dblock dblock added the backport 2.x Backport to 2.x branch label Jul 24, 2024
@dblock dblock merged commit c098d8b into opensearch-project:main Jul 24, 2024
59 of 60 checks passed
@dblock dblock added backport 2.x Backport to 2.x branch and removed backport 2.x Backport to 2.x branch labels Jul 24, 2024
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jul 24, 2024
One for EndpointTest that checks for the GetRequest.id() being correctly encoded. One for PathEncodingTesst to verify that ":" is being encoded.

Updated for spotless.

Signed-off-by: Al Niessner <Al.Niessner@xxx.xxx>
Co-authored-by: Al Niessner <Al.Niessner@xxx.xxx>
(cherry picked from commit c098d8b)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Backport to 2.x branch skip-changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants