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

minor: remove testLocaleIsSupported tests #11544

Merged
merged 1 commit into from
Apr 16, 2022
Merged

Conversation

pbludov
Copy link
Member

@pbludov pbludov commented Apr 12, 2022

These tests are useless. If the user.language property is set to anything else but English, 200+ tests will fail.
So we need a dedicated test suite to validate all supported languages.

* the violation does not use the default value.
*/
@Test
public void testLocaleIsSupported() {
Copy link
Member

Choose a reason for hiding this comment

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

It was created at 8a4b6e0

Copy link
Member

Choose a reason for hiding this comment

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

The only way we can keep such a test is if we confirm we have a property file for the language we are testing against as @pbludov demonstrated at #11544 (comment) .

@romani
Copy link
Member

romani commented Apr 13, 2022

If the user.language property is set to anything else but English, 200+ tests will fail.

Is it because -DargLine='-Duser.language=ja is not actually working?

Can you share command and some part of output?

@rnveach
Copy link
Member

rnveach commented Apr 14, 2022

These tests are useless. If the user.language property is set to anything else but English, 200+ tests will fail.

This statement conflicts with the correction for the language run in #11529 which is run under russian. We only got 2 test failures and not 200+ (see #11529 (comment) ). As best I can tell, the fix is valid that we are now running with russian in that PR and not english.

Can you explain this?

@pbludov
Copy link
Member Author

pbludov commented Apr 14, 2022

$ sudo apt install language-pack-fr

$ LANG=fr_FR.UTF-8 mvn test

....

[ERROR] Tests run: 3788, Failures: 177, Errors: 0, Skipped: 0
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------

There are many failed tests similar to

expected to match: 29:(?:\d+:)?\s.*'while' is not followed by whitespace.*
but was          : 29:11: Il manque une espace après 'while'.

@pbludov
Copy link
Member Author

pbludov commented Apr 14, 2022

$ sudo apt install language-pack-ru

Patch branch

$ LANG=ru_RU.UTF-8 mvn test

....

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

Master branch

$ LANG=ru_RU.UTF-8 mvn test

....

[ERROR] Tests run: 22, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.122 s <<< FAILURE! - in com.puppycrawl.tools.checkstyle.api.ViolationTest
[ERROR] testLocaleIsSupported  Time elapsed: 0.042 s  <<< FAILURE!
com.google.common.truth.AssertionErrorWithFacts: 
Unsupported language: ru_RU
expected not to be: Empty statement.
        at com.puppycrawl.tools.checkstyle.api.ViolationTest.testLocaleIsSupported(ViolationTest.java:93)

....

[ERROR] Tests run: 15, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.015 s <<< FAILURE! - in com.puppycrawl.tools.checkstyle.DefaultLoggerTest
[ERROR] testLocaleIsSupported  Time elapsed: 0.002 s  <<< ERROR!
java.lang.NoSuchMethodException: com.puppycrawl.tools.checkstyle.DefaultLogger$LocalizedMessage.<init>(java.lang.String,[Ljava.lang.String;)
        at com.puppycrawl.tools.checkstyle.DefaultLoggerTest.testLocaleIsSupported(DefaultLoggerTest.java:254)

....
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------

@pbludov
Copy link
Member Author

pbludov commented Apr 14, 2022

Can you explain this?

We got two failures because all messages for any unsupported language are messages in English actually.
And these tests verify this fact.

If any supported language (except English) is set as the default system language, all messages will be different. And many tests will fail.

@rnveach
Copy link
Member

rnveach commented Apr 14, 2022

Thanks for the clarification. This makes sense now.

Copy link
Member

@rnveach rnveach left a comment

Choose a reason for hiding this comment

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

I am ok with this change, but I would prefer we found some kind of replacement for the tests as talked about in #11544 (comment) .

@romani
Copy link
Member

romani commented Apr 16, 2022

Ok , we are going to enforce English during test execution, bdd nature of tests are forcing us to do this.

So execution in any locale will be same and not problematic.

@romani
Copy link
Member

romani commented Apr 16, 2022

@pbludov , please change commit to reference this PR, it has very valuable conversation that are not obvious. Let's keep it in history.

@romani romani assigned pbludov and unassigned romani Apr 16, 2022
@pbludov
Copy link
Member Author

pbludov commented Apr 16, 2022

@pbludov , please change commit to reference this PR, it has very valuable conversation that are not obvious. Let's keep it in history.

done

@romani romani merged commit 6ccc24e into checkstyle:master Apr 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants