[JAVA-2735] Test failed in LoggingCommandEventSenderSpecification Created: 16/Jan/18  Updated: 28/Oct/23  Resolved: 19/Jan/18

Status: Closed
Project: Java Driver
Component/s: Test Coverage
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Farès Hassak Assignee: Jeffrey Yemin
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: HTML File com.mongodb.connection.LoggingCommandEventSenderSpecification.html     HTML File index.html    

 Description   

Hello,

I can't build master branch due to failed test in

LoggingCommandEventSenderSpecification. should log events

See attachment for more details.



 Comments   
Comment by Githook User [ 18/Jan/18 ]

Author:

{'name': 'Farès Hassak', 'email': 'fares.hassak@gmail.com', 'username': 'fhassak'}

Message: JAVA-2735 : Format decimal numbers (#442)
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/3c2be9f3e23a7635038c36b36e81a553b0bbc46f

Comment by Farès Hassak [ 17/Jan/18 ]

Test is success when i force the locale within Gradle.
In gradle.properties :

org.gradle.jvmargs= -Duser.language=en -Duser.country=US

So, PR 441 is bad idea. i will close it.

But what about runtime (locale depends on jvm) ?

More about locale and jvm : http://www.oracle.com/technetwork/articles/javase/locale-140624.html#using

Farès

Comment by Charles Sarrazin (Inactive) [ 17/Jan/18 ]

What about forcing the locale within Gradle?

Overall, this all depends on whether we want to force the log messages to be formatted in English, or whether we let users override locales.

If we want to make sure that all log entries have the same format, then this should be enforced from within the code. Otherwise, we should not force the locale or string format in the code, but force the format in the gradle build options (forcing the user.language, user.country and user.variant properties).

Comment by Farès Hassak [ 16/Jan/18 ]

-https://github.com/mongodb/mongo-java-driver/pull/441-

https://github.com/mongodb/mongo-java-driver/pull/442

Comment by Farès Hassak [ 16/Jan/18 ]

2 possible solutions :

  • Force Locale to Locale.US when formating

https://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html#format(java.util.Locale,%20java.lang.String,%20java.lang.Object...)

  • Use DecimalFormat

https://docs.oracle.com/javase/7/docs/api/java/text/DecimalFormat.html

like https://github.com/mongodb/mongo-java-driver/commit/cfc43dfaa7038a65ebb3ff88225b9d5ef50c30fe

I will do a 2 PR for 2 solutions

Comment by Farès Hassak [ 16/Jan/18 ]

Maybe It's because I have a different Local (French) :

completed successfully in \\d+\\.
d+ ms

completed successfully in 6,41 ms

regex use '.'
message contains ','

I think it's same issue as https://jira.mongodb.org/browse/JAVA-2625

Comment by Farès Hassak [ 16/Jan/18 ]

yes on windows, i need to investigate (with help of Charles...)

Comment by Jeffrey Yemin [ 16/Jan/18 ]

I assume this is on Windows? Any hypothesis yet as to why the tests are failing?

Generated at Thu Feb 08 08:57:57 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.