Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Enable testing with MySQL and Postgres on Travis-CI #171
This PR enables MySQL and Postgres on Travis. I have a support ticket opened with their team to figure out how to add MariaDB alongside MySQL.
The build will fail b/c there are some issue with both MySQL and Postgres. I will try to fix them in subsequent commits.
@tkdchen this is ready for merge.
I have update the Travis CI config to use their Ubuntu Trusty infrastructure b/c I was having lots of problems with MariaDB on their older infrastructure.
I have also updated some of the tests, mostly to avoid duplicate objects so they now PASS.
Note1: I have cherry-picked #157 here and later modified it to special case the migration for PostgreSQL. This turned out to be a bug in Django 1.8, which is documented and already fixed (reference in comments and commit log) but not backported. Also note that we can't use RunSQL for SQLite here b/c the necessary syntax isn't supported. Django ORM goes behind the scenes and provides the migration for us (add column, copy data, drop column, rename, etc).
Note 2: Currently tests for PostgreSQL fail. At least one of them is related to my other PRs where I refactor the SQL. My vote is to merge this PR as-is and I will work to add more tests to my other PRs and work to fix the PostgreSQL failures there.
referenced this pull request
Apr 2, 2017
@tkdchen I think this is ready to merge so we can continue forward. I hate to merge with failing Postgres but MySQL, MariaDB and sqlite all work fine and some of the fixes are covered into other PRs. I don't think we have a lot of other options here otherwise this PR will become very big and there are other problems to worry about too.
This is a big step forward to the testing. However, the problem is there is dependency of Travis in Nitrate source code, and this testing matrix cannot run locally by developer. I prefer to a solution to avoid these two major disadvantages.
Basically, the testing matrix should
The second ability should be able to be used in Travis-CI to run the testing matrix.
In my mind, docker would be a good tool to help us to build this testing matrix, and obviously some scripts would be required.
Currently, to run whole test suite, I can simple run
It should be easy to make these steps happen in a docker container. Fedora 25 docker image can be used and it is ok to use the version of MySQL, MariaDB and PostgreSQL in Fedora repo.
Finally, there could be these ways to run tests matrix
Thank you for making this improvement. It's valuable and develop our ideas. Let's make it better and better.
I'll look at other commits in this PR from tomorrow. Have a good day. :)
I think this can easily be done in the settings and then simply ask Travis to execute whichever command fits its matrix. In this way we move the infrastructure dependency in
I will rework the settings for that. It is up to the developer to prepare their local environment for whichever DB they want to test on. I will also update the docs with commands how to install dependencies and run the tests against different databases.
Note: vagrant or docker will be a great help but that's up to each developer to decide how to use. IMO this needs to come at a later stage because this PR is quite big already. What do you think?
@tkdchen see the updated documentation and the last 3 commits for the latest changes. It is not possible to execute the tests on the local machine by specifying which database to use. The same commands are integrated into Travis as well. All of the integration happens in .travis.yml.
Using Travis to run tests does not mean there is a dependency of Travis to run tests. Simply say I don't want this line of code appears in source code
Documentation is good but not always. For running tests, I prefer to make it as easy as possible with just one command, no need of steps
Instead, as mentioned in my previous comment, just
If someone is interested in the steps to build testing environment, just open and read the relative scripts. That should be more straightforward than lots of words in documentation and easy understand.
@atodorov We talked a lot in IRC channel #nitrate. You did a good job to make it possible to run tests on different database engines. Hopefully, you could continue improving based on the changes in this PR to make running tests more easily.
I'd like to repeat my thought again
Detailed documentation in this PR is good, I think it could be as reference for developers who are interested in hacking the tests for themselves.
Is this clear and make sense?
Updated and rebased.
@tkdchen let's move this comment #171 (comment) into a separate issue. I understand the value proposition of it and it is definitely doable even in the short term. However not everyone would like to follow exactly the same steps so we shouldn't force it. Plus a separate issue will allow us to discuss into more details. What do you think?