Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,508,545
Community Members
 
Community Events
181
Community Groups

How to use multiple mysql container databases to run php unit tests in parallel

Edited

My team is using Laravel tested with phpunit.

 

We want to run our tests in parallel however when using paratest it tries to connect to multiple databases, and the databases need to exist before running it. 

 

For example if my database name is nova, it will try to connect to nova_1, nova_2...nova_N, for each process in parallel. 

 

I could write a script to connect to msyql and create those databases, but I thought it might be easier to define multiple containers with mysql databases for each up to N processes. 

 

Is there a way to to use more than one mysql container database so I can achieve this?

 

https://laravel.com/docs/9.x/testing#running-tests-in-parallel

1 answer

0 votes

Hi Drew,

I don't think this is possible with service containers, as they don't support port mapping and each service will use its default port. If you define multiple mysql services, all of them will try to use port 3306 and the build will fail.

However, you can spin up multiple database containers with Docker Compose instead and use a different port for each container, or you could use one mysql service container and create the different databases in that container.

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events