testcontainers / testcontainers-java

Testcontainers is a Java library that supports JUnit tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.
https://testcontainers.org
MIT License
7.89k stars 1.62k forks source link

[Bug]: Can't use MariaDB root user. #8846

Open kmagdziarz opened 6 days ago

kmagdziarz commented 6 days ago

Module

MariaDB

Testcontainers version

1.19.8

Using the latest Testcontainers version?

Yes

Host OS

MacOS

Host Arch

ARM

Docker version

Client:
 Version:           26.1.4
 API version:       1.45
 Go version:        go1.21.11
 Git commit:        5650f9b
 Built:             Wed Jun  5 11:26:02 2024
 OS/Arch:           darwin/arm64
 Context:           desktop-linux

Server: Docker Desktop 4.31.0 (153195)
 Engine:
  Version:          26.1.4
  API version:      1.45 (minimum version 1.24)
  Go version:       go1.21.11
  Git commit:       de5c9cf
  Built:            Wed Jun  5 11:29:12 2024
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.6.33
  GitCommit:        d2d58213f83a351ca8f528a95fbd145f5654e957
 runc:
  Version:          1.1.12
  GitCommit:        v1.1.12-0-g51d5e94
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

What happened?

It is impossible to create MariaDB testContainer with root user as the code now is always trying to create new user.

Basically same issue as the one fixed here for MySQL. https://github.com/testcontainers/testcontainers-java/pull/3953/files#diff-2568f90aa8a2109ff614414c5ef2b547f6bd7e8b8d4db9e81130d091b3e5d67c

Relevant log output

2024-07-04 13:30:58 ERROR 1396 (HY000) at line 29: Operation CREATE USER failed for 'root'@'%'

Additional Information

No response

eddumelendez commented 5 days ago

Please, provide the mariadb image

kmagdziarz commented 2 days ago

Sure @eddumelendez, sorry that I forgot to provided that. I used this one: mariadb:11.2.4