[CONJ-552] Failed tests: testPwdCharset Created: 2017-11-29  Updated: 2017-12-13  Resolved: 2017-12-12

Status: Closed
Project: MariaDB Connector/J
Component/s: test
Affects Version/s: 2.2.0
Fix Version/s: 2.2.1

Type: Bug Priority: Minor
Reporter: Jakub Janco Assignee: Diego Dupin
Resolution: Fixed Votes: 0
Labels: tests
Environment:

Fedora 27, clean install, openjdk version "1.8.0_151"



 Description   

After I run mvn test, I get this fail:
Failed tests: testPwdCharset(org.mariadb.jdbc.PasswordEncodingTest): must have not have failed for charsetName=UTF-8 which is java default

```
testPwdCharset(org.mariadb.jdbc.PasswordEncodingTest) Time elapsed: 0.02 sec <<< FAILURE!
java.lang.AssertionError: must have not have failed for charsetName=UTF-8 which is java default
at org.junit.Assert.fail(Assert.java:88)
at org.mariadb.jdbc.PasswordEncodingTest.testPwdCharset(PasswordEncodingTest.java:91)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
```



 Comments   
Comment by Diego Dupin [ 2017-12-08 ]

That's probably just due to missing FLUSH PRIVILEGES :

I've added commit https://github.com/MariaDB/mariadb-connector-j/commit/be7de9aa924d17547efe18023fc9e765b0cb6da3 to develop branch.
Could you give a try?

Comment by Jakub Janco [ 2017-12-11 ]

Didnt help:
Failed tests: testPwdCharset(org.mariadb.jdbc.PasswordEncodingTest): must have not have failed for charsetName=UTF-8 which is java default

Comment by Diego Dupin [ 2017-12-11 ]

I'll continue investigate this so.
Can you indicate which java implementation you use, Oracle / openJDK / IBM ... ?

Comment by Jakub Janco [ 2017-12-11 ]

$ java -version
openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)

Comment by Diego Dupin [ 2017-12-11 ]

Tried using Fedora 27 and openjdk version "1.8.0_151" without issue.
(using another existing MariaDB 10.3 server)
Can you describe server version and global configuration (the only reason i would imagine this error is using init commands like @@init_connect forcing connection to use some specific charset) ?

Comment by Diego Dupin [ 2017-12-12 ]

problem identified. The test has been corrected.

Comment by Jakub Janco [ 2017-12-12 ]

I'm using clean/default installation of mariadb in Fedora.
It is still failing.

$ cat /etc/my.cnf
#
# This group is read both both by the client and the server
# use it for options that affect everything
#
[client-server]
 
#
# This group is read by the server
#
[mysqld]
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
 
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d

$ cat /etc/my.cnf.d/mariadb-server.cnf 
#
# These groups are read by MariaDB server.
# Use it for options that only the server (but not clients) should see
#
# See the examples of server my.cnf files in /usr/share/mysql/
#
 
# this is read by the standalone daemon and embedded servers
[server]
 
# this is only for the mysqld standalone daemon
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mysqld/mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
log-error=/var/log/mariadb/mariadb.log
pid-file=/run/mysqld/mariadb.pid
 
 
#
# * Galera-related settings
#
[galera]
# Mandatory settings
#wsrep_on=ON
#wsrep_provider=
#wsrep_cluster_address=
#binlog_format=row
#default_storage_engine=InnoDB
#innodb_autoinc_lock_mode=2
#
# Allow server to accept connections on all interfaces.
#
#bind-address=0.0.0.0
#
# Optional setting
#wsrep_slave_threads=1
#innodb_flush_log_at_trx_commit=0
 
# this is only for embedded server
[embedded]
 
# This group is only read by MariaDB servers, not by MySQL.
# If you use the same .cnf file for MySQL and MariaDB,
# you can put MariaDB-only options here
[mariadb]
 
# This group is only read by MariaDB-10.1 servers.
# If you use the same .cnf file for MariaDB of different versions,
# use this group for options that older servers don't understand
[mariadb-10.1]

Comment by Diego Dupin [ 2017-12-12 ]

issue reproduced, default configuration on fedora has anonymous user ( ''@'localhost' )
the test doesn't work when an anonymous user is present, because it will be preferred to '%' users.

Test is canceled when anonymous user is present,
(running mysql_secure_installation ask to delete this user / or it can be deleted using DROP USER ''@'localhost'

Comment by Diego Dupin [ 2017-12-12 ]

closing now since reproduced and correction solves the issue.

Comment by Jakub Janco [ 2017-12-12 ]

Thanks, this solves the issue.
Maybe some note or another fail message would be useful for others.

Results :
 
Tests run: 983, Failures: 0, Errors: 0, Skipped: 83

Generated at Thu Feb 08 03:16:36 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.