Skip to content

Conversation

@Jinzhengxu
Copy link
Contributor

@Jinzhengxu Jinzhengxu commented Dec 15, 2022

What is the purpose of the change

This pull request fixes the flaky test 'testAnnotationMultiAvroMeta', which was causing issues with AVRO-3689.

Verifying this change

Run this maven command to reproduce the issue:

mvn -pl lang/java/avro  edu.illinois:nondex-maven-plugin:2.1.1:nondex -Dtest=org.apache.avro.reflect.TestReflect#testAnnotationMultiAvroMeta

Documentation

  • Does this pull request introduce a new feature? (no)
  • If yes, how is the feature documented? (not applicable)

@github-actions github-actions bot added the Java Pull Requests for Java binding label Dec 15, 2022
char[] expectedArrays = expectedString.toCharArray();
Arrays.sort(schmArrays);
Arrays.sort(expectedArrays);
assertEquals(new String(schmArrays), new String(expectedArrays));
Copy link
Contributor

Choose a reason for hiding this comment

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

Well done, may be it should be nice to add nondex plugin in build.
For the fix, i would prefer standard schema comparison, like

    Field field = new Field("a", Schema.create(Schema.Type.INT));
    field.addProp("L", "W");
    field.addProp("K", "V");
    Schema avroMultiMeta = Schema.createRecord("RAvroMultiMeta", null, "org.apache.avro.reflect.TestReflect", false,
      Arrays.asList(field));
    avroMultiMeta.addProp("X", "Y");
    avroMultiMeta.addProp("A", "B");

    Schema schema = ReflectData.get().getSchema(RAvroMultiMeta.class);
    assertEquals(avroMultiMeta, schema);

(In same time, it test Schema.equals method).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the feedback on my pull request. In terms of the fix, I think using a standard schema comparison tool like the one you suggested would be a good idea. I will make the necessary changes and update the pull request accordingly. Thanks again for your suggestion!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And I agree that adding a nondex plugin to the build would be a good idea. Using nondex can improve the reliability and stability of the code, which can help developers ensure that code changes don't result in unexpected outcomes. I will submit a new pull request about adding nondex to Avro for review.

Here is the link to Nondex: https://github.com/TestingResearchIllinois/NonDex. The lastest version can support Java 9+ project.

Copy link
Contributor

@clesaec clesaec left a comment

Choose a reason for hiding this comment

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

THanks for nondex reference.
LGTM,
advice to one avro commiter for merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Java Pull Requests for Java binding

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants