google/keytransparency

Integration tests are not working with docker-compose mysql

Zyqsempai opened this issue · 2 comments

After fixing this one #1182 I am getting thi error.

 Could not create Env: env: failed to open database: error running statement "CREATE DATABASE trl_1549349836763157901": Error 1045: Access denied for user 'root'@'172.21.0.1' (using password: NO)

It's an error from trillian testdb.go and it's supper confusing for me, the first sql.Open request is made outside on 127.0.0.1:3306 but in next step db.ExecContext() makes it on 172.21.0.1

So the question is for what purpose do we have docker-compose mysql, if tests are not interacting with it?
Even though, it should work, port is exposed, we have MYSQL_RANDOM_ROOT_PASSWORD: "yes".

I got these errors too and it wasn't clear to me what the root case was.
It was able to fix it by starting the db container first like so:

docker-compose down # stop all existing containers
docker-compose up -d db # start just the db container and make sure it comes online ok.
docker-compose up # start everything else

In the process of investigating, I also realized we were handling SSL keys the wrong way which I fixed in #1191

@Zyqsempai could you verify whether these changes fix this issue?

On further investigation, I can confirm that this is an issue. The integration tests, do expect the root mysql user to have an empty password which the MYSQL_RANDOM_ROOT_PASSWORD: yes obviously breaks. This is something I'll discuss with the team.