How to configure parallel steps with a MySQL database

kvgysegh September 26, 2019

Hi,

I'm developping a CakePHP application. The application has about 1500 tests which take about 4 hours to run sequentially. Therefore I want to use parallel pipelines to run 10 tests at the same time.

CakePHP tests create, delete and empty tables on most of the tests, so when alle 10 pipelines this can be a problem, when 1 test is using a table and the other one deletes it. 

I've configured the 10 pipelines and written a custom PHP script that generates a PHPUnit test-suite for each of these 10 pipelines. Each test suite sets a DB_NAME environment variable so each pipeline can run on another database. I've added custom PHP code to create the database when it does not exists.

Locally, everything works perfect. However, when running the tests in Bitbucket pipelines I get the error: "Access denied for user 'testuser'@'%' to database 'test6'". So the default user can't create new databases next to the default "pipelines" database. And the documentation mentions no other users and also mentions that the root user is not available. 

 

How can I fix this so I can run parallel tests? Waiting 4 hours to finish testing is not an option.

1 answer

0 votes
Steven Vaccarella
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 3, 2019

Hi kvgysegh,

Are you running the MySQL database as a service inside Pipelines? Can you post your bitbucket-pipelines.yml configuration file (with any sensitive information redacted)? Note that if you're using Pipelines services, each step will get a separate whole service, ie. a separate whole MySQL instance, so there is no need to use different database names within MySQL.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events